use of org.gradle.internal.build.BuildState in project gradle by gradle.
the class CompositeBuildClassPathInitializer method execute.
@Override
public void execute(Configuration classpath) {
List<TaskIdentifier> tasksToBuild = new ArrayList<>();
for (Task task : classpath.getBuildDependencies().getDependencies(null)) {
if (!task.getState().getExecuted()) {
// This check should live lower down, and should have some kind of synchronization around it, as other threads may be
// running tasks at the same time
BuildState targetBuild = ((ProjectInternal) task.getProject()).getOwner().getOwner();
assert targetBuild != currentBuild;
tasksToBuild.add(TaskIdentifier.of(targetBuild.getBuildIdentifier(), (TaskInternal) task));
}
}
if (!tasksToBuild.isEmpty()) {
buildTreeWorkGraphController.withNewWorkGraph(graph -> {
graph.scheduleWork(builder -> {
for (TaskIdentifier taskIdentifier : tasksToBuild) {
buildTreeWorkGraphController.locateTask(taskIdentifier).queueForExecution();
}
});
graph.runWork().rethrow();
return null;
});
}
}
use of org.gradle.internal.build.BuildState in project gradle by gradle.
the class DefaultIncludedBuildTaskGraph method locateTask.
@Override
public IncludedBuildTaskResource locateTask(TaskIdentifier taskIdentifier) {
return withState(workGraph -> {
BuildState build = buildRegistry.getBuild(taskIdentifier.getBuildIdentifier());
ExportedTaskNode taskNode = build.getWorkGraph().locateTask(taskIdentifier);
return new TaskBackedResource(workGraph, build, taskNode);
});
}
use of org.gradle.internal.build.BuildState in project gradle by gradle.
the class GradleBuildBuilder method addIncludedBuilds.
private void addIncludedBuilds(GradleInternal gradle, DefaultGradleBuild model, Map<BuildState, DefaultGradleBuild> all) {
for (IncludedBuildInternal reference : gradle.includedBuilds()) {
BuildState target = reference.getTarget();
if (target instanceof IncludedBuildState) {
IncludedBuildState includedBuildState = (IncludedBuildState) target;
DefaultGradleBuild convertedIncludedBuild = convert(includedBuildState, all);
model.addIncludedBuild(convertedIncludedBuild);
} else if (target instanceof RootBuildState) {
DefaultGradleBuild rootBuild = convert(target, all);
model.addIncludedBuild(rootBuild);
} else {
throw new IllegalStateException("Unknown build type: " + reference.getClass().getName());
}
}
}
use of org.gradle.internal.build.BuildState in project gradle by gradle.
the class IdeaModelBuilder method applyIdeaPlugin.
private void applyIdeaPlugin(ProjectInternal root, List<GradleInternal> alreadyProcessed) {
Set<Project> allProjects = root.getAllprojects();
for (Project p : allProjects) {
p.getPluginManager().apply(IdeaPlugin.class);
}
for (IncludedBuildInternal reference : root.getGradle().includedBuilds()) {
BuildState target = reference.getTarget();
if (target instanceof IncludedBuildState) {
target.ensureProjectsConfigured();
GradleInternal build = target.getMutableModel();
if (!alreadyProcessed.contains(build)) {
alreadyProcessed.add(build);
applyIdeaPlugin(build.getRootProject(), alreadyProcessed);
}
}
}
}
use of org.gradle.internal.build.BuildState in project gradle by gradle.
the class EclipseModelBuilder method collectAllProjects.
private List<Project> collectAllProjects(List<Project> all, GradleInternal gradle, Set<Gradle> allBuilds) {
all.addAll(gradle.getRootProject().getAllprojects());
for (IncludedBuildInternal reference : gradle.includedBuilds()) {
BuildState target = reference.getTarget();
if (target instanceof IncludedBuildState) {
target.ensureProjectsConfigured();
GradleInternal build = target.getMutableModel();
if (!allBuilds.contains(build)) {
allBuilds.add(build);
collectAllProjects(all, build, allBuilds);
}
}
}
return all;
}
Aggregations