Search in sources :

Example 1 with ToolSearchResult

use of org.gradle.platform.base.internal.toolchain.ToolSearchResult 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 2 with ToolSearchResult

use of org.gradle.platform.base.internal.toolchain.ToolSearchResult 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

PlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)2 UnavailablePlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.UnavailablePlatformToolProvider)2 UnsupportedPlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.UnsupportedPlatformToolProvider)2 ToolSearchResult (org.gradle.platform.base.internal.toolchain.ToolSearchResult)2 CommandLineToolSearchResult (org.gradle.nativeplatform.toolchain.internal.tools.CommandLineToolSearchResult)1