Search in sources :

Example 1 with LinkerSpec

use of org.gradle.nativeplatform.internal.LinkerSpec in project gradle by gradle.

the class LinkExeLinker method execute.

@Override
public WorkResult execute(final LinkerSpec spec) {
    LinkerSpec transformedSpec = specTransformer.transform(spec);
    List<String> args = argsTransformer.transform(transformedSpec);
    invocationContext.getArgAction().execute(args);
    new VisualCppOptionsFileArgsWriter(spec.getTempDir()).execute(args);
    final CommandLineToolInvocation invocation = invocationContext.createInvocation("linking " + spec.getOutputFile().getName(), args, spec.getOperationLogger());
    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {

        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });
    return new SimpleWorkResult(true);
}
Also used : SharedLibraryLinkerSpec(org.gradle.nativeplatform.internal.SharedLibraryLinkerSpec) LinkerSpec(org.gradle.nativeplatform.internal.LinkerSpec) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) SimpleWorkResult(org.gradle.api.internal.tasks.SimpleWorkResult)

Example 2 with LinkerSpec

use of org.gradle.nativeplatform.internal.LinkerSpec in project gradle by gradle.

the class AbstractLinkTask method createCompiler.

@SuppressWarnings("unchecked")
private Compiler<LinkerSpec> createCompiler() {
    NativePlatformInternal targetPlatform = Cast.cast(NativePlatformInternal.class, this.targetPlatform.get());
    NativeToolChainInternal toolChain = Cast.cast(NativeToolChainInternal.class, getToolChain().get());
    PlatformToolProvider toolProvider = toolChain.select(targetPlatform);
    Class<LinkerSpec> linkerSpecType = (Class<LinkerSpec>) createLinkerSpec().getClass();
    return toolProvider.newCompiler(linkerSpecType);
}
Also used : LinkerSpec(org.gradle.nativeplatform.internal.LinkerSpec) NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal)

Example 3 with LinkerSpec

use of org.gradle.nativeplatform.internal.LinkerSpec in project gradle by gradle.

the class AbstractLinkTask method link.

@TaskAction
public void link() {
    SimpleStaleClassCleaner cleaner = new SimpleStaleClassCleaner(getOutputs());
    cleaner.setDestinationDir(getDestinationDirectory().get().getAsFile());
    cleaner.execute();
    if (getSource().isEmpty()) {
        setDidWork(cleaner.getDidWork());
        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());
}
Also used : LinkerSpec(org.gradle.nativeplatform.internal.LinkerSpec) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) WorkResult(org.gradle.api.tasks.WorkResult) SimpleStaleClassCleaner(org.gradle.language.base.internal.tasks.SimpleStaleClassCleaner) TaskAction(org.gradle.api.tasks.TaskAction)

Example 4 with LinkerSpec

use of org.gradle.nativeplatform.internal.LinkerSpec in project gradle by gradle.

the class LinkSharedLibrary method createLinkerSpec.

@Override
protected LinkerSpec createLinkerSpec() {
    Spec spec = new Spec();
    spec.setInstallName(getInstallName());
    spec.setImportLibrary(importLibrary.getAsFile().getOrNull());
    return spec;
}
Also used : SharedLibraryLinkerSpec(org.gradle.nativeplatform.internal.SharedLibraryLinkerSpec) DefaultLinkerSpec(org.gradle.nativeplatform.internal.DefaultLinkerSpec) LinkerSpec(org.gradle.nativeplatform.internal.LinkerSpec)

Aggregations

LinkerSpec (org.gradle.nativeplatform.internal.LinkerSpec)4 SharedLibraryLinkerSpec (org.gradle.nativeplatform.internal.SharedLibraryLinkerSpec)2 SimpleWorkResult (org.gradle.api.internal.tasks.SimpleWorkResult)1 TaskAction (org.gradle.api.tasks.TaskAction)1 WorkResult (org.gradle.api.tasks.WorkResult)1 BuildOperationQueue (org.gradle.internal.operations.BuildOperationQueue)1 BuildOperationLogger (org.gradle.internal.operations.logging.BuildOperationLogger)1 SimpleStaleClassCleaner (org.gradle.language.base.internal.tasks.SimpleStaleClassCleaner)1 DefaultLinkerSpec (org.gradle.nativeplatform.internal.DefaultLinkerSpec)1 NativePlatformInternal (org.gradle.nativeplatform.platform.internal.NativePlatformInternal)1 NativeToolChainInternal (org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal)1 PlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)1