use of org.gradle.nativeplatform.platform.internal.NativePlatformInternal 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.platform.internal.NativePlatformInternal in project gradle by gradle.
the class CreateStaticLibrary method createCompiler.
private Compiler<StaticLibraryArchiverSpec> createCompiler() {
NativePlatformInternal targetPlatform = Cast.cast(NativePlatformInternal.class, this.targetPlatform.get());
NativeToolChainInternal toolChain = Cast.cast(NativeToolChainInternal.class, getToolChain().get());
PlatformToolProvider toolProvider = toolChain.select(targetPlatform);
return toolProvider.newCompiler(StaticLibraryArchiverSpec.class);
}
use of org.gradle.nativeplatform.platform.internal.NativePlatformInternal in project gradle by gradle.
the class ExtractSymbols method createCompiler.
private Compiler<SymbolExtractorSpec> createCompiler() {
NativePlatformInternal targetPlatform = Cast.cast(NativePlatformInternal.class, this.targetPlatform.get());
NativeToolChainInternal toolChain = Cast.cast(NativeToolChainInternal.class, getToolChain().get());
PlatformToolProvider toolProvider = toolChain.select(targetPlatform);
return toolProvider.newCompiler(SymbolExtractorSpec.class);
}
use of org.gradle.nativeplatform.platform.internal.NativePlatformInternal in project gradle by gradle.
the class AbstractNativeSourceCompileTask method getCompilerVersion.
/**
* The compiler used, including the type and the version.
*
* @since 4.4
*/
@Nullable
@Optional
@Nested
protected CompilerVersion getCompilerVersion() {
NativeToolChainInternal toolChain = (NativeToolChainInternal) getToolChain().get();
NativePlatformInternal targetPlatform = (NativePlatformInternal) getTargetPlatform().get();
PlatformToolProvider toolProvider = toolChain.select(targetPlatform);
Compiler<? extends NativeCompileSpec> compiler = toolProvider.newCompiler(createCompileSpec().getClass());
if (!(compiler instanceof VersionAwareCompiler)) {
return null;
}
return ((VersionAwareCompiler) compiler).getVersion();
}
use of org.gradle.nativeplatform.platform.internal.NativePlatformInternal 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());
}
Aggregations