use of org.gradle.api.internal.artifacts.DefaultBuildIdentifier in project gradle by gradle.
the class IncludedBuildTaskReferenceResolver method constructTask.
@Override
public Task constructTask(final TaskReference reference, TaskContainer tasks) {
if (!(reference instanceof IncludedBuildTaskReference)) {
return null;
}
final IncludedBuildTaskReference ref = (IncludedBuildTaskReference) reference;
final BuildIdentifier sourceBuild = buildIdentity.getCurrentBuild();
final BuildIdentifier targetBuild = new DefaultBuildIdentifier(ref.getBuildName());
includedBuilds.addTask(sourceBuild, targetBuild, ref.getTaskPath());
String delegateTaskName = ref.getName();
Task task = tasks.findByName(delegateTaskName);
if (task == null) {
return tasks.create(delegateTaskName, CompositeBuildTaskDelegate.class, new Action<CompositeBuildTaskDelegate>() {
@Override
public void execute(CompositeBuildTaskDelegate compositeBuildTaskDelegate) {
compositeBuildTaskDelegate.setBuild(targetBuild);
compositeBuildTaskDelegate.setTaskPath(ref.getTaskPath());
}
});
}
if (task instanceof CompositeBuildTaskDelegate) {
return task;
}
throw new TaskInstantiationException("Cannot create delegating task '" + delegateTaskName + "' as task with same name already exists.");
}
use of org.gradle.api.internal.artifacts.DefaultBuildIdentifier 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);
}
}
Aggregations