use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class GroovyCompile method compile.
@Override
@TaskAction
protected void compile() {
checkGroovyClasspathIsNonEmpty();
DefaultGroovyJavaJointCompileSpec spec = createSpec();
WorkResult result = getCompiler(spec).execute(spec);
setDidWork(result.getDidWork());
}
use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class IncrementalCompilationFinalizer method execute.
@Override
public WorkResult execute(JavaCompileSpec spec) {
WorkResult out = delegate.execute(spec);
if (!(out instanceof RecompilationNotNecessary)) {
//if recompilation was skipped
//there's no point in updating because we have exactly the same output classes)
updater.updateAnalysis(spec);
}
writer.storeJarSnapshots(spec.getCompileClasspath());
return out;
}
use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class DefaultScalaJavaJointCompiler method execute.
public WorkResult execute(ScalaJavaJointCompileSpec spec) {
scalaCompiler.execute(spec);
PatternFilterable patternSet = new PatternSet();
patternSet.include("**/*.java");
FileTree javaSource = spec.getSource().getAsFileTree().matching(patternSet);
if (!javaSource.isEmpty()) {
spec.setSource(javaSource);
javaCompiler.execute(spec);
}
return new WorkResult() {
public boolean getDidWork() {
return true;
}
};
}
use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class IncrementalNativeCompiler method execute.
@Override
public WorkResult execute(final T spec) {
spec.setSourceFileIncludeDirectives(incrementalCompilation.getSourceFileIncludeDirectives());
WorkResult workResult;
if (spec.isIncrementalCompile()) {
workResult = doIncrementalCompile(incrementalCompilation, spec);
} else {
workResult = doCleanIncrementalCompile(spec);
}
compileStateCache.set(incrementalCompilation.getFinalState());
return workResult;
}
use of org.gradle.api.tasks.WorkResult in project gradle by gradle.
the class SwiftCompile method compile.
@TaskAction
void compile(IncrementalTaskInputs inputs) {
final List<File> removedFiles = Lists.newArrayList();
final Set<File> changedFiles = Sets.newHashSet();
boolean isIncremental = inputs.isIncremental();
// which files changed and marking the compilation incremental or not.
if (isIncremental) {
inputs.outOfDate(new Action<InputFileDetails>() {
@Override
public void execute(InputFileDetails inputFileDetails) {
if (inputFileDetails.isModified()) {
changedFiles.add(inputFileDetails.getFile());
}
}
});
inputs.removed(new Action<InputFileDetails>() {
@Override
public void execute(InputFileDetails removed) {
removedFiles.add(removed.getFile());
}
});
Set<File> allSourceFiles = getSource().getFiles();
if (!allSourceFiles.containsAll(changedFiles)) {
// If a non-source file changed, the compilation cannot be incremental
// due to the way the Swift compiler detects changes from other modules
isIncremental = false;
}
}
BuildOperationLogger operationLogger = getServices().get(BuildOperationLoggerFactory.class).newOperationLogger(getName(), getTemporaryDir());
NativePlatformInternal targetPlatform = Cast.cast(NativePlatformInternal.class, this.targetPlatform.get());
SwiftCompileSpec spec = createSpec(operationLogger, isIncremental, changedFiles, removedFiles, targetPlatform);
Compiler<SwiftCompileSpec> baseCompiler = new IncrementalSwiftCompiler(createCompiler(), getOutputs(), compilerOutputFileNamingSchemeFactory);
Compiler<SwiftCompileSpec> loggingCompiler = BuildOperationLoggingCompilerDecorator.wrap(baseCompiler);
WorkResult result = loggingCompiler.execute(spec);
setDidWork(result.getDidWork());
}
Aggregations