Search in sources :

Example 6 with BuildOperationLogger

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

the class ExtractSymbols method extractSymbols.

// TODO: Need to track version/implementation of symbol extraction tool.
@TaskAction
protected 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());
}
Also used : DefaultSymbolExtractorSpec(org.gradle.nativeplatform.internal.DefaultSymbolExtractorSpec) BuildOperationLoggerFactory(org.gradle.internal.operations.logging.BuildOperationLoggerFactory) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) WorkResult(org.gradle.api.tasks.WorkResult) DefaultSymbolExtractorSpec(org.gradle.nativeplatform.internal.DefaultSymbolExtractorSpec) SymbolExtractorSpec(org.gradle.nativeplatform.internal.SymbolExtractorSpec) TaskAction(org.gradle.api.tasks.TaskAction)

Example 7 with BuildOperationLogger

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

the class Assemble method assemble.

@TaskAction
public void assemble() {
    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    boolean cleanedOutputs = StaleOutputCleaner.cleanOutputs(getDeleter(), getOutputs().getPreviousOutputFiles(), getObjectFileDir());
    DefaultAssembleSpec spec = new DefaultAssembleSpec();
    spec.setTempDir(getTemporaryDir());
    spec.setObjectFileDir(getObjectFileDir());
    spec.source(getSource());
    spec.include(getIncludes());
    spec.args(getAssemblerArgs());
    spec.setOperationLogger(operationLogger);
    NativeToolChainInternal nativeToolChain = (NativeToolChainInternal) toolChain.get();
    NativePlatformInternal nativePlatform = (NativePlatformInternal) targetPlatform.get();
    Compiler<AssembleSpec> compiler = nativeToolChain.select(nativePlatform).newCompiler(AssembleSpec.class);
    WorkResult result = BuildOperationLoggingCompilerDecorator.wrap(compiler).execute(spec);
    setDidWork(result.getDidWork() || cleanedOutputs);
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) AssembleSpec(org.gradle.nativeplatform.toolchain.internal.compilespec.AssembleSpec) DefaultAssembleSpec(org.gradle.language.assembler.internal.DefaultAssembleSpec) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal) DefaultAssembleSpec(org.gradle.language.assembler.internal.DefaultAssembleSpec) WorkResult(org.gradle.api.tasks.WorkResult) TaskAction(org.gradle.api.tasks.TaskAction)

Example 8 with BuildOperationLogger

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

Example 9 with BuildOperationLogger

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

the class StripSymbols method stripSymbols.

// TODO: Need to track version/implementation of symbol strip tool.
@TaskAction
protected void stripSymbols() {
    BuildOperationLogger operationLogger = getServices().get(BuildOperationLoggerFactory.class).newOperationLogger(getName(), getTemporaryDir());
    StripperSpec spec = new DefaultStripperSpec();
    spec.setBinaryFile(binaryFile.get().getAsFile());
    spec.setOutputFile(outputFile.get().getAsFile());
    spec.setOperationLogger(operationLogger);
    Compiler<StripperSpec> symbolStripper = createCompiler();
    symbolStripper = BuildOperationLoggingCompilerDecorator.wrap(symbolStripper);
    WorkResult result = symbolStripper.execute(spec);
    setDidWork(result.getDidWork());
}
Also used : BuildOperationLoggerFactory(org.gradle.internal.operations.logging.BuildOperationLoggerFactory) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) StripperSpec(org.gradle.nativeplatform.internal.StripperSpec) DefaultStripperSpec(org.gradle.nativeplatform.internal.DefaultStripperSpec) WorkResult(org.gradle.api.tasks.WorkResult) DefaultStripperSpec(org.gradle.nativeplatform.internal.DefaultStripperSpec) TaskAction(org.gradle.api.tasks.TaskAction)

Example 10 with BuildOperationLogger

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

the class CreateStaticLibrary method link.

// TODO: Need to track version/implementation of ar tool.
@TaskAction
protected void link() {
    StaticLibraryArchiverSpec spec = new DefaultStaticLibraryArchiverSpec();
    spec.setTempDir(getTemporaryDir());
    spec.setOutputFile(getOutputFile().get().getAsFile());
    spec.objectFiles(getSource());
    spec.args(getStaticLibArgs().get());
    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    spec.setOperationLogger(operationLogger);
    Compiler<StaticLibraryArchiverSpec> compiler = createCompiler();
    WorkResult result = BuildOperationLoggingCompilerDecorator.wrap(compiler).execute(spec);
    setDidWork(result.getDidWork());
}
Also used : DefaultStaticLibraryArchiverSpec(org.gradle.nativeplatform.internal.DefaultStaticLibraryArchiverSpec) StaticLibraryArchiverSpec(org.gradle.nativeplatform.internal.StaticLibraryArchiverSpec) DefaultStaticLibraryArchiverSpec(org.gradle.nativeplatform.internal.DefaultStaticLibraryArchiverSpec) 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