Search in sources :

Example 11 with RegularFile

use of org.gradle.api.file.RegularFile in project gradle by gradle.

the class FileContentValueSource method obtain.

@Nullable
@Override
public T obtain() {
    @Nullable final RegularFile regularFile = getParameters().getFile().getOrNull();
    if (regularFile == null) {
        return null;
    }
    final File file = regularFile.getAsFile();
    if (!file.isFile()) {
        return null;
    }
    return obtainFrom(file);
}
Also used : RegularFile(org.gradle.api.file.RegularFile) RegularFile(org.gradle.api.file.RegularFile) InputFile(org.gradle.api.tasks.InputFile) File(java.io.File) Nullable(javax.annotation.Nullable) Nullable(javax.annotation.Nullable)

Example 12 with RegularFile

use of org.gradle.api.file.RegularFile in project gradle by gradle.

the class InstallXCTestBundle method getBundleBinary.

@SkipWhenEmpty
@Nullable
@Optional
@PathSensitive(PathSensitivity.NAME_ONLY)
@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) PathSensitive(org.gradle.api.tasks.PathSensitive) Nullable(javax.annotation.Nullable) InputFile(org.gradle.api.tasks.InputFile)

Example 13 with RegularFile

use of org.gradle.api.file.RegularFile 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
@PathSensitive(PathSensitivity.ABSOLUTE)
@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) PathSensitive(org.gradle.api.tasks.PathSensitive) Nullable(javax.annotation.Nullable) InputFile(org.gradle.api.tasks.InputFile)

Example 14 with RegularFile

use of org.gradle.api.file.RegularFile in project gradle by gradle.

the class CreateMD5 method createHashes.

@TaskAction
public void createHashes() {
    // <1>
    WorkQueue workQueue = getWorkerExecutor().processIsolation(workerSpec -> {
        workerSpec.getClasspath().from(getCodecClasspath());
        workerSpec.forkOptions(options -> {
            // <2>
            options.setMaxHeapSize("64m");
        });
    });
    for (File sourceFile : getSource().getFiles()) {
        Provider<RegularFile> md5File = getDestinationDirectory().file(sourceFile.getName() + ".md5");
        workQueue.submit(GenerateMD5.class, parameters -> {
            parameters.getSourceFile().set(sourceFile);
            parameters.getMD5File().set(md5File);
        });
    }
}
Also used : RegularFile(org.gradle.api.file.RegularFile) RegularFile(org.gradle.api.file.RegularFile) File(java.io.File)

Aggregations

RegularFile (org.gradle.api.file.RegularFile)14 File (java.io.File)9 Configuration (org.gradle.api.artifacts.Configuration)7 Provider (org.gradle.api.provider.Provider)7 Callable (java.util.concurrent.Callable)5 Inject (javax.inject.Inject)5 Plugin (org.gradle.api.Plugin)5 TaskContainer (org.gradle.api.tasks.TaskContainer)5 Names (org.gradle.language.nativeplatform.internal.Names)5 NativeToolChain (org.gradle.nativeplatform.toolchain.NativeToolChain)5 PlatformToolProvider (org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider)5 Collections (java.util.Collections)4 Project (org.gradle.api.Project)4 ConfigurationContainer (org.gradle.api.artifacts.ConfigurationContainer)4 FileCollection (org.gradle.api.file.FileCollection)4 ObjectFactory (org.gradle.api.model.ObjectFactory)4 ProviderFactory (org.gradle.api.provider.ProviderFactory)4 SourceSet (org.gradle.api.tasks.SourceSet)4 TaskProvider (org.gradle.api.tasks.TaskProvider)4 LifecycleBasePlugin (org.gradle.language.base.plugins.LifecycleBasePlugin)4