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: 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 #3
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 #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: 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 #6
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 #7
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 #8
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 #9
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 #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: 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 #12
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 #13
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 #14
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 #15
Source File: PlayApplicationPlugin.java    From playframework with Apache License 2.0 4 votes vote down vote up
FileCollection getChangingArtifacts() {
    return new FilterByProjectComponentTypeFileCollection(configuration, true);
}
 
Example #16
Source File: AbstractPrebuiltLibraryBinary.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected FileCollection createFileCollection(File file, String fileDescription) {
    return new FileCollectionAdapter(new ValidatingFileSet(file, getComponent().getName(), fileDescription));
}
 
Example #17
Source File: JsHint.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@InputFiles
public FileCollection getJsHint() {
    return getProject().files(jsHint);
}
 
Example #18
Source File: JettyRun.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Returns the classpath for the web application.
 */
@InputFiles
public FileCollection getClasspath() {
    return classpath;
}
 
Example #19
Source File: JapicmpTask.java    From japicmp-gradle-plugin with Apache License 2.0 4 votes vote down vote up
@CompileClasspath
public FileCollection getNewClasspath() {
    return newClasspath;
}
 
Example #20
Source File: JavaExec.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@InputFiles
public FileCollection getClasspath() {
    return javaExecHandleBuilder.getClasspath();
}
 
Example #21
Source File: SelectiveCompilation.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getSource() {
    return source;
}
 
Example #22
Source File: StaleClassCleaner.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getSource() {
    return source;
}
 
Example #23
Source File: DefaultSourceSetOutput.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getDirs() {
    return dirs;
}
 
Example #24
Source File: SourceSetNativeDependencyResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getRuntimeFiles() {
    return empty();
}
 
Example #25
Source File: DefaultPrebuiltStaticLibraryBinary.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getLinkFiles() {
    return createFileCollection(getStaticLibraryFile(), "Static library file");
}
 
Example #26
Source File: JvmOptions.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getBootstrapClasspath() {
    return bootstrapClasspath;
}
 
Example #27
Source File: Compile.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected void compile() {
    FileTree source = getSource();
    FileCollection classpath = getClasspath();

    performCompilation(source, classpath, cleaningCompiler);
}
 
Example #28
Source File: DefaultIvyPublication.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setDescriptorFile(FileCollection descriptorFile) {
    this.descriptorFile = descriptorFile;
}
 
Example #29
Source File: CoffeeScriptCompile.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 #30
Source File: JavaExec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@InputFiles
public FileCollection getBootstrapClasspath() {
    return javaExecHandleBuilder.getBootstrapClasspath();
}