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);
}
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);
}
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());
}
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;
}
Aggregations