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;
}
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;
}
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;
}
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();
}
}
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;
}
Aggregations