use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class IncludedBuildArtifactBuilder method build.
public void build(BuildIdentifier requestingBuild, ComponentArtifactMetadata artifact) {
if (artifact instanceof CompositeProjectComponentArtifactMetadata) {
CompositeProjectComponentArtifactMetadata compositeBuildArtifact = (CompositeProjectComponentArtifactMetadata) artifact;
BuildIdentifier buildId = getBuildIdentifier(compositeBuildArtifact);
Collection<String> tasksToExecute = addTasksForBuild(buildId, compositeBuildArtifact);
execute(requestingBuild, buildId, tasksToExecute);
}
}
use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class CompositeBuildClassPathInitializer method build.
public void build(BuildIdentifier requestingBuild, ComponentArtifactIdentifier artifact) {
if (artifact instanceof CompositeProjectComponentArtifactMetadata) {
CompositeProjectComponentArtifactMetadata compositeBuildArtifact = (CompositeProjectComponentArtifactMetadata) artifact;
BuildIdentifier targetBuild = getBuildIdentifier(compositeBuildArtifact);
assert !requestingBuild.equals(targetBuild);
Set<String> tasks = compositeBuildArtifact.getTasks();
for (String taskName : tasks) {
includedBuildTaskGraph.addTask(requestingBuild, targetBuild, taskName);
}
for (String taskName : tasks) {
includedBuildTaskGraph.awaitCompletion(targetBuild, taskName);
}
}
}
use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class DefaultBuildableCompositeBuildContext method getRegisteredProject.
private RegisteredProject getRegisteredProject(ProjectComponentIdentifier project) {
RegisteredProject registeredProject = projectMetadata.get(project);
BuildIdentifier buildIdentifier = project.getBuild();
if (registeredProject == null && !configuredBuilds.contains(buildIdentifier)) {
// TODO: This shouldn't rely on the state of configuredBuilds to figure out whether or not we should configure this build again
// This is to prevent a recursive loop through this when we're configuring the build
configuredBuilds.add(buildIdentifier);
IncludedBuildInternal includedBuild = includedBuildRegistry.getBuild(buildIdentifier);
if (includedBuild != null) {
projectMetadata.putAll(dependencyMetadataBuilder.build(includedBuild));
registeredProject = projectMetadata.get(project);
if (registeredProject == null) {
throw new IllegalStateException(project + " was not found.");
}
}
}
return registeredProject;
}
use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class DefaultIncludedBuildRegistry method registerProjects.
private void registerProjects(Iterable<IncludedBuildInternal> includedBuilds, boolean isImplicitBuild) {
for (IncludedBuildInternal includedBuild : includedBuilds) {
Path rootProjectPath = Path.ROOT.child(includedBuild.getName());
BuildIdentifier buildIdentifier = new DefaultBuildIdentifier(includedBuild.getName());
Set<DefaultProjectDescriptor> allProjects = includedBuild.getLoadedSettings().getProjectRegistry().getAllProjects();
registerProjects(rootProjectPath, buildIdentifier, allProjects, isImplicitBuild);
}
}
use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class DefaultIncludedBuildTaskGraph method checkNoCycles.
private void checkNoCycles(BuildIdentifier sourceBuild, BuildIdentifier targetBuild, List<BuildIdentifier> candidateCycle) {
candidateCycle.add(targetBuild);
for (BuildIdentifier nextTarget : buildDependencies.get(targetBuild)) {
if (sourceBuild.equals(nextTarget)) {
candidateCycle.add(nextTarget);
ProjectComponentSelector selector = DefaultProjectComponentSelector.newSelector(candidateCycle.get(0), Path.ROOT.getPath());
throw new ModuleVersionResolveException(selector, "Included build dependency cycle: " + reportCycle(candidateCycle));
}
checkNoCycles(sourceBuild, nextTarget, candidateCycle);
}
candidateCycle.remove(targetBuild);
}
Aggregations