Search in sources :

Example 1 with StartParameter

use of org.gradle.StartParameter in project gradle by gradle.

the class BuildSourceBuilder method buildGradleLauncher.

private GradleLauncher buildGradleLauncher(StartParameter startParameter) {
    StartParameter startParameterArg = startParameter.newInstance();
    startParameterArg.setProjectProperties(startParameter.getProjectProperties());
    startParameterArg.setSearchUpwards(false);
    startParameterArg.setProfile(startParameter.isProfile());
    GradleLauncher gradleLauncher = nestedBuildFactory.nestedInstance(startParameterArg);
    GradleInternal build = gradleLauncher.getGradle();
    if (build.getParent().findIdentityPath() == null) {
        // When nested inside a nested build, we need to synthesize a path for this build, as the root project is not yet known for the parent build
        // Use the directory structure to do this. This means that the buildSrc build and its containing build may end up with different paths
        Path path = build.getParent().getParent().getIdentityPath().child(startParameter.getCurrentDir().getParentFile().getName()).child(startParameter.getCurrentDir().getName());
        build.setIdentityPath(path);
    }
    return gradleLauncher;
}
Also used : Path(org.gradle.util.Path) DefaultClassPath(org.gradle.internal.classpath.DefaultClassPath) ClassPath(org.gradle.internal.classpath.ClassPath) StartParameter(org.gradle.StartParameter) GradleLauncher(org.gradle.initialization.GradleLauncher) GradleInternal(org.gradle.api.internal.GradleInternal)

Example 2 with StartParameter

use of org.gradle.StartParameter in project gradle by gradle.

the class DefaultBuildConfigurer method maybeInformAboutIncubatingMode.

private void maybeInformAboutIncubatingMode(GradleInternal gradle) {
    StartParameter startParameter = gradle.getStartParameter();
    if (startParameter.isParallelProjectExecutionEnabled() && startParameter.isConfigureOnDemand()) {
        SingleMessageLogger.incubatingFeatureUsed("Parallel execution with configuration on demand");
        maybeInformAboutParallelLimitations(gradle);
    } else if (startParameter.isParallelProjectExecutionEnabled()) {
        SingleMessageLogger.incubatingFeatureUsed("Parallel execution");
        maybeInformAboutParallelLimitations(gradle);
    } else if (startParameter.isConfigureOnDemand()) {
        SingleMessageLogger.incubatingFeatureUsed("Configuration on demand");
    }
}
Also used : StartParameter(org.gradle.StartParameter)

Example 3 with StartParameter

use of org.gradle.StartParameter in project gradle by gradle.

the class DefaultBuildConfigurer method maybeInformAboutParallelLimitations.

private void maybeInformAboutParallelLimitations(GradleInternal gradle) {
    StartParameter startParameter = gradle.getStartParameter();
    int childProjectCount = gradle.getRootProject().getChildProjects().size();
    if (childProjectCount > 1 && startParameter.getTaskNames().size() > 1 && startParameter.getTaskNames().contains("clean")) {
        LOGGER.warn("Using the 'clean' task in combination with parallel execution may lead to unexpected runtime behavior.");
    }
}
Also used : StartParameter(org.gradle.StartParameter)

Example 4 with StartParameter

use of org.gradle.StartParameter in project gradle by gradle.

the class ProviderConnection method run.

public Object run(InternalBuildAction<?> clientAction, BuildCancellationToken cancellationToken, ProviderOperationParameters providerParameters) {
    List<String> tasks = providerParameters.getTasks();
    SerializedPayload serializedAction = payloadSerializer.serialize(clientAction);
    Parameters params = initParams(providerParameters);
    StartParameter startParameter = new ProviderStartParameterConverter().toStartParameter(providerParameters, params.properties);
    ProgressListenerConfiguration listenerConfig = ProgressListenerConfiguration.from(providerParameters);
    BuildAction action = new ClientProvidedBuildAction(startParameter, serializedAction, tasks != null, listenerConfig.clientSubscriptions);
    return run(action, cancellationToken, listenerConfig, providerParameters, params);
}
Also used : SerializedPayload(org.gradle.tooling.internal.provider.serialization.SerializedPayload) StartParameter(org.gradle.StartParameter) ProviderConnectionParameters(org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) DaemonParameters(org.gradle.launcher.daemon.configuration.DaemonParameters) BuildActionParameters(org.gradle.launcher.exec.BuildActionParameters) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) InternalBuildAction(org.gradle.tooling.internal.protocol.InternalBuildAction) BuildAction(org.gradle.internal.invocation.BuildAction)

Example 5 with StartParameter

use of org.gradle.StartParameter in project gradle by gradle.

the class BuildDefinition method fromStartParameterForBuild.

public static BuildDefinition fromStartParameterForBuild(StartParameter startParameter, File buildRootDir, PluginRequests pluginRequests) {
    StartParameter includedBuildStartParam = startParameter.newBuild();
    includedBuildStartParam.setCurrentDir(buildRootDir);
    includedBuildStartParam.setSearchUpwards(false);
    includedBuildStartParam.setConfigureOnDemand(false);
    includedBuildStartParam.setInitScripts(startParameter.getInitScripts());
    return new BuildDefinition(buildRootDir, includedBuildStartParam, pluginRequests);
}
Also used : StartParameter(org.gradle.StartParameter)

Aggregations

StartParameter (org.gradle.StartParameter)25 GradleInternal (org.gradle.api.internal.GradleInternal)4 File (java.io.File)3 ClassPath (org.gradle.internal.classpath.ClassPath)3 ListenerManager (org.gradle.internal.event.ListenerManager)3 Path (org.gradle.util.Path)3 ArrayList (java.util.ArrayList)2 Project (org.gradle.api.Project)2 Task (org.gradle.api.Task)2 TaskExecutionStatisticsEventAdapter (org.gradle.api.internal.tasks.execution.statistics.TaskExecutionStatisticsEventAdapter)2 Gradle (org.gradle.api.invocation.Gradle)2 ShowStacktrace (org.gradle.api.logging.configuration.ShowStacktrace)2 GradleLauncher (org.gradle.initialization.GradleLauncher)2 BuildLogger (org.gradle.internal.buildevents.BuildLogger)2 TaskExecutionStatisticsReporter (org.gradle.internal.buildevents.TaskExecutionStatisticsReporter)2 ScriptUsageLocationReporter (org.gradle.internal.featurelifecycle.ScriptUsageLocationReporter)2 Properties (java.util.Properties)1 TaskExecutionRequest (org.gradle.TaskExecutionRequest)1 Settings (org.gradle.api.initialization.Settings)1 BuildDefinition (org.gradle.api.internal.BuildDefinition)1