use of org.gradle.internal.resource.ResourceLocation in project gradle by gradle.
the class UriScriptSource method getFileName.
public String getFileName() {
ResourceLocation location = resource.getLocation();
File sourceFile = location.getFile();
URI sourceUri = location.getURI();
return sourceFile != null ? sourceFile.getPath() : sourceUri.toString();
}
use of org.gradle.internal.resource.ResourceLocation 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));
}
}));
}
}
Aggregations