use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class WindowsResourceCompile method compile.
@TaskAction
public void compile(IncrementalTaskInputs inputs) {
BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
NativeCompileSpec spec = new DefaultWindowsResourceCompileSpec();
spec.setTempDir(getTemporaryDir());
spec.setObjectFileDir(getOutputDir());
spec.include(getIncludes());
spec.source(getSource());
spec.setMacros(getMacros());
spec.args(getCompilerArgs());
spec.setIncrementalCompile(inputs.isIncremental());
spec.setOperationLogger(operationLogger);
NativeToolChainInternal nativeToolChain = (NativeToolChainInternal) toolChain.get();
NativePlatformInternal nativePlatform = (NativePlatformInternal) targetPlatform.get();
PlatformToolProvider platformToolProvider = nativeToolChain.select(nativePlatform);
WorkResult result = doCompile(spec, platformToolProvider);
setDidWork(result.getDidWork());
}
use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class IncrementalSwiftCompiler method execute.
@Override
public WorkResult execute(SwiftCompileSpec spec) {
final boolean didRemove;
if (spec.isIncrementalCompile()) {
didRemove = deleteOutputsForRemovedSources(spec);
} else {
didRemove = cleanPreviousOutputs(spec);
}
WorkResult compileResult = compile(spec);
return WorkResults.didWork(didRemove || compileResult.getDidWork());
}
use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class AbstractLinkTask method link.
@TaskAction
public void link() {
SimpleStaleClassCleaner cleaner = new SimpleStaleClassCleaner(getOutputs());
cleaner.setDestinationDir(getDestinationDirectory().get().getAsFile());
cleaner.execute();
if (getSource().isEmpty()) {
setDidWork(cleaner.getDidWork());
return;
}
LinkerSpec spec = createLinkerSpec();
spec.setTargetPlatform(getTargetPlatform().get());
spec.setTempDir(getTemporaryDir());
spec.setOutputFile(getLinkedFile().get().getAsFile());
spec.objectFiles(getSource());
spec.libraries(getLibs());
spec.args(getLinkerArgs().get());
spec.setDebuggable(getDebuggable().get());
BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
spec.setOperationLogger(operationLogger);
Compiler<LinkerSpec> compiler = createCompiler();
compiler = BuildOperationLoggingCompilerDecorator.wrap(compiler);
WorkResult result = compiler.execute(spec);
setDidWork(result.getDidWork());
}
use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class ExtractSymbols method extractSymbols.
// TODO: Need to track version/implementation of symbol extraction tool.
@TaskAction
public void extractSymbols() {
BuildOperationLogger operationLogger = getServices().get(BuildOperationLoggerFactory.class).newOperationLogger(getName(), getTemporaryDir());
SymbolExtractorSpec spec = new DefaultSymbolExtractorSpec();
spec.setBinaryFile(binaryFile.get().getAsFile());
spec.setSymbolFile(symbolFile.get().getAsFile());
spec.setOperationLogger(operationLogger);
Compiler<SymbolExtractorSpec> symbolExtractor = createCompiler();
symbolExtractor = BuildOperationLoggingCompilerDecorator.wrap(symbolExtractor);
WorkResult result = symbolExtractor.execute(spec);
setDidWork(result.getDidWork());
}
use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class NormalizingCopyActionDecorator method execute.
public WorkResult execute(final CopyActionProcessingStream stream) {
final Set<RelativePath> visitedDirs = new HashSet<RelativePath>();
final ListMultimap<RelativePath, FileCopyDetailsInternal> pendingDirs = ArrayListMultimap.create();
WorkResult result = delegate.execute(new CopyActionProcessingStream() {
public void process(final CopyActionProcessingStreamAction action) {
stream.process(new CopyActionProcessingStreamAction() {
public void processFile(FileCopyDetailsInternal details) {
if (details.isDirectory()) {
RelativePath path = details.getRelativePath();
if (!visitedDirs.contains(path)) {
pendingDirs.put(path, details);
}
} else {
maybeVisit(details.getRelativePath().getParent(), details.isIncludeEmptyDirs(), action);
action.processFile(details);
}
}
});
for (RelativePath path : new LinkedHashSet<RelativePath>(pendingDirs.keySet())) {
List<FileCopyDetailsInternal> detailsList = new ArrayList<FileCopyDetailsInternal>(pendingDirs.get(path));
for (FileCopyDetailsInternal details : detailsList) {
if (details.isIncludeEmptyDirs()) {
maybeVisit(path, details.isIncludeEmptyDirs(), action);
}
}
}
visitedDirs.clear();
pendingDirs.clear();
}
private void maybeVisit(RelativePath path, boolean includeEmptyDirs, CopyActionProcessingStreamAction delegateAction) {
if (path == null || path.getParent() == null || !visitedDirs.add(path)) {
return;
}
maybeVisit(path.getParent(), includeEmptyDirs, delegateAction);
List<FileCopyDetailsInternal> detailsForPath = pendingDirs.removeAll(path);
FileCopyDetailsInternal dir;
if (detailsForPath.isEmpty()) {
// TODO - this is pretty nasty, look at avoiding using a time bomb stub here
dir = new StubbedFileCopyDetails(path, includeEmptyDirs, chmod);
} else {
dir = detailsForPath.get(0);
}
delegateAction.processFile(dir);
}
});
return result;
}
Aggregations