Search in sources :

Example 1 with GradleLauncher

use of org.gradle.initialization.GradleLauncher in project gradle by gradle.

the class DefaultIncludedBuild method getLoadedSettings.

@Override
public SettingsInternal getLoadedSettings() {
    if (settings == null) {
        GradleLauncher gradleLauncher = getGradleLauncher();
        gradleLauncher.load();
        settings = gradleLauncher.getSettings();
    }
    return settings;
}
Also used : GradleLauncher(org.gradle.initialization.GradleLauncher)

Example 2 with GradleLauncher

use of org.gradle.initialization.GradleLauncher in project gradle by gradle.

the class DefaultIncludedBuild method getConfiguredBuild.

@Override
public GradleInternal getConfiguredBuild() {
    if (gradle == null) {
        GradleLauncher gradleLauncher = getGradleLauncher();
        gradleLauncher.getBuildAnalysis();
        settings = gradleLauncher.getSettings();
        gradle = gradleLauncher.getGradle();
    }
    return gradle;
}
Also used : GradleLauncher(org.gradle.initialization.GradleLauncher)

Example 3 with GradleLauncher

use of org.gradle.initialization.GradleLauncher in project gradle by gradle.

the class DefaultIncludedBuildFactory method createBuild.

@Override
public ConfigurableIncludedBuild createBuild(File buildDirectory) {
    validateBuildDirectory(buildDirectory);
    Factory<GradleLauncher> factory = new ContextualGradleLauncherFactory(buildDirectory, nestedBuildFactory, startParameter);
    DefaultIncludedBuild includedBuild = instantiator.newInstance(DefaultIncludedBuild.class, buildDirectory, factory, moduleIdentifierFactory);
    SettingsInternal settingsInternal = includedBuild.getLoadedSettings();
    validateIncludedBuild(includedBuild, settingsInternal);
    return includedBuild;
}
Also used : SettingsInternal(org.gradle.api.internal.SettingsInternal) GradleLauncher(org.gradle.initialization.GradleLauncher)

Example 4 with GradleLauncher

use of org.gradle.initialization.GradleLauncher in project gradle by gradle.

the class InProcessBuildActionExecuter method execute.

public Object execute(BuildAction action, BuildRequestContext buildRequestContext, BuildActionParameters actionParameters, ServiceRegistry contextServices) {
    GradleLauncher gradleLauncher = gradleLauncherFactory.newInstance(action.getStartParameter(), buildRequestContext, contextServices);
    try {
        gradleLauncher.addStandardOutputListener(buildRequestContext.getOutputListener());
        gradleLauncher.addStandardErrorListener(buildRequestContext.getErrorListener());
        GradleBuildController buildController = new GradleBuildController(gradleLauncher);
        buildActionRunner.run(action, buildController);
        return buildController.getResult();
    } finally {
        gradleLauncher.stop();
    }
}
Also used : GradleLauncher(org.gradle.initialization.GradleLauncher)

Example 5 with GradleLauncher

use of org.gradle.initialization.GradleLauncher 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)

Aggregations

GradleLauncher (org.gradle.initialization.GradleLauncher)6 StartParameter (org.gradle.StartParameter)1 GradleInternal (org.gradle.api.internal.GradleInternal)1 SettingsInternal (org.gradle.api.internal.SettingsInternal)1 ClassPath (org.gradle.internal.classpath.ClassPath)1 DefaultClassPath (org.gradle.internal.classpath.DefaultClassPath)1 Path (org.gradle.util.Path)1