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 Project: javaide   Author: tranleduy2000   File: MinimalJavaCompileOptions.java    License: 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 Project: atlas   Author: alibaba   File: AtlasDexMerger.java    License: 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
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 Project: pushfish-android   Author: PushFish   File: DefaultTaskInputs.java    License: 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 Project: gradle-modules-plugin   Author: java9-modularity   File: MergeClassesHelper.java    License: 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 Project: pushfish-android   Author: PushFish   File: TestReport.java    License: 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 Project: Pushjet-Android   Author: Pushjet   File: DependencyNotationParser.java    License: 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
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
public FileCollection resolve() {
    try {
        walker.add(queue);
        return new UnionFileCollection(walker.findValues());
    } finally {
        queue.clear();
    }
}
 
Example #10
Source Project: pushfish-android   Author: PushFish   File: CompositeFileCollection.java    License: 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 Project: app-gradle-plugin   Author: GoogleCloudPlatform   File: StageAppYamlExtension.java    License: 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 Project: putnami-gradle-plugin   Author: Putnami   File: GwtCompileTask.java    License: 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 Project: pygradle   Author: linkedin   File: DependencyOrder.java    License: 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 Project: pushfish-android   Author: PushFish   File: JsHint.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
@InputFiles
public FileCollection getRhinoClasspath() {
    return getProject().files(rhinoClasspath);
}
 
Example #15
Source Project: playframework   Author: gradle   File: PlayApplicationPlugin.java    License: Apache License 2.0 4 votes vote down vote up
FileCollection getChangingArtifacts() {
    return new FilterByProjectComponentTypeFileCollection(configuration, true);
}
 
Example #16
Source Project: Pushjet-Android   Author: Pushjet   File: AbstractPrebuiltLibraryBinary.java    License: 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 Project: pushfish-android   Author: PushFish   File: JsHint.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
@InputFiles
public FileCollection getJsHint() {
    return getProject().files(jsHint);
}
 
Example #18
Source Project: Pushjet-Android   Author: Pushjet   File: JettyRun.java    License: 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 Project: japicmp-gradle-plugin   Author: melix   File: JapicmpTask.java    License: Apache License 2.0 4 votes vote down vote up
@CompileClasspath
public FileCollection getNewClasspath() {
    return newClasspath;
}
 
Example #20
Source Project: pushfish-android   Author: PushFish   File: JavaExec.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@InputFiles
public FileCollection getClasspath() {
    return javaExecHandleBuilder.getClasspath();
}
 
Example #21
Source Project: Pushjet-Android   Author: Pushjet   File: SelectiveCompilation.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getSource() {
    return source;
}
 
Example #22
Source Project: pushfish-android   Author: PushFish   File: StaleClassCleaner.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getSource() {
    return source;
}
 
Example #23
Source Project: pushfish-android   Author: PushFish   File: DefaultSourceSetOutput.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getDirs() {
    return dirs;
}
 
Example #24
public FileCollection getRuntimeFiles() {
    return empty();
}
 
Example #25
public FileCollection getLinkFiles() {
    return createFileCollection(getStaticLibraryFile(), "Static library file");
}
 
Example #26
Source Project: pushfish-android   Author: PushFish   File: JvmOptions.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getBootstrapClasspath() {
    return bootstrapClasspath;
}
 
Example #27
Source Project: Pushjet-Android   Author: Pushjet   File: Compile.java    License: 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 Project: Pushjet-Android   Author: Pushjet   File: DefaultIvyPublication.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setDescriptorFile(FileCollection descriptorFile) {
    this.descriptorFile = descriptorFile;
}
 
Example #29
Source Project: pushfish-android   Author: PushFish   File: CoffeeScriptCompile.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
@InputFiles
public FileCollection getRhinoClasspath() {
    return getProject().files(rhinoClasspath);
}
 
Example #30
Source Project: Pushjet-Android   Author: Pushjet   File: JavaExec.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@InputFiles
public FileCollection getBootstrapClasspath() {
    return javaExecHandleBuilder.getBootstrapClasspath();
}