Search in sources :

Example 1 with OutputDirectory

use of org.gradle.api.tasks.OutputDirectory in project android-instrumental-test-runner by Grigory-Rylov.

the class InstrumentationTestTask method getReportsDir.

@OutputDirectory
public File getReportsDir() {
    if (reportsDir == null) {
        String flavor = instrumentationInfo.getFlavorName() != null ? instrumentationInfo.getFlavorName() : DEFAULT_FLAVOR;
        reportsDir = new File(getProject().getBuildDir(), String.format("outputs/reports/androidTest/%s", flavor));
        logger.d(TAG, "Reports dir is empty, generate default value {}", reportsDir);
    }
    return reportsDir;
}
Also used : File(java.io.File) OutputDirectory(org.gradle.api.tasks.OutputDirectory)

Example 2 with OutputDirectory

use of org.gradle.api.tasks.OutputDirectory in project zaproxy by zaproxy.

the class DownloadAddOns method parseAddOnsData.

private Set<AddOnDownloadData> parseAddOnsData() throws IOException {
    File outputDirectory = getOutputDir().get().getAsFile();
    List<String> lines = Files.readAllLines(addOnsData.get().getAsFile().toPath());
    return lines.stream().map(String::trim).filter(line -> !(line.isEmpty() || line.startsWith("#"))).map(line -> {
        String[] lineData = line.split(" ", 2);
        String url = lineData[0];
        String hash = lineData[1];
        File file = new File(outputDirectory, getFileName(url));
        return new AddOnDownloadData(url, hash, file);
    }).collect(Collectors.toCollection(HashSet::new));
}
Also used : AddOnDownloadData(org.zaproxy.zap.internal.AddOnDownloadData) Arrays(java.util.Arrays) Iterator(java.util.Iterator) Files(java.nio.file.Files) Set(java.util.Set) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) File(java.io.File) OutputDirectory(org.gradle.api.tasks.OutputDirectory) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) TaskAction(org.gradle.api.tasks.TaskAction) List(java.util.List) RegularFileProperty(org.gradle.api.file.RegularFileProperty) ObjectFactory(org.gradle.api.model.ObjectFactory) DirectoryProperty(org.gradle.api.file.DirectoryProperty) DownloadAction(de.undercouch.gradle.tasks.download.DownloadAction) InputFile(org.gradle.api.tasks.InputFile) DefaultTask(org.gradle.api.DefaultTask) DigestUtils(org.apache.commons.codec.digest.DigestUtils) InvalidUserDataException(org.gradle.api.InvalidUserDataException) InputStream(java.io.InputStream) AddOnDownloadData(org.zaproxy.zap.internal.AddOnDownloadData) File(java.io.File) InputFile(org.gradle.api.tasks.InputFile)

Aggregations

File (java.io.File)2 OutputDirectory (org.gradle.api.tasks.OutputDirectory)2 DownloadAction (de.undercouch.gradle.tasks.download.DownloadAction)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Files (java.nio.file.Files)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 DigestUtils (org.apache.commons.codec.digest.DigestUtils)1 DefaultTask (org.gradle.api.DefaultTask)1 InvalidUserDataException (org.gradle.api.InvalidUserDataException)1 DirectoryProperty (org.gradle.api.file.DirectoryProperty)1 RegularFileProperty (org.gradle.api.file.RegularFileProperty)1 ObjectFactory (org.gradle.api.model.ObjectFactory)1 InputFile (org.gradle.api.tasks.InputFile)1