Search in sources :

Example 11 with PlatformToolProvider

use of org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider 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);
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) NativeLanguage(org.gradle.nativeplatform.toolchain.internal.NativeLanguage) DefaultSwiftPlatform(org.gradle.language.swift.internal.DefaultSwiftPlatform) SwiftVersion(org.gradle.language.swift.SwiftVersion) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) DefaultNativePlatform(org.gradle.nativeplatform.platform.internal.DefaultNativePlatform) SwiftPlatform(org.gradle.language.swift.SwiftPlatform) DefaultSwiftPlatform(org.gradle.language.swift.internal.DefaultSwiftPlatform)

Example 12 with PlatformToolProvider

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

the class NativeBinaryRules method assignToolsToNativeBinary.

private static void assignToolsToNativeBinary(NativeBinarySpecInternal nativeBinary, NativeBinarySpec nativeBinarySpec, NativeToolChainRegistryInternal toolChains) {
    NativeToolChainInternal toolChain = toolChainFor(nativeBinarySpec, toolChains);
    PlatformToolProvider toolProvider = toolChain.select((NativePlatformInternal) nativeBinarySpec.getTargetPlatform());
    nativeBinary.setToolChain(toolChain);
    nativeBinary.setPlatformToolProvider(toolProvider);
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)

Example 13 with PlatformToolProvider

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

the class SwiftCompile method createCompiler.

private Compiler<SwiftCompileSpec> 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(SwiftCompileSpec.class);
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal)

Example 14 with PlatformToolProvider

use of org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider 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);
}
Also used : LinkerSpec(org.gradle.nativeplatform.internal.LinkerSpec) NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal)

Example 15 with PlatformToolProvider

use of org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider 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);
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal)

Aggregations

PlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)29 NativeToolChainInternal (org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal)20 NativePlatformInternal (org.gradle.nativeplatform.platform.internal.NativePlatformInternal)10 File (java.io.File)7 Project (org.gradle.api.Project)7 Names (org.gradle.language.nativeplatform.internal.Names)6 Callable (java.util.concurrent.Callable)5 RegularFile (org.gradle.api.file.RegularFile)5 TaskContainer (org.gradle.api.tasks.TaskContainer)5 DefaultNativePlatform (org.gradle.nativeplatform.platform.internal.DefaultNativePlatform)5 NativeToolChain (org.gradle.nativeplatform.toolchain.NativeToolChain)5 Inject (javax.inject.Inject)4 Plugin (org.gradle.api.Plugin)4 FileCollection (org.gradle.api.file.FileCollection)4 ObjectFactory (org.gradle.api.model.ObjectFactory)4 Provider (org.gradle.api.provider.Provider)4 TaskProvider (org.gradle.api.tasks.TaskProvider)4 LifecycleBasePlugin (org.gradle.language.base.plugins.LifecycleBasePlugin)4 TargetMachine (org.gradle.nativeplatform.TargetMachine)4 TargetMachineFactory (org.gradle.nativeplatform.TargetMachineFactory)4