Search in sources :

Example 1 with WorkResult

use of org.gradle.api.tasks.WorkResult in project gradle by gradle.

the class IncrementalResultStoringDecorator method execute.

@Override
public WorkResult execute(JavaCompileSpec spec) {
    WorkResult out = delegate.execute(spec);
    updater.updateAnalysis(spec, out);
    writer.storeJarSnapshots(spec.getCompileClasspath());
    annotationProcessorPathStore.put(spec.getAnnotationProcessorPath());
    return out;
}
Also used : WorkResult(org.gradle.api.tasks.WorkResult)

Example 2 with WorkResult

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());
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) DefaultWindowsResourceCompileSpec(org.gradle.language.rc.internal.DefaultWindowsResourceCompileSpec) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) NativeCompileSpec(org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal) WorkResult(org.gradle.api.tasks.WorkResult) TaskAction(org.gradle.api.tasks.TaskAction)

Example 3 with WorkResult

use of org.gradle.api.tasks.WorkResult in project gradle by gradle.

the class SyncCopyActionDecorator method execute.

@Override
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<>();
    WorkResult didWork = delegate.execute(action -> stream.process(details -> {
        visited.add(details.getRelativePath());
        action.processFile(details);
    }));
    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited, preserveSpec, deleter);
    MinimalFileTree walker = directoryFileTreeFactory.create(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();
    return WorkResults.didWork(didWork.getDidWork() || fileVisitor.didWork);
}
Also used : PatternFilterable(org.gradle.api.tasks.util.PatternFilterable) FileVisitDetails(org.gradle.api.file.FileVisitDetails) PatternSet(org.gradle.api.tasks.util.PatternSet) Set(java.util.Set) IOException(java.io.IOException) WorkResult(org.gradle.api.tasks.WorkResult) File(java.io.File) WorkResults(org.gradle.api.tasks.WorkResults) UncheckedIOException(java.io.UncheckedIOException) HashSet(java.util.HashSet) Deleter(org.gradle.internal.file.Deleter) RelativePath(org.gradle.api.file.RelativePath) Spec(org.gradle.api.specs.Spec) DirectoryFileTreeFactory(org.gradle.api.internal.file.collections.DirectoryFileTreeFactory) FileTreeElement(org.gradle.api.file.FileTreeElement) MinimalFileTree(org.gradle.api.internal.file.collections.MinimalFileTree) FileVisitor(org.gradle.api.file.FileVisitor) Nullable(javax.annotation.Nullable) RelativePath(org.gradle.api.file.RelativePath) WorkResult(org.gradle.api.tasks.WorkResult) MinimalFileTree(org.gradle.api.internal.file.collections.MinimalFileTree) HashSet(java.util.HashSet)

Example 4 with WorkResult

use of org.gradle.api.tasks.WorkResult in project gradle by gradle.

the class WindowsResourceCompile method compile.

@TaskAction
public void compile(InputChanges 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().get());
    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());
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) DefaultWindowsResourceCompileSpec(org.gradle.language.rc.internal.DefaultWindowsResourceCompileSpec) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) NativeCompileSpec(org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal) WorkResult(org.gradle.api.tasks.WorkResult) TaskAction(org.gradle.api.tasks.TaskAction)

Example 5 with WorkResult

use of org.gradle.api.tasks.WorkResult in project gradle by gradle.

the class IncrementalNativeCompiler method doCleanIncrementalCompile.

protected WorkResult doCleanIncrementalCompile(T spec) {
    boolean deleted = cleanPreviousOutputs(spec);
    spec.setSourceFilesForPch(getSourceFilesForPch(spec));
    WorkResult compileResult = delegateCompiler.execute(spec);
    if (deleted && !compileResult.getDidWork()) {
        return WorkResults.didWork(true);
    }
    return compileResult;
}
Also used : WorkResult(org.gradle.api.tasks.WorkResult)

Aggregations

WorkResult (org.gradle.api.tasks.WorkResult)25 TaskAction (org.gradle.api.tasks.TaskAction)11 BuildOperationLogger (org.gradle.internal.operations.logging.BuildOperationLogger)9 File (java.io.File)8 BuildOperationLoggerFactory (org.gradle.internal.operations.logging.BuildOperationLoggerFactory)4 NativePlatformInternal (org.gradle.nativeplatform.platform.internal.NativePlatformInternal)4 NativeToolChainInternal (org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal)3 HashMap (java.util.HashMap)2 DefaultGroovyJavaJointCompileSpec (org.gradle.api.internal.tasks.compile.DefaultGroovyJavaJointCompileSpec)2 OutputFile (org.gradle.api.tasks.OutputFile)2 WorkResults (org.gradle.api.tasks.WorkResults)2 PatternFilterable (org.gradle.api.tasks.util.PatternFilterable)2 PatternSet (org.gradle.api.tasks.util.PatternSet)2 Timer (org.gradle.internal.time.Timer)2 DefaultWindowsResourceCompileSpec (org.gradle.language.rc.internal.DefaultWindowsResourceCompileSpec)2 NativeCompileSpec (org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec)2 PlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)2 Iterables (com.google.common.collect.Iterables)1 GroovyClassLoader (groovy.lang.GroovyClassLoader)1 IOException (java.io.IOException)1