Search in sources :

Example 1 with VersionAwareCompiler

use of org.gradle.language.base.internal.compile.VersionAwareCompiler in project gradle by gradle.

the class AbstractNativeSourceCompileTask method getCompilerVersion.

/**
 * The compiler used, including the type and the version.
 *
 * @since 4.4
 */
@Nullable
@Optional
@Nested
protected CompilerVersion getCompilerVersion() {
    NativeToolChainInternal toolChain = (NativeToolChainInternal) getToolChain().get();
    NativePlatformInternal targetPlatform = (NativePlatformInternal) getTargetPlatform().get();
    PlatformToolProvider toolProvider = toolChain.select(targetPlatform);
    Compiler<? extends NativeCompileSpec> compiler = toolProvider.newCompiler(createCompileSpec().getClass());
    if (!(compiler instanceof VersionAwareCompiler)) {
        return null;
    }
    return ((VersionAwareCompiler) compiler).getVersion();
}
Also used : NativeToolChainInternal(org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal) PlatformToolProvider(org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider) VersionAwareCompiler(org.gradle.language.base.internal.compile.VersionAwareCompiler) NativePlatformInternal(org.gradle.nativeplatform.platform.internal.NativePlatformInternal) Optional(org.gradle.api.tasks.Optional) Nested(org.gradle.api.tasks.Nested) Nullable(javax.annotation.Nullable)

Example 2 with VersionAwareCompiler

use of org.gradle.language.base.internal.compile.VersionAwareCompiler in project gradle by gradle.

the class SwiftPlatformToolProvider method createLinker.

@Override
protected Compiler<LinkerSpec> createLinker() {
    CommandLineToolConfigurationInternal linkerTool = (CommandLineToolConfigurationInternal) toolRegistry.getLinker();
    SwiftLinker swiftLinker = new SwiftLinker(buildOperationExecutor, commandLineTool(ToolType.LINKER, "swiftc"), context(linkerTool), workerLeaseService);
    return new VersionAwareCompiler<LinkerSpec>(swiftLinker, new DefaultCompilerVersion("swiftc", swiftcMetaData.getVendor(), swiftcMetaData.getVersion()));
}
Also used : DefaultCompilerVersion(org.gradle.language.base.internal.compile.DefaultCompilerVersion) VersionAwareCompiler(org.gradle.language.base.internal.compile.VersionAwareCompiler) CommandLineToolConfigurationInternal(org.gradle.nativeplatform.toolchain.internal.tools.CommandLineToolConfigurationInternal)

Example 3 with VersionAwareCompiler

use of org.gradle.language.base.internal.compile.VersionAwareCompiler in project gradle by gradle.

the class SwiftPlatformToolProvider method createSwiftCompiler.

protected Compiler<SwiftCompileSpec> createSwiftCompiler() {
    CommandLineToolConfigurationInternal swiftCompilerTool = (CommandLineToolConfigurationInternal) toolRegistry.getSwiftCompiler();
    SwiftCompiler swiftCompiler = new SwiftCompiler(buildOperationExecutor, compilerOutputFileNamingSchemeFactory, commandLineTool(ToolType.SWIFT_COMPILER, "swiftc"), context(swiftCompilerTool), getObjectFileExtension(), workerLeaseService, swiftcMetaData.getVersion());
    return new VersionAwareCompiler<SwiftCompileSpec>(swiftCompiler, new DefaultCompilerVersion("swiftc", swiftcMetaData.getVendor(), swiftcMetaData.getVersion()));
}
Also used : DefaultCompilerVersion(org.gradle.language.base.internal.compile.DefaultCompilerVersion) VersionAwareCompiler(org.gradle.language.base.internal.compile.VersionAwareCompiler) CommandLineToolConfigurationInternal(org.gradle.nativeplatform.toolchain.internal.tools.CommandLineToolConfigurationInternal)

Aggregations

VersionAwareCompiler (org.gradle.language.base.internal.compile.VersionAwareCompiler)3 DefaultCompilerVersion (org.gradle.language.base.internal.compile.DefaultCompilerVersion)2 CommandLineToolConfigurationInternal (org.gradle.nativeplatform.toolchain.internal.tools.CommandLineToolConfigurationInternal)2 Nullable (javax.annotation.Nullable)1 Nested (org.gradle.api.tasks.Nested)1 Optional (org.gradle.api.tasks.Optional)1 NativePlatformInternal (org.gradle.nativeplatform.platform.internal.NativePlatformInternal)1 NativeToolChainInternal (org.gradle.nativeplatform.toolchain.internal.NativeToolChainInternal)1 PlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)1