Search in sources :

Example 6 with NativeToolChainInternal

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

the class WindowsResourceCompile method compile.

@TaskAction
public void compile(InputChanges inputs) {
    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    NativeCompileSpec spec = new DefaultWindowsResourceCompileSpec();
    spec.setTempDir(getTemporaryDir());
    spec.setObjectFileDir(getOutputDir());
    spec.include(getIncludes());
    spec.source(getSource());
    spec.setMacros(getMacros());
    spec.args(getCompilerArgs().get());
    spec.setIncrementalCompile(inputs.isIncremental());
    spec.setOperationLogger(operationLogger);
    NativeToolChainInternal nativeToolChain = (NativeToolChainInternal) toolChain.get();
    NativePlatformInternal nativePlatform = (NativePlatformInternal) targetPlatform.get();
    PlatformToolProvider platformToolProvider = nativeToolChain.select(nativePlatform);
    WorkResult result = doCompile(spec, platformToolProvider);
    setDidWork(result.getDidWork());
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) BuildOperationLogger(org.gradle.internal.operations.logging.BuildOperationLogger) DefaultWindowsResourceCompileSpec(org.gradle.language.rc.internal.DefaultWindowsResourceCompileSpec) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) NativeCompileSpec(org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal) WorkResult(org.gradle.api.tasks.WorkResult) TaskAction(org.gradle.api.tasks.TaskAction)

Example 7 with NativeToolChainInternal

use of org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal 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 8 with NativeToolChainInternal

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

the class AbstractNativeBinarySpec method getBinaryBuildAbility.

@Override
protected BinaryBuildAbility getBinaryBuildAbility() {
    NativeToolChainInternal toolChainInternal = (NativeToolChainInternal) getToolChain();
    NativePlatformInternal platformInternal = (NativePlatformInternal) getTargetPlatform();
    return new ToolSearchBuildAbility(toolChainInternal.select(platformInternal));
}
Also used : ToolSearchBuildAbility(org.gradle.platform.base.internal.ToolSearchBuildAbility) NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal)

Example 9 with NativeToolChainInternal

use of org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal 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 10 with NativeToolChainInternal

use of org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal 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)

Aggregations

NativeToolChainInternal (org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal)23 PlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)20 NativePlatformInternal (org.gradle.nativeplatform.platform.internal.NativePlatformInternal)12 File (java.io.File)6 TaskAction (org.gradle.api.tasks.TaskAction)5 BuildOperationLogger (org.gradle.internal.operations.logging.BuildOperationLogger)5 DefaultNativePlatform (org.gradle.nativeplatform.platform.internal.DefaultNativePlatform)5 Project (org.gradle.api.Project)4 NativeCompileSpec (org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec)4 NativeToolChainRegistryInternal (org.gradle.nativeplatform.toolchain.internal.NativeToolChainRegistryInternal)4 LinkedHashSet (java.util.LinkedHashSet)3 FileCollectionFactory (org.gradle.api.internal.file.FileCollectionFactory)3 MinimalFileSet (org.gradle.api.internal.file.collections.MinimalFileSet)3 WorkResult (org.gradle.api.tasks.WorkResult)3 Names (org.gradle.language.nativeplatform.internal.Names)3 SwiftPlatform (org.gradle.language.swift.SwiftPlatform)3 DefaultSwiftPlatform (org.gradle.language.swift.internal.DefaultSwiftPlatform)3 NativeLanguage (org.gradle.nativeplatform.toolchain.internal.NativeLanguage)3 List (java.util.List)2 Callable (java.util.concurrent.Callable)2