org.gradle.api.file.FileCollection Java Examples

The following examples show how to use org.gradle.api.file.FileCollection. 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: MinimalJavaCompileOptions.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
public MinimalJavaCompileOptions(final CompileOptions compileOptions) {
    FileCollection sourcepath = compileOptions.getSourcepath();
    this.sourcepath = sourcepath == null ? null : ImmutableList.copyOf(sourcepath.getFiles());
    this.compilerArgs = Lists.newArrayList(compileOptions.getAllCompilerArgs());
    this.encoding = compileOptions.getEncoding();
    this.bootClasspath = DeprecationLogger.whileDisabled(new Factory<String>() {
        @Nullable
        @Override
        @SuppressWarnings("deprecation")
        public String create() {
            return compileOptions.getBootClasspath();
        }
    });
    this.extensionDirs = compileOptions.getExtensionDirs();
    this.forkOptions = compileOptions.getForkOptions();
    this.debugOptions = compileOptions.getDebugOptions();
    this.debug = compileOptions.isDebug();
    this.deprecation = compileOptions.isDeprecation();
    this.failOnError = compileOptions.isFailOnError();
    this.listFiles = compileOptions.isListFiles();
    this.verbose = compileOptions.isVerbose();
    this.warnings = compileOptions.isWarnings();
    this.annotationProcessorGeneratedSourcesDirectory = compileOptions.getAnnotationProcessorGeneratedSourcesDirectory();
}
 
Example #2
Source File: DefaultFileCollectionResolveContext.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void convertInto(Object element, Collection<? super MinimalFileCollection> result, FileResolver resolver) {
    if (element instanceof DefaultFileCollectionResolveContext) {
        DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element;
        result.addAll(nestedContext.resolveAsMinimalFileCollections());
    } else if (element instanceof MinimalFileCollection) {
        MinimalFileCollection collection = (MinimalFileCollection) element;
        result.add(collection);
    } else if (element instanceof FileCollection) {
        throw new UnsupportedOperationException(String.format("Cannot convert instance of %s to MinimalFileCollection", element.getClass().getSimpleName()));
    } else if (element instanceof TaskDependency) {
        // Ignore
        return;
    } else {
        result.add(new ListBackedFileSet(resolver.resolve(element)));
    }
}
 
Example #3
Source File: AtlasDexMerger.java    From atlas with Apache License 2.0 6 votes vote down vote up
public AtlasDexMerger(DexingType dexingType, FileCollection mainDexListFile, ErrorReporter errorReporter, DexMergerTool dexMerger, int minSdkVersion, boolean isDebuggable, AppVariantOutputContext appVariantOutputContext) {
    this.dexingType = dexingType;
    this.mainDexListFile = mainDexListFile;
    this.dexMerger = dexMerger;
    this.minSdkVersion = minSdkVersion;
    this.isDebuggable = isDebuggable;
    this.logger= LoggerWrapper.getLogger(getClass());
    Preconditions.checkState(
            (dexingType == DexingType.LEGACY_MULTIDEX) == (mainDexListFile != null),
            "Main dex list must only be set when in legacy multidex");
    this.errorReporter = errorReporter;
    this.variantOutputContext = appVariantOutputContext;
     outputHandler =
            new ParsingProcessOutputHandler(
                    new ToolOutputParser(new DexParser(), Message.Kind.ERROR, logger),
                    new ToolOutputParser(new DexParser(), logger),
                    errorReporter);

}
 
Example #4
Source File: DefaultTaskInputs.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Object prepareValue(Object value) {
    while (true) {
        if (value instanceof Callable) {
            Callable callable = (Callable) value;
            try {
                value = callable.call();
            } catch (Exception e) {
                throw UncheckedException.throwAsUncheckedException(e);
            }
        } else if (value instanceof Closure) {
            Closure closure = (Closure) value;
            value = closure.call();
        } else if (value instanceof FileCollection) {
            FileCollection fileCollection = (FileCollection) value;
            return fileCollection.getFiles();
        } else {
            return avoidGString(value);
        }
    }
}
 
Example #5
Source File: TestReport.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Returns the set of binary test results to include in the report.
 */
@InputFiles @SkipWhenEmpty
public FileCollection getTestResultDirs() {
    UnionFileCollection dirs = new UnionFileCollection();
    for (Object result : results) {
        addTo(result, dirs);
    }
    return dirs;
}
 
Example #6
Source File: MergeClassesHelper.java    From gradle-modules-plugin with MIT License 5 votes vote down vote up
public FileCollection getMergeAdjustedClasspath(FileCollection classpath) {
    if (!isMergeRequired()) {
        return classpath;
    }

    Set<File> files = new HashSet<>(classpath.getFiles());
    allCompileTaskStream().map(AbstractCompile::getDestinationDir).forEach(files::remove);
    files.add(helper().getMergedDir());
    return project.files(files.toArray());
}
 
Example #7
Source File: StageAppYamlExtension.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
/** This method is purely for incremental build calculations. */
@Optional
@InputFiles
public FileCollection getExtraFilesDirectoriesAsInputFiles() {
  if (extraFilesDirectories == null) {
    return null;
  }
  FileCollection files = project.files();
  for (File directory : extraFilesDirectories) {
    files = files.plus(project.fileTree(directory));
  }
  return files;
}
 
Example #8
Source File: GwtCompileTask.java    From putnami-gradle-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void addSourceSet(FileCollection sources, Project project, String sourceSet) {
	JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
	SourceSet mainSourceSet = javaConvention.getSourceSets().getByName(sourceSet);
	sources.add(project.files(mainSourceSet.getOutput().getResourcesDir()))
		.plus(project.files(mainSourceSet.getOutput().getClassesDirs()))
		.plus(project.files(mainSourceSet.getAllSource().getSrcDirs()));
}
 
Example #9
Source File: DependencyOrder.java    From pygradle with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a set of configuration files in the tree post-order,
 * or sorted, or in the original insert order.
 *
 * Attempt to collect dependency tree post-order and fall back to
 * sorted or insert order.
 * If sorted is false, it will always return the original insert order.
 */
public static Collection<File> getConfigurationFiles(FileCollection files, boolean sorted) {
    if (sorted && (files instanceof Configuration)) {
        try {
            return DependencyOrder.configurationPostOrderFiles((Configuration) files);
        } catch (Throwable e) {
            // Log and fall back to old style installation order as before.
            logger.lifecycle("***** WARNING: ${ e.message } *****");
        }
    }
    return sorted
        ? files.getFiles().stream().sorted().collect(Collectors.toSet())
        : files.getFiles();
}
 
Example #10
Source File: CompositeFileCollection.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Set<File> getFiles() {
    Set<File> files = new LinkedHashSet<File>();
    for (FileCollection collection : getSourceCollections()) {
        files.addAll(collection.getFiles());
    }
    return files;
}
 
Example #11
Source File: CachingDependencyResolveContext.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public FileCollection resolve() {
    try {
        walker.add(queue);
        return new UnionFileCollection(walker.findValues());
    } finally {
        queue.clear();
    }
}
 
Example #12
Source File: SerializableCoffeeScriptCompileSpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public SerializableCoffeeScriptCompileSpec(File coffeeScriptJs, File destinationDir, FileCollection source, CoffeeScriptCompileOptions options) {
    this.coffeeScriptJs = coffeeScriptJs;
    this.destinationDir = destinationDir;
    this.source = new LinkedList<RelativeFile>();
    this.options = options;

    toRelativeFiles(source, this.source);
}
 
Example #13
Source File: DependencyNotationParser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static NotationParser<Object, Dependency> parser(Instantiator instantiator, DefaultProjectDependencyFactory dependencyFactory, ClassPathRegistry classPathRegistry, FileLookup fileLookup) {
    return NotationParserBuilder
            .toType(Dependency.class)
            .fromCharSequence(new DependencyStringNotationParser<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class))
            .parser(new DependencyMapNotationParser<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class))
            .fromType(FileCollection.class, new DependencyFilesNotationParser(instantiator))
            .fromType(Project.class, new DependencyProjectNotationParser(dependencyFactory))
            .fromType(DependencyFactory.ClassPathNotation.class, new DependencyClassPathNotationParser(instantiator, classPathRegistry, fileLookup.getFileResolver()))
            .invalidNotationMessage("Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.")
            .toComposite();
}
 
Example #14
Source File: Upload.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Returns the artifacts which will be uploaded.
 *
 * @return the artifacts.
 */
@InputFiles
public FileCollection getArtifacts() {
    Configuration configuration = getConfiguration();
    return configuration == null ? null : configuration.getAllArtifacts().getFiles();
}
 
Example #15
Source File: DefaultNativeDependencySet.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getLinkFiles() {
    return binary.getLinkFiles();
}
 
Example #16
Source File: Retrobuffer.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public FileCollection getClasspath() {
    return classpath;
}
 
Example #17
Source File: CoffeeScriptExtension.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getJs() {
    return js;
}
 
Example #18
Source File: CMake.java    From native-samples with Apache License 2.0 4 votes vote down vote up
@InputFiles
public FileCollection getCMakeLists() {
    return getProject().fileTree(projectDirectory, it -> it.include("**/CMakeLists.txt"));
}
 
Example #19
Source File: VariantScope.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
public FileCollection getJavaClasspath() {
    return getGlobalScope().getProject().files(
            getGlobalScope().getAndroidBuilder().getCompileClasspath(
                    getVariantData().getVariantConfiguration()));
}
 
Example #20
Source File: DefaultConfiguration.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection fileCollection(Dependency... dependencies) {
    return new ConfigurationFileCollection(WrapUtil.toLinkedSet(dependencies));
}
 
Example #21
Source File: DelegatingFileCollection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection filter(Spec<? super File> filterSpec) {
    return getDelegate().filter(filterSpec);
}
 
Example #22
Source File: DefaultNativeDependencySet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getRuntimeFiles() {
    return binary.getRuntimeFiles();
}
 
Example #23
Source File: ProjectStaticLibraryBinary.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getRuntimeFiles() {
    return new SimpleFileCollection();
}
 
Example #24
Source File: DefaultSourceSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getCompileClasspath() {
    return compileClasspath;
}
 
Example #25
Source File: DefaultTaskArtifactStateRepository.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getOutputFiles() {
    TaskExecution lastExecution = history.getPreviousExecution();
    return lastExecution != null && lastExecution.getOutputFilesSnapshot() != null ? lastExecution.getOutputFilesSnapshot().getFiles() : new SimpleFileCollection();
}
 
Example #26
Source File: DefaultIvyArtifactSet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getFiles() {
    return files;
}
 
Example #27
Source File: AbstractNativeCompileTask.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Returns the header directories to be used for compilation.
 */
@InputFiles
public FileCollection getIncludes() {
    return includes;
}
 
Example #28
Source File: JsHint.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@InputFiles
public FileCollection getRhinoClasspath() {
    return getProject().files(rhinoClasspath);
}
 
Example #29
Source File: ScalaCompile.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setZincClasspath(FileCollection zincClasspath) {
    this.zincClasspath = zincClasspath;
}
 
Example #30
Source File: DelegatingFileCollection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection plus(FileCollection collection) {
    return getDelegate().plus(collection);
}