Search in sources :

Example 1 with BuildOperationLogger

use of org.gradle.internal.operations.logging.BuildOperationLogger in project gradle by gradle.

the class AbstractNativeCompileTask method compile.

@TaskAction
public void compile(IncrementalTaskInputs inputs) {
    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    NativeCompileSpec spec = createCompileSpec();
    spec.setTargetPlatform(targetPlatform.get());
    spec.setTempDir(getTemporaryDir());
    spec.setObjectFileDir(objectFileDir.get().getAsFile());
    spec.include(includes);
    spec.source(getSource());
    spec.setMacros(getMacros());
    spec.args(getCompilerArgs().get());
    spec.setPositionIndependentCode(isPositionIndependentCode());
    spec.setDebuggable(isDebuggable());
    spec.setOptimized(isOptimized());
    spec.setIncrementalCompile(inputs.isIncremental());
    spec.setOperationLogger(operationLogger);
    configureSpec(spec);
    NativeToolChainInternal nativeToolChain = (NativeToolChainInternal) toolChain.get();
    NativePlatformInternal nativePlatform = (NativePlatformInternal) targetPlatform.get();
    PlatformToolProvider platformToolProvider = nativeToolChain.select(nativePlatform);
    setDidWork(doCompile(spec, platformToolProvider).getDidWork());
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) NativeCompileSpec(org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal) TaskAction(org.gradle.api.tasks.TaskAction)

Example 2 with BuildOperationLogger

use of org.gradle.internal.operations.logging.BuildOperationLogger 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 BuildOperationLogger

use of org.gradle.internal.operations.logging.BuildOperationLogger 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 4 with BuildOperationLogger

use of org.gradle.internal.operations.logging.BuildOperationLogger in project gradle by gradle.

the class SwiftCompile method compile.

@TaskAction
protected void compile(InputChanges inputs) {
    final List<File> removedFiles = Lists.newArrayList();
    final Set<File> changedFiles = Sets.newHashSet();
    boolean isIncremental = inputs.isIncremental();
    // which files changed .
    if (isIncremental) {
        for (FileChange fileChange : inputs.getFileChanges(getSource())) {
            if (fileChange.getChangeType() == ChangeType.REMOVED) {
                removedFiles.add(fileChange.getFile());
            } else {
                changedFiles.add(fileChange.getFile());
            }
        }
    }
    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, deleter);
    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) DefaultSwiftCompileSpec(org.gradle.language.swift.tasks.internal.DefaultSwiftCompileSpec) SwiftCompileSpec(org.gradle.nativeplatform.toolchain.internal.compilespec.SwiftCompileSpec) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal) FileChange(org.gradle.work.FileChange) IncrementalSwiftCompiler(org.gradle.nativeplatform.toolchain.internal.swift.IncrementalSwiftCompiler) WorkResult(org.gradle.api.tasks.WorkResult) OutputFile(org.gradle.api.tasks.OutputFile) File(java.io.File) TaskAction(org.gradle.api.tasks.TaskAction)

Example 5 with BuildOperationLogger

use of org.gradle.internal.operations.logging.BuildOperationLogger in project gradle by gradle.

the class AbstractLinkTask method link.

@TaskAction
protected void link() {
    boolean cleanedOutputs = StaleOutputCleaner.cleanOutputs(getDeleter(), getOutputs().getPreviousOutputFiles(), getDestinationDirectory().get().getAsFile());
    if (getSource().isEmpty()) {
        setDidWork(cleanedOutputs);
        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() || cleanedOutputs);
}
Also used : LinkerSpec(org.gradle.nativeplatform.internal.LinkerSpec) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) WorkResult(org.gradle.api.tasks.WorkResult) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

TaskAction (org.gradle.api.tasks.TaskAction)11 BuildOperationLogger (org.gradle.internal.operations.logging.BuildOperationLogger)11 WorkResult (org.gradle.api.tasks.WorkResult)9 NativePlatformInternal (org.gradle.nativeplatform.platform.internal.NativePlatformInternal)7 NativeToolChainInternal (org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal)5 BuildOperationLoggerFactory (org.gradle.internal.operations.logging.BuildOperationLoggerFactory)4 NativeCompileSpec (org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec)4 PlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)4 File (java.io.File)2 OutputFile (org.gradle.api.tasks.OutputFile)2 DefaultWindowsResourceCompileSpec (org.gradle.language.rc.internal.DefaultWindowsResourceCompileSpec)2 DefaultSwiftCompileSpec (org.gradle.language.swift.tasks.internal.DefaultSwiftCompileSpec)2 SwiftCompileSpec (org.gradle.nativeplatform.toolchain.internal.compilespec.SwiftCompileSpec)2 IncrementalSwiftCompiler (org.gradle.nativeplatform.toolchain.internal.swift.IncrementalSwiftCompiler)2 InputFileDetails (org.gradle.api.tasks.incremental.InputFileDetails)1 DefaultAssembleSpec (org.gradle.language.assembler.internal.DefaultAssembleSpec)1 DefaultStaticLibraryArchiverSpec (org.gradle.nativeplatform.internal.DefaultStaticLibraryArchiverSpec)1 DefaultStripperSpec (org.gradle.nativeplatform.internal.DefaultStripperSpec)1 DefaultSymbolExtractorSpec (org.gradle.nativeplatform.internal.DefaultSymbolExtractorSpec)1 LinkerSpec (org.gradle.nativeplatform.internal.LinkerSpec)1