use of org.gradle.nativeplatform.toolchain.internal.NativeLanguage in project gradle by gradle.
the class DefaultToolChainSelector method select.
@Override
public <T extends NativePlatform> Result<T> select(Class<T> platformType) {
DefaultNativePlatform targetMachine = host;
// TODO - push all this stuff down to the tool chain and let it create the specific platform and provider
NativeLanguage sourceLanguage = platformType == SwiftPlatform.class ? NativeLanguage.SWIFT : NativeLanguage.CPP;
NativeToolChainRegistryInternal registry = modelRegistry.realize("toolChains", NativeToolChainRegistryInternal.class);
NativeToolChainInternal toolChain = registry.getForPlatform(sourceLanguage, targetMachine);
// TODO - don't select again here, as the selection is already performed to select the toolchain
PlatformToolProvider toolProvider = toolChain.select(sourceLanguage, targetMachine);
if (!toolProvider.isAvailable() && targetMachine.getOperatingSystem().isWindows() && targetMachine.getArchitecture().isAmd64()) {
// Try building x86 on Windows. Don't do this for other operating systems (yet)
DefaultNativePlatform x86platformRequest = targetMachine.withArchitecture(Architectures.of(Architectures.X86));
NativeToolChainInternal x86ToolChain = registry.getForPlatform(sourceLanguage, x86platformRequest);
// TODO - don't select again here, as the selection is already performed to select the toolchain
PlatformToolProvider x86ToolProvider = x86ToolChain.select(sourceLanguage, x86platformRequest);
if (x86ToolProvider.isAvailable()) {
targetMachine = x86platformRequest;
toolChain = x86ToolChain;
toolProvider = x86ToolProvider;
}
}
// TODO - use a better name for the platforms, rather than "current"
T targetPlatform = null;
if (CppPlatform.class.isAssignableFrom(platformType)) {
targetPlatform = platformType.cast(new DefaultCppPlatform("host", targetMachine));
} else if (SwiftPlatform.class.isAssignableFrom(platformType)) {
targetPlatform = platformType.cast(new DefaultSwiftPlatform("host", targetMachine));
}
return new DefaultResult<T>(toolChain, toolProvider, targetPlatform);
}
use of org.gradle.nativeplatform.toolchain.internal.NativeLanguage in project gradle by gradle.
the class DefaultToolChainSelector method select.
public Result<SwiftPlatform> select(SwiftPlatform requestPlatform) {
DefaultNativePlatform targetNativePlatform = newNativePlatform(requestPlatform.getTargetMachine());
// TODO - push all this stuff down to the tool chain and let it create the specific platform and provider
NativeLanguage sourceLanguage = NativeLanguage.SWIFT;
NativeToolChainInternal toolChain = getToolChain(sourceLanguage, targetNativePlatform);
// TODO - don't select again here, as the selection is already performed to select the toolchain
PlatformToolProvider toolProvider = toolChain.select(sourceLanguage, targetNativePlatform);
SwiftVersion sourceCompatibility = requestPlatform.getSourceCompatibility();
if (sourceCompatibility == null && toolProvider.isAvailable()) {
sourceCompatibility = toSwiftVersion(toolProvider.getCompilerMetadata(ToolType.SWIFT_COMPILER).getVersion());
}
SwiftPlatform targetPlatform = new DefaultSwiftPlatform(requestPlatform.getTargetMachine(), sourceCompatibility, targetNativePlatform);
return new DefaultResult<SwiftPlatform>(toolChain, toolProvider, targetPlatform);
}
use of org.gradle.nativeplatform.toolchain.internal.NativeLanguage in project gradle by gradle.
the class DefaultToolChainSelector method select.
public Result<CppPlatform> select(CppPlatform requestPlatform) {
DefaultNativePlatform targetNativePlatform = newNativePlatform(requestPlatform.getTargetMachine());
// TODO - push all this stuff down to the tool chain and let it create the specific platform and provider
NativeLanguage sourceLanguage = NativeLanguage.CPP;
NativeToolChainInternal toolChain = getToolChain(sourceLanguage, targetNativePlatform);
// TODO - don't select again here, as the selection is already performed to select the toolchain
PlatformToolProvider toolProvider = toolChain.select(sourceLanguage, targetNativePlatform);
CppPlatform targetPlatform = new DefaultCppPlatform(requestPlatform.getTargetMachine(), targetNativePlatform);
return new DefaultResult<CppPlatform>(toolChain, toolProvider, targetPlatform);
}
Aggregations