use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class DefaultIncludedBuildExecuter method checkNoCycles.
private void checkNoCycles(BuildRequest buildRequest, BuildIdentifier target, List<BuildIdentifier> candidateCycle) {
candidateCycle.add(target);
for (BuildRequest executingBuild : executingBuilds) {
if (executingBuild.requestingBuild.equals(target)) {
BuildIdentifier nextTarget = executingBuild.targetBuild;
if (nextTarget.equals(buildRequest.requestingBuild)) {
candidateCycle.add(nextTarget);
ProjectComponentSelector selector = DefaultProjectComponentSelector.newSelector(buildRequest.targetBuild, ":");
throw new ModuleVersionResolveException(selector, "Included build dependency cycle: " + reportCycle(candidateCycle));
}
checkNoCycles(buildRequest, nextTarget, candidateCycle);
}
}
candidateCycle.remove(target);
}
use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class ComponentIdentifierSerializer method write.
public void write(Encoder encoder, ComponentIdentifier value) throws IOException {
if (value == null) {
throw new IllegalArgumentException("Provided component identifier may not be null");
}
Implementation implementation = resolveImplementation(value);
encoder.writeByte(implementation.getId());
if (implementation == Implementation.MODULE) {
ModuleComponentIdentifier moduleComponentIdentifier = (ModuleComponentIdentifier) value;
encoder.writeString(moduleComponentIdentifier.getGroup());
encoder.writeString(moduleComponentIdentifier.getModule());
encoder.writeString(moduleComponentIdentifier.getVersion());
} else if (implementation == Implementation.BUILD) {
ProjectComponentIdentifier projectComponentIdentifier = (ProjectComponentIdentifier) value;
BuildIdentifier build = projectComponentIdentifier.getBuild();
buildIdentifierSerializer.write(encoder, build);
encoder.writeString(projectComponentIdentifier.getProjectPath());
} else if (implementation == Implementation.LIBRARY) {
LibraryBinaryIdentifier libraryIdentifier = (LibraryBinaryIdentifier) value;
encoder.writeString(libraryIdentifier.getProjectPath());
encoder.writeString(libraryIdentifier.getLibraryName());
encoder.writeString(libraryIdentifier.getVariant());
} else {
throw new IllegalStateException("Unsupported implementation type: " + implementation);
}
}
use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class CompositeBuildTaskDelegate method executeTasksInOtherBuild.
@TaskAction
public void executeTasksInOtherBuild() {
IncludedBuilds includedBuilds = getServices().get(IncludedBuilds.class);
IncludedBuildExecuter builder = getServices().get(IncludedBuildExecuter.class);
IncludedBuild includedBuild = includedBuilds.getBuild(build);
BuildIdentifier buildId = new DefaultBuildIdentifier(includedBuild.getName());
// sourceBuild is currently always root build in a composite
builder.execute(new DefaultBuildIdentifier(":", true), buildId, tasks);
}
use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class DefaultIncludedBuildExecuter method reportCycle.
private String reportCycle(List<BuildIdentifier> cycle) {
StringBuilder cycleReport = new StringBuilder();
for (BuildIdentifier buildIdentifier : cycle) {
cycleReport.append(buildIdentifier);
cycleReport.append(" -> ");
}
cycleReport.append(cycle.get(0));
return cycleReport.toString();
}
use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.
the class IncludedBuildArtifactBuilder method willBuild.
public void willBuild(ComponentArtifactMetadata artifact) {
if (artifact instanceof CompositeProjectComponentArtifactMetadata) {
CompositeProjectComponentArtifactMetadata compositeBuildArtifact = (CompositeProjectComponentArtifactMetadata) artifact;
BuildIdentifier buildId = getBuildIdentifier(compositeBuildArtifact);
addTasksForBuild(buildId, compositeBuildArtifact);
}
}
Aggregations