Search in sources :

Example 1 with Optional

use of org.gradle.api.tasks.Optional in project gradle by gradle.

the class InstallXCTestBundle method getBundleBinary.

@SkipWhenEmpty
@Nullable
@Optional
@InputFile
protected File getBundleBinary() {
    RegularFile bundle = getBundleBinaryFile().get();
    File bundleFile = bundle.getAsFile();
    if (!bundleFile.exists()) {
        return null;
    }
    return bundleFile;
}
Also used : RegularFile(org.gradle.api.file.RegularFile) File(java.io.File) RegularFile(org.gradle.api.file.RegularFile) InputFile(org.gradle.api.tasks.InputFile) SkipWhenEmpty(org.gradle.api.tasks.SkipWhenEmpty) Optional(org.gradle.api.tasks.Optional) Nullable(javax.annotation.Nullable) InputFile(org.gradle.api.tasks.InputFile)

Example 2 with Optional

use of org.gradle.api.tasks.Optional in project gradle by gradle.

the class XCTest method getRunScript.

/**
 * Workaround for when the task is given an input file that doesn't exist
 */
@SkipWhenEmpty
@Nullable
@Optional
@InputFile
protected File getRunScript() {
    RegularFile runScript = getRunScriptFile().get();
    File runScriptFile = runScript.getAsFile();
    if (!runScriptFile.exists()) {
        return null;
    }
    return runScriptFile;
}
Also used : RegularFile(org.gradle.api.file.RegularFile) File(java.io.File) RegularFile(org.gradle.api.file.RegularFile) InputFile(org.gradle.api.tasks.InputFile) SkipWhenEmpty(org.gradle.api.tasks.SkipWhenEmpty) Optional(org.gradle.api.tasks.Optional) Nullable(javax.annotation.Nullable) InputFile(org.gradle.api.tasks.InputFile)

Example 3 with Optional

use of org.gradle.api.tasks.Optional 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)

Aggregations

Nullable (javax.annotation.Nullable)3 Optional (org.gradle.api.tasks.Optional)3 File (java.io.File)2 RegularFile (org.gradle.api.file.RegularFile)2 InputFile (org.gradle.api.tasks.InputFile)2 SkipWhenEmpty (org.gradle.api.tasks.SkipWhenEmpty)2 Nested (org.gradle.api.tasks.Nested)1 VersionAwareCompiler (org.gradle.language.base.internal.compile.VersionAwareCompiler)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