use of org.gradle.api.internal.GradleInternal 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;
}
use of org.gradle.api.internal.GradleInternal in project gradle by gradle.
the class DryRunBuildExecutionAction method execute.
public void execute(BuildExecutionContext context) {
GradleInternal gradle = context.getGradle();
if (gradle.getStartParameter().isDryRun()) {
for (Task task : gradle.getTaskGraph().getAllTasks()) {
task.setEnabled(false);
}
}
context.proceed();
}
use of org.gradle.api.internal.GradleInternal in project gradle by gradle.
the class ExcludedTaskFilteringBuildConfigurationAction method configure.
public void configure(BuildExecutionContext context) {
GradleInternal gradle = context.getGradle();
Set<String> excludedTaskNames = gradle.getStartParameter().getExcludedTaskNames();
if (!excludedTaskNames.isEmpty()) {
final Set<Spec<Task>> filters = new HashSet<Spec<Task>>();
for (String taskName : excludedTaskNames) {
filters.add(taskSelector.getFilter(taskName));
}
gradle.getTaskGraph().useFilter(Specs.intersect(filters));
}
context.proceed();
}
use of org.gradle.api.internal.GradleInternal in project gradle by gradle.
the class DefaultBuildController method getTargetProject.
private ProjectInternal getTargetProject(Object target) {
ProjectInternal project;
if (target == null) {
project = gradle.getDefaultProject();
} else if (target instanceof GradleProjectIdentity) {
GradleProjectIdentity projectIdentity = (GradleProjectIdentity) target;
GradleInternal build = findBuild(projectIdentity);
project = findProject(build, projectIdentity);
} else if (target instanceof GradleBuildIdentity) {
GradleBuildIdentity buildIdentity = (GradleBuildIdentity) target;
project = findBuild(buildIdentity).getDefaultProject();
} else {
throw new IllegalArgumentException("Don't know how to build models for " + target);
}
return project;
}
use of org.gradle.api.internal.GradleInternal in project gradle by gradle.
the class BuildModelActionRunner method run.
@Override
public void run(BuildAction action, final BuildController buildController) {
if (!(action instanceof BuildModelAction)) {
return;
}
final BuildModelAction buildModelAction = (BuildModelAction) action;
final GradleInternal gradle = buildController.getGradle();
gradle.addBuildListener(new BuildResultAdapter(gradle, buildController, buildModelAction));
if (buildModelAction.isModelRequest()) {
gradle.getStartParameter().setConfigureOnDemand(false);
}
if (buildModelAction.isRunTasks()) {
buildController.run();
} else {
buildController.configure();
}
}
Aggregations