use of org.gradle.internal.operations.RunnableBuildOperation in project gradle by gradle.
the class BuildOperationScriptPlugin method apply.
@Override
public void apply(final Object target) {
TextResource resource = getSource().getResource();
if (resource.isContentCached() && resource.getHasEmptyContent()) {
// no operation, if there is no script code provided
decorated.apply(target);
} else {
userCodeApplicationContext.apply(getSource().getShortDisplayName(), userCodeApplicationId -> buildOperationExecutor.run(new RunnableBuildOperation() {
@Override
public void run(BuildOperationContext context) {
decorated.apply(target);
context.setResult(OPERATION_RESULT);
}
@Override
public BuildOperationDescriptor.Builder description() {
final ScriptSource source = getSource();
final ResourceLocation resourceLocation = source.getResource().getLocation();
final File file = resourceLocation.getFile();
String name = "Apply " + source.getShortDisplayName();
final String displayName = name + " to " + target;
return BuildOperationDescriptor.displayName(displayName).name(name).details(new OperationDetails(file, resourceLocation, ConfigurationTargetIdentifier.of(target), userCodeApplicationId));
}
}));
}
}
use of org.gradle.internal.operations.RunnableBuildOperation in project gradle by gradle.
the class NotifyingBuildLoader method load.
@Override
public void load(final SettingsInternal settings, final GradleInternal gradle) {
final String buildPath = gradle.getIdentityPath().toString();
buildOperationExecutor.call(new CallableBuildOperation<Void>() {
@Override
public BuildOperationDescriptor.Builder description() {
// noinspection Convert2Lambda
return BuildOperationDescriptor.displayName("Load projects").progressDisplayName("Loading projects").details(new LoadProjectsBuildOperationType.Details() {
@Override
public String getBuildPath() {
return buildPath;
}
});
}
@Override
public Void call(BuildOperationContext context) {
buildLoader.load(settings, gradle);
context.setResult(createOperationResult(gradle, buildPath));
return null;
}
});
buildOperationExecutor.run(new RunnableBuildOperation() {
@Override
public void run(BuildOperationContext context) {
gradle.getBuildListenerBroadcaster().projectsLoaded(gradle);
context.setResult(PROJECTS_LOADED_OP_RESULT);
}
@Override
public BuildOperationDescriptor.Builder description() {
// noinspection Convert2Lambda
return BuildOperationDescriptor.displayName(gradle.contextualize("Notify projectsLoaded listeners")).details(new NotifyProjectsLoadedBuildOperationType.Details() {
@Override
public String getBuildPath() {
return buildPath;
}
});
}
});
}
Aggregations