Java Code Examples for org.gradle.api.file.FileCollection#getSingleFile()

The following examples show how to use org.gradle.api.file.FileCollection#getSingleFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileCollectionBackedArchiveTextResource.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public FileCollectionBackedArchiveTextResource(final FileOperations fileOperations,
                                               final TemporaryFileProvider tempFileProvider,
                                               final FileCollection fileCollection,
                                               final String path, Charset charset) {
    super(tempFileProvider, new LazilyInitializedFileTree() {
        @Override
        public FileTree createDelegate() {
            File archiveFile = fileCollection.getSingleFile();
            String fileExtension = Files.getFileExtension(archiveFile.getName());
            FileTree archiveContents = fileExtension.equals("jar") || fileExtension.equals("zip")
                    ? fileOperations.zipTree(archiveFile) : fileOperations.tarTree(archiveFile);
            PatternSet patternSet = new PatternSet();
            patternSet.include(path);
            return archiveContents.matching(patternSet);
        }
        public TaskDependency getBuildDependencies() {
            return fileCollection.getBuildDependencies();
        }
    }, charset);
}
 
Example 2
Source File: TestReport.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private TestResultsProvider createAggregateProvider() {
    List<TestResultsProvider> resultsProviders = new LinkedList<TestResultsProvider>();
    try {
        FileCollection resultDirs = getTestResultDirs();
        if (resultDirs.getFiles().size() == 1) {
            return new BinaryResultBackedTestResultsProvider(resultDirs.getSingleFile());
        } else {
            return new AggregateTestResultsProvider(collect(resultDirs, resultsProviders, new Transformer<TestResultsProvider, File>() {
                public TestResultsProvider transform(File dir) {
                    return new BinaryResultBackedTestResultsProvider(dir);
                }
            }));
        }
    } catch (RuntimeException e) {
        stoppable(resultsProviders).stop();
        throw e;
    }
}
 
Example 3
Source File: TestReport.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private TestResultsProvider createAggregateProvider() {
    List<TestResultsProvider> resultsProviders = new LinkedList<TestResultsProvider>();
    try {
        FileCollection resultDirs = getTestResultDirs();
        if (resultDirs.getFiles().size() == 1) {
            return new BinaryResultBackedTestResultsProvider(resultDirs.getSingleFile());
        } else {
            return new AggregateTestResultsProvider(collect(resultDirs, resultsProviders, new Transformer<TestResultsProvider, File>() {
                public TestResultsProvider transform(File dir) {
                    return new BinaryResultBackedTestResultsProvider(dir);
                }
            }));
        }
    } catch (RuntimeException e) {
        stoppable(resultsProviders).stop();
        throw e;
    }
}
 
Example 4
Source File: AtlasDexMergerTransform.java    From atlas with Apache License 2.0 6 votes vote down vote up
public AtlasDexMergerTransform(AppVariantOutputContext appVariantOutputContext,
                               @NonNull DexingType dexingType,
                               @Nullable FileCollection mainDexListFile,
                               @NonNull ErrorReporter errorReporter,
                               @NonNull DexMergerTool dexMerger,
                               int minSdkVersion,
                               boolean isDebuggable
) {
    this.variantOutputContext = appVariantOutputContext;
    atlasMainDexMerger = new AtlasMainDexMerger(dexingType, mainDexListFile, errorReporter, dexMerger, minSdkVersion, isDebuggable, appVariantOutputContext);
    awbDexMerger = new AwbDexsMerger(DexingType.MONO_DEX, null, errorReporter, dexMerger, minSdkVersion, isDebuggable, appVariantOutputContext);
    this.mainDexListFile = mainDexListFile == null ? null : mainDexListFile.getSingleFile();
    this.dexingType = dexingType;
    this.dexMergerTool = dexMerger;


}
 
Example 5
Source File: FileCollectionBackedArchiveTextResource.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public FileCollectionBackedArchiveTextResource(final FileOperations fileOperations,
                                               final TemporaryFileProvider tempFileProvider,
                                               final FileCollection fileCollection,
                                               final String path, Charset charset) {
    super(tempFileProvider, new LazilyInitializedFileTree() {
        @Override
        public FileTree createDelegate() {
            File archiveFile = fileCollection.getSingleFile();
            String fileExtension = Files.getFileExtension(archiveFile.getName());
            FileTree archiveContents = fileExtension.equals("jar") || fileExtension.equals("zip")
                    ? fileOperations.zipTree(archiveFile) : fileOperations.tarTree(archiveFile);
            PatternSet patternSet = new PatternSet();
            patternSet.include(path);
            return archiveContents.matching(patternSet);
        }
        public TaskDependency getBuildDependencies() {
            return fileCollection.getBuildDependencies();
        }
    }, charset);
}
 
Example 6
Source File: TestReport.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private TestResultsProvider createAggregateProvider() {
    List<TestResultsProvider> resultsProviders = new LinkedList<TestResultsProvider>();
    try {
        FileCollection resultDirs = getTestResultDirs();
        if (resultDirs.getFiles().size() == 1) {
            return new BinaryResultBackedTestResultsProvider(resultDirs.getSingleFile());
        } else {
            return new AggregateTestResultsProvider(collect(resultDirs, resultsProviders, new Transformer<TestResultsProvider, File>() {
                public TestResultsProvider transform(File dir) {
                    return new BinaryResultBackedTestResultsProvider(dir);
                }
            }));
        }
    } catch (RuntimeException e) {
        stoppable(resultsProviders).stop();
        throw e;
    }
}
 
Example 7
Source File: TestReport.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private TestResultsProvider createAggregateProvider() {
    List<TestResultsProvider> resultsProviders = new LinkedList<TestResultsProvider>();
    try {
        FileCollection resultDirs = getTestResultDirs();
        if (resultDirs.getFiles().size() == 1) {
            return new BinaryResultBackedTestResultsProvider(resultDirs.getSingleFile());
        } else {
            return new AggregateTestResultsProvider(collect(resultDirs, resultsProviders, new Transformer<TestResultsProvider, File>() {
                public TestResultsProvider transform(File dir) {
                    return new BinaryResultBackedTestResultsProvider(dir);
                }
            }));
        }
    } catch (RuntimeException e) {
        stoppable(resultsProviders).stop();
        throw e;
    }
}