use of org.gradle.nativeplatform.toolchain.internal.NativeToolChainRegistryInternal 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.NativeToolChainRegistryInternal in project gradle by gradle.
the class DefaultToolChainSelector method getToolChain.
private NativeToolChainInternal getToolChain(NativeLanguage sourceLanguage, NativePlatformInternal targetNativePlatform) {
NativeToolChainRegistryInternal registry = modelRegistry.realize("toolChains", NativeToolChainRegistryInternal.class);
NativeToolChainInternal toolChain = registry.getForPlatform(sourceLanguage, targetNativePlatform);
toolChain.assertSupported();
return toolChain;
}
Aggregations