Search in sources :

Example 1 with UnsupportedPlatformToolProvider

use of org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider in project gradle by gradle.

the class AbstractGccCompatibleToolChain method createPlatformToolProvider.

private PlatformToolProvider createPlatformToolProvider(NativePlatformInternal targetPlatform) {
    TargetPlatformConfiguration targetPlatformConfigurationConfiguration = getPlatformConfiguration(targetPlatform);
    if (targetPlatformConfigurationConfiguration == null) {
        return new UnsupportedPlatformToolProvider(targetPlatform.getOperatingSystem(), String.format("Don't know how to build for %s.", targetPlatform.getDisplayName()));
    }
    DefaultGccPlatformToolChain configurableToolChain = instantiator.newInstance(DefaultGccPlatformToolChain.class, targetPlatform);
    addDefaultTools(configurableToolChain);
    configureDefaultTools(configurableToolChain);
    targetPlatformConfigurationConfiguration.apply(configurableToolChain);
    configureActions.execute(configurableToolChain);
    configurableToolChain.compilerProbeArgs(standardLibraryDiscovery.compilerProbeArgs(targetPlatform));
    ToolChainAvailability result = new ToolChainAvailability();
    initTools(configurableToolChain, result);
    if (!result.isAvailable()) {
        return new UnavailablePlatformToolProvider(targetPlatform.getOperatingSystem(), result);
    }
    return new GccPlatformToolProvider(buildOperationExecutor, targetPlatform.getOperatingSystem(), toolSearchPath, configurableToolChain, execActionFactory, compilerOutputFileNamingSchemeFactory, configurableToolChain.isCanUseCommandFile(), workerLeaseService, new CompilerMetaDataProviderWithDefaultArgs(configurableToolChain.getCompilerProbeArgs(), metaDataProvider));
}
Also used : UnavailablePlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnavailablePlatformToolProvider) ToolChainAvailability(org.gradle.platform.base.internal.toolchain.ToolChainAvailability) UnsupportedPlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider)

Example 2 with UnsupportedPlatformToolProvider

use of org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider in project gradle by gradle.

the class VisualCppToolChain method select.

@Override
public PlatformToolProvider select(NativePlatformInternal targetPlatform) {
    ToolChainAvailability result = new ToolChainAvailability();
    result.mustBeAvailable(getAvailability());
    if (!result.isAvailable()) {
        return new UnavailablePlatformToolProvider(targetPlatform.getOperatingSystem(), result);
    }
    VisualCpp platformVisualCpp = visualCpp == null ? null : visualCpp.forPlatform(targetPlatform);
    if (platformVisualCpp == null) {
        return new UnsupportedPlatformToolProvider(targetPlatform.getOperatingSystem(), String.format("Don't know how to build for %s.", targetPlatform.getDisplayName()));
    }
    WindowsSdk platformSdk = windowsSdk.forPlatform(targetPlatform);
    SystemLibraries cRuntime = ucrt == null ? new EmptySystemLibraries() : ucrt.getCRuntime(targetPlatform);
    DefaultVisualCppPlatformToolChain configurableToolChain = instantiator.newInstance(DefaultVisualCppPlatformToolChain.class, targetPlatform, instantiator);
    configureActions.execute(configurableToolChain);
    return new VisualCppPlatformToolProvider(buildOperationExecutor, targetPlatform.getOperatingSystem(), configurableToolChain.tools, visualStudio, platformVisualCpp, platformSdk, cRuntime, execActionFactory, compilerOutputFileNamingSchemeFactory, workerLeaseService);
}
Also used : EmptySystemLibraries(org.gradle.nativeplatform.toolchain.internal.EmptySystemLibraries) UnavailablePlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnavailablePlatformToolProvider) ToolChainAvailability(org.gradle.platform.base.internal.toolchain.ToolChainAvailability) EmptySystemLibraries(org.gradle.nativeplatform.toolchain.internal.EmptySystemLibraries) SystemLibraries(org.gradle.nativeplatform.toolchain.internal.SystemLibraries) UnsupportedPlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider)

Example 3 with UnsupportedPlatformToolProvider

use of org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider in project gradle by gradle.

the class VisualCppToolChain method select.

@Override
public PlatformToolProvider select(NativeLanguage sourceLanguage, NativePlatformInternal targetMachine) {
    switch(sourceLanguage) {
        case CPP:
            PlatformToolProvider toolProvider = select(targetMachine);
            if (!toolProvider.isAvailable()) {
                return toolProvider;
            }
            ToolSearchResult cppCompiler = toolProvider.locateTool(ToolType.CPP_COMPILER);
            if (!cppCompiler.isAvailable()) {
                return new UnavailablePlatformToolProvider(targetMachine.getOperatingSystem(), cppCompiler);
            }
            return toolProvider;
        case ANY:
            return select(targetMachine);
        default:
            return new UnsupportedPlatformToolProvider(targetMachine.getOperatingSystem(), String.format("Don't know how to compile language %s.", sourceLanguage));
    }
}
Also used : UnavailablePlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnavailablePlatformToolProvider) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) UnavailablePlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnavailablePlatformToolProvider) UnsupportedPlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider) ToolSearchResult(org.gradle.platform.base.internal.toolchain.ToolSearchResult) UnsupportedPlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider)

Example 4 with UnsupportedPlatformToolProvider

use of org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider in project gradle by gradle.

the class SwiftcToolChain method createPlatformToolProvider.

private PlatformToolProvider createPlatformToolProvider(NativePlatformInternal targetPlatform) {
    DefaultSwiftcPlatformToolChain configurableToolChain = instantiator.newInstance(DefaultSwiftcPlatformToolChain.class, targetPlatform);
    addDefaultTools(configurableToolChain);
    configureActions.execute(configurableToolChain);
    // TODO: this is an approximation as we know swift currently supports only 64-bit runtimes - eventually, we'll want to query for this
    if (!isCurrentArchitecture(targetPlatform)) {
        return new UnsupportedPlatformToolProvider(targetPlatform.getOperatingSystem(), String.format("Don't know how to build for %s.", targetPlatform.getDisplayName()));
    }
    CommandLineToolSearchResult compiler = toolSearchPath.locate(ToolType.SWIFT_COMPILER, "swiftc");
    ToolChainAvailability result = new ToolChainAvailability();
    result.mustBeAvailable(compiler);
    if (!result.isAvailable()) {
        return new UnavailablePlatformToolProvider(targetPlatform.getOperatingSystem(), result);
    }
    SearchResult<SwiftcMetadata> swiftcMetaData = compilerMetaDataProvider.getCompilerMetaData(toolSearchPath.getPath(), spec -> spec.executable(compiler.getTool()));
    result.mustBeAvailable(swiftcMetaData);
    if (!result.isAvailable()) {
        return new UnavailablePlatformToolProvider(targetPlatform.getOperatingSystem(), result);
    }
    return new SwiftPlatformToolProvider(buildOperationExecutor, targetPlatform.getOperatingSystem(), toolSearchPath, configurableToolChain, execActionFactory, compilerOutputFileNamingSchemeFactory, workerLeaseService, swiftcMetaData.getComponent());
}
Also used : UnavailablePlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnavailablePlatformToolProvider) ToolChainAvailability(org.gradle.platform.base.internal.toolchain.ToolChainAvailability) CommandLineToolSearchResult(org.gradle.nativeplatform.toolchain.internal.tools.CommandLineToolSearchResult) SwiftcMetadata(org.gradle.nativeplatform.toolchain.internal.swift.metadata.SwiftcMetadata) UnsupportedPlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider)

Example 5 with UnsupportedPlatformToolProvider

use of org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider in project gradle by gradle.

the class AbstractGccCompatibleToolChain method select.

@Override
public PlatformToolProvider select(NativeLanguage sourceLanguage, NativePlatformInternal targetMachine) {
    PlatformToolProvider toolProvider = getProviderForPlatform(targetMachine);
    switch(sourceLanguage) {
        case CPP:
            if (toolProvider instanceof UnsupportedPlatformToolProvider) {
                return toolProvider;
            }
            ToolSearchResult cppCompiler = toolProvider.locateTool(ToolType.CPP_COMPILER);
            if (cppCompiler.isAvailable()) {
                return toolProvider;
            }
            // No C++ compiler, complain about it
            return new UnavailablePlatformToolProvider(targetMachine.getOperatingSystem(), cppCompiler);
        case ANY:
            if (toolProvider instanceof UnsupportedPlatformToolProvider) {
                return toolProvider;
            }
            ToolSearchResult cCompiler = toolProvider.locateTool(ToolType.C_COMPILER);
            if (cCompiler.isAvailable()) {
                return toolProvider;
            }
            ToolSearchResult compiler = toolProvider.locateTool(ToolType.CPP_COMPILER);
            if (compiler.isAvailable()) {
                return toolProvider;
            }
            compiler = toolProvider.locateTool(ToolType.OBJECTIVEC_COMPILER);
            if (compiler.isAvailable()) {
                return toolProvider;
            }
            compiler = toolProvider.locateTool(ToolType.OBJECTIVECPP_COMPILER);
            if (compiler.isAvailable()) {
                return toolProvider;
            }
            // No compilers available, complain about the missing C compiler
            return new UnavailablePlatformToolProvider(targetMachine.getOperatingSystem(), cCompiler);
        default:
            return new UnsupportedPlatformToolProvider(targetMachine.getOperatingSystem(), String.format("Don't know how to compile language %s.", sourceLanguage));
    }
}
Also used : UnavailablePlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnavailablePlatformToolProvider) UnavailablePlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnavailablePlatformToolProvider) UnsupportedPlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) ToolSearchResult(org.gradle.platform.base.internal.toolchain.ToolSearchResult) CommandLineToolSearchResult(org.gradle.nativeplatform.toolchain.internal.tools.CommandLineToolSearchResult) UnsupportedPlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider)

Aggregations

UnavailablePlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.UnavailablePlatformToolProvider)5 UnsupportedPlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider)5 ToolChainAvailability (org.gradle.platform.base.internal.toolchain.ToolChainAvailability)3 PlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)2 CommandLineToolSearchResult (org.gradle.nativeplatform.toolchain.internal.tools.CommandLineToolSearchResult)2 ToolSearchResult (org.gradle.platform.base.internal.toolchain.ToolSearchResult)2 EmptySystemLibraries (org.gradle.nativeplatform.toolchain.internal.EmptySystemLibraries)1 SystemLibraries (org.gradle.nativeplatform.toolchain.internal.SystemLibraries)1 SwiftcMetadata (org.gradle.nativeplatform.toolchain.internal.swift.metadata.SwiftcMetadata)1