Search in sources :

Example 1 with InputFile

use of org.gradle.api.tasks.InputFile in project atlas by alibaba.

the class AwbDexTask method doTaskAction.

private void doTaskAction(@Nullable Collection<File> inputFiles, @Nullable File inputDir, boolean incremental) throws InterruptedException, ProcessException, IOException {
    File outFolder = getOutputFolder();
    if (!incremental) {
        emptyFolder(outFolder);
    }
    // if some of our .jar input files exist, just reset the inputDir to null
    for (File inputFile : inputFiles) {
        if (inputFile.exists()) {
            inputDir = null;
        }
    }
    if (inputDir != null) {
        inputFiles = getProject().files(inputDir).getFiles();
    }
    ProcessOutputHandler outputHandler = new ParsingProcessOutputHandler(new ToolOutputParser(new DexParser(), Message.Kind.ERROR, getILogger()), new ToolOutputParser(new DexParser(), getILogger()), getBuilder().getErrorReporter());
    getBuilder().convertByteCode(inputFiles, getOutputFolder(), getMultiDexEnabled(), getMainDexListFile(), getDexOptions(), getOptimize(), outputHandler);
}
Also used : ParsingProcessOutputHandler(com.android.ide.common.blame.ParsingProcessOutputHandler) ProcessOutputHandler(com.android.ide.common.process.ProcessOutputHandler) ToolOutputParser(com.android.ide.common.blame.parser.ToolOutputParser) DexParser(com.android.ide.common.blame.parser.DexParser) File(java.io.File) InputFile(org.gradle.api.tasks.InputFile) ParsingProcessOutputHandler(com.android.ide.common.blame.ParsingProcessOutputHandler)

Example 2 with InputFile

use of org.gradle.api.tasks.InputFile 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 3 with InputFile

use of org.gradle.api.tasks.InputFile 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 4 with InputFile

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

the class GeneratorTask method generate.

@SuppressWarnings("UnusedDeclaration")
@TaskAction
void generate() {
    File inputFile = getInputFileIfExists();
    if (inputFile != null) {
        try {
            domainObject = generator.read(inputFile);
        } catch (RuntimeException e) {
            throw new GradleException(String.format("Cannot parse file '%s'.\n" + "       Perhaps this file was tinkered with? In that case try delete this file and then retry.", inputFile), e);
        }
    } else {
        domainObject = generator.defaultInstance();
    }
    beforeConfigured.execute(domainObject);
    generator.configure(domainObject);
    afterConfigured.execute(domainObject);
    generator.write(domainObject, getOutputFile());
}
Also used : GradleException(org.gradle.api.GradleException) File(java.io.File) OutputFile(org.gradle.api.tasks.OutputFile) InputFile(org.gradle.api.tasks.InputFile) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

File (java.io.File)4 InputFile (org.gradle.api.tasks.InputFile)4 Nullable (javax.annotation.Nullable)2 RegularFile (org.gradle.api.file.RegularFile)2 Optional (org.gradle.api.tasks.Optional)2 PathSensitive (org.gradle.api.tasks.PathSensitive)2 SkipWhenEmpty (org.gradle.api.tasks.SkipWhenEmpty)2 ParsingProcessOutputHandler (com.android.ide.common.blame.ParsingProcessOutputHandler)1 DexParser (com.android.ide.common.blame.parser.DexParser)1 ToolOutputParser (com.android.ide.common.blame.parser.ToolOutputParser)1 ProcessOutputHandler (com.android.ide.common.process.ProcessOutputHandler)1 GradleException (org.gradle.api.GradleException)1 OutputFile (org.gradle.api.tasks.OutputFile)1 TaskAction (org.gradle.api.tasks.TaskAction)1