Search in sources :

Example 11 with WorkResult

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());
}
Also used : DefaultGroovyJavaJointCompileSpec(org.gradle.api.internal.tasks.compile.DefaultGroovyJavaJointCompileSpec) WorkResult(org.gradle.api.tasks.WorkResult) TaskAction(org.gradle.api.tasks.TaskAction)

Example 12 with WorkResult

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;
}
Also used : WorkResult(org.gradle.api.tasks.WorkResult)

Example 13 with WorkResult

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;
        }
    };
}
Also used : FileTree(org.gradle.api.file.FileTree) WorkResult(org.gradle.api.tasks.WorkResult) PatternSet(org.gradle.api.tasks.util.PatternSet) PatternFilterable(org.gradle.api.tasks.util.PatternFilterable)

Example 14 with WorkResult

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;
}
Also used : WorkResult(org.gradle.api.tasks.WorkResult)

Example 15 with 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());
}
Also used : BuildOperationLoggerFactory(org.gradle.internal.operations.logging.BuildOperationLoggerFactory) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) InputFileDetails(org.gradle.api.tasks.incremental.InputFileDetails) DefaultSwiftCompileSpec(org.gradle.language.swift.tasks.internal.DefaultSwiftCompileSpec) SwiftCompileSpec(org.gradle.nativeplatform.toolchain.internal.compilespec.SwiftCompileSpec) IncrementalSwiftCompiler(org.gradle.nativeplatform.toolchain.internal.swift.IncrementalSwiftCompiler) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal) WorkResult(org.gradle.api.tasks.WorkResult) OutputFile(org.gradle.api.tasks.OutputFile) File(java.io.File) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

WorkResult (org.gradle.api.tasks.WorkResult)17 TaskAction (org.gradle.api.tasks.TaskAction)8 BuildOperationLogger (org.gradle.internal.operations.logging.BuildOperationLogger)7 BuildOperationLoggerFactory (org.gradle.internal.operations.logging.BuildOperationLoggerFactory)3 NativePlatformInternal (org.gradle.nativeplatform.platform.internal.NativePlatformInternal)3 RelativePath (org.gradle.api.file.RelativePath)2 CopyActionProcessingStreamAction (org.gradle.api.internal.file.CopyActionProcessingStreamAction)2 SimpleStaleClassCleaner (org.gradle.language.base.internal.tasks.SimpleStaleClassCleaner)2 NativeToolChainInternal (org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal)2 File (java.io.File)1 HashSet (java.util.HashSet)1 FileTree (org.gradle.api.file.FileTree)1 MinimalFileTree (org.gradle.api.internal.file.collections.MinimalFileTree)1 DefaultGroovyJavaJointCompileSpec (org.gradle.api.internal.tasks.compile.DefaultGroovyJavaJointCompileSpec)1 OutputFile (org.gradle.api.tasks.OutputFile)1 InputFileDetails (org.gradle.api.tasks.incremental.InputFileDetails)1 PatternFilterable (org.gradle.api.tasks.util.PatternFilterable)1 PatternSet (org.gradle.api.tasks.util.PatternSet)1 DefaultAssembleSpec (org.gradle.language.assembler.internal.DefaultAssembleSpec)1 DefaultWindowsResourceCompileSpec (org.gradle.language.rc.internal.DefaultWindowsResourceCompileSpec)1