use of org.gradle.api.internal.GradleInternal in project gradle by gradle.
the class IncludedBuildDependencyMetadataBuilder method build.
public LocalComponentMetadata build(CompositeBuildParticipantBuildState build, ProjectComponentIdentifier projectIdentifier) {
GradleInternal gradle = build.getMutableModel();
LocalComponentRegistry localComponentRegistry = gradle.getServices().get(LocalComponentRegistry.class);
DefaultLocalComponentMetadata originalComponent = (DefaultLocalComponentMetadata) localComponentRegistry.getComponent(projectIdentifier);
ProjectComponentIdentifier foreignIdentifier = build.idToReferenceProjectFromAnotherBuild(projectIdentifier);
return createCompositeCopy(foreignIdentifier, originalComponent);
}
use of org.gradle.api.internal.GradleInternal in project gradle by gradle.
the class DefaultRootBuildState method run.
@Override
public <T> T run(Function<? super BuildTreeLifecycleController, T> action) {
if (completed) {
throw new IllegalStateException("Cannot run more than one action for a build.");
}
try {
RootBuildLifecycleListener buildLifecycleListener = listenerManager.getBroadcaster(RootBuildLifecycleListener.class);
buildLifecycleListener.afterStart();
try {
GradleInternal gradle = getBuildController().getGradle();
DefaultDeploymentRegistry deploymentRegistry = gradle.getServices().get(DefaultDeploymentRegistry.class);
gradle.addBuildListener(new InternalBuildAdapter() {
@Override
public void buildFinished(BuildResult result) {
deploymentRegistry.buildFinished(result);
}
});
return action.apply(buildTreeLifecycleController);
} finally {
buildLifecycleListener.beforeComplete();
}
} finally {
completed = true;
}
}
use of org.gradle.api.internal.GradleInternal in project gradle by gradle.
the class RootOfNestedBuildTree method run.
@Override
public <T> T run(Function<? super BuildTreeLifecycleController, T> action) {
final GradleInternal gradle = getBuildController().getGradle();
ServiceRegistry services = gradle.getServices();
BuildOperationExecutor executor = services.get(BuildOperationExecutor.class);
return executor.call(new CallableBuildOperation<T>() {
@Override
public T call(BuildOperationContext context) {
gradle.addBuildListener(new InternalBuildAdapter() {
@Override
public void settingsEvaluated(Settings settings) {
buildName = settings.getRootProject().getName();
}
});
T result = action.apply(buildTreeLifecycleController);
context.setResult(new RunNestedBuildBuildOperationType.Result() {
});
return result;
}
@Override
public BuildOperationDescriptor.Builder description() {
return BuildOperationDescriptor.displayName("Run nested build").details(new RunNestedBuildBuildOperationType.Details() {
@Override
public String getBuildPath() {
return gradle.getIdentityPath().getPath();
}
});
}
});
}
use of org.gradle.api.internal.GradleInternal in project gradle by gradle.
the class DefaultIncludedBuildRegistry method ensureConfigured.
@Override
public void ensureConfigured(IncludedBuildState buildToConfigure) {
if (currentlyConfiguring.contains(buildToConfigure)) {
return;
}
currentlyConfiguring.add(buildToConfigure);
buildToConfigure.ensureProjectsConfigured();
GradleInternal gradle = buildToConfigure.getMutableModel();
for (IncludedBuildInternal reference : gradle.includedBuilds()) {
BuildState target = reference.getTarget();
if (target instanceof IncludedBuildState) {
dependencySubstitutionsBuilder.build((IncludedBuildState) target);
}
}
currentlyConfiguring.remove(buildToConfigure);
}
use of org.gradle.api.internal.GradleInternal in project gradle by gradle.
the class TaskNameResolvingBuildConfigurationAction method configure.
@Override
public void configure(BuildExecutionContext context) {
GradleInternal gradle = context.getGradle();
List<TaskExecutionRequest> taskParameters = gradle.getStartParameter().getTaskRequests();
for (TaskExecutionRequest taskParameter : taskParameters) {
List<TaskSelection> taskSelections = commandLineTaskParser.parseTasks(taskParameter);
for (TaskSelection taskSelection : taskSelections) {
LOGGER.info("Selected primary task '{}' from project {}", taskSelection.getTaskName(), taskSelection.getProjectPath());
context.getExecutionPlan().addEntryTasks(taskSelection.getTasks());
}
}
context.proceed();
}
Aggregations