Java 类org.gradle.api.file.ConfigurableFileTree 实例源码

项目:atlas    文件:AppVariantContext.java   
public List<ConfigurableFileTree> getAwSourceOutputDir(AwbBundle awbBundle) {
    Project project = scope.getGlobalScope().getProject();
    // Build the list of source folders.
    ImmutableList.Builder<ConfigurableFileTree> sourceSets = ImmutableList.builder();

    // then all the generated src folders.
    if (getAwbRClassSourceOutputDir(awbBundle) != null) {
        sourceSets.add(project.fileTree(getAwbRClassSourceOutputDir(awbBundle)));
    }

    if (scope.getGlobalScope().getExtension().getDataBinding().isEnabled()) {
        sourceSets.add(project.fileTree(getAwbClassOutputForDataBinding(awbBundle)));
    }

    return sourceSets.build();
}
项目:GradleBukkit    文件:RunBukkit.java   
private Integer findBukkitBuildToRun() throws IOException
{
    final ConfigurableFileTree bukkitFiles = getProject().fileTree(new File(getProject().getBuildDir(), "bukkit"));
    bukkitFiles.include("bukkit-*.jar");

    int currentLatestBuildNum = -1;
    for (final File bukkitFile : bukkitFiles)
    {
        final String fileName = bukkitFile.getName();
        int buildNum = Integer.parseInt(fileName.substring(fileName.indexOf("-") + 1, fileName.indexOf(".")));
        if (buildNum > currentLatestBuildNum)
        {
            currentLatestBuildNum = buildNum;
        }
    }

    return currentLatestBuildNum;
}
项目:Reer    文件:InputDirectoryPropertyAnnotationHandler.java   
@Override
protected void validate(String propertyName, Object value, Collection<String> messages) {
    File fileValue = (value instanceof ConfigurableFileTree) ? ((ConfigurableFileTree) value).getDir() : (File) value;
    if (!fileValue.exists()) {
        messages.add(String.format("Directory '%s' specified for property '%s' does not exist.", fileValue, propertyName));
    } else if (!fileValue.isDirectory()) {
        messages.add(String.format("Directory '%s' specified for property '%s' is not a directory.", fileValue, propertyName));
    }
}
项目:atlas    文件:AwbDataBindingExportBuildInfoTask.java   
@Override
public void execute(DataBindingExportBuildInfoTask task) {
    final BaseVariantData<? extends BaseVariantOutputData> variantData = appVariantContext.getScope()
        .getVariantData();
    task.setXmlProcessor(
        AwbXmlProcessor.getLayoutXmlProcessor(appVariantContext, awbBundle, dataBindingBuilder));
    task.setSdkDir(appVariantContext.getScope().getGlobalScope().getSdkHandler().getSdkFolder());
    task.setXmlOutFolder(appVariantContext.getAwbLayoutInfoOutputForDataBinding(awbBundle));

    ConventionMappingHelper.map(task, "compilerClasspath", new Callable<FileCollection>() {
        @Override
        public FileCollection call() {
            return appVariantContext.getScope().getJavaClasspath();
        }
    });
    ConventionMappingHelper
        .map(task, "compilerSources", new Callable<Iterable<ConfigurableFileTree>>() {
            @Override
            public Iterable<ConfigurableFileTree> call() throws Exception {
                return Iterables.filter(appVariantContext.getAwSourceOutputDir(awbBundle),
                                        new Predicate<ConfigurableFileTree>() {
                                            @Override
                                            public boolean apply(ConfigurableFileTree input) {
                                                File
                                                    dataBindingOut = appVariantContext
                                                    .getAwbClassOutputForDataBinding(awbBundle);
                                                return !dataBindingOut.equals(input.getDir());
                                            }
                                        });
            }
        });

    task.setExportClassListTo(variantData.getType().isExportDataBindingClassList() ?
                                  new File(appVariantContext.getAwbLayoutFolderOutputForDataBinding(awbBundle),
                                           "_generated.txt") : null);
    //task.setPrintMachineReadableErrors(printMachineReadableErrors);
    task.setDataBindingClassOutput(appVariantContext.getAwbClassOutputForDataBinding(awbBundle));
}
项目:gradle-checksum    文件:Checksum.java   
private FileCollection filesFor(final Algorithm algo) {
    return getProject().fileTree(getOutputDir(), new Action<ConfigurableFileTree>() {
        @Override
        public void execute(ConfigurableFileTree files) {
            files.include("**/*." + algo.toString().toLowerCase());
        }
    });
}
项目:copyrightr    文件:Parser.java   
/**
 * Create a new parser object which will loop through the lines of the file
 * looking for copyright notices and (potentially) update them
 * 
 * @param project The Gradle project
 * @param extension The plugin extension with the options
 */
public Parser(Project project, CopyrightrPluginExtension extension) {
    this.logger = project.getLogger();
    this.copyrightHolder = extension.getCopyrightHolder();

    this.includes = extension.getIncludes();
    this.excludes = extension.getExcludes();
    this.dryRun = extension.getDryRun();
    this.onlyReplaceFirst = extension.getOnlyReplaceFirst();
    this.yearSeparator = extension.getYearSeparator();
    this.failOnMissing = extension.getFailOnMissing();

    // compile the patterns to ensure that they work
    for (String pattern : PATTERNS) {
        String patternFormat = String.format("%s%s%s%s", pattern, ".*", Pattern.quote(copyrightHolder), ".*$");
        compiledPatterns.add(Pattern.compile(patternFormat));
        logger.debug("Compiled pattern:"  + Pattern.compile(patternFormat).pattern());
    }

    String absoluteProjectPath = project.getProjectDir().getAbsolutePath();

    Map<String, Object> map  = new HashMap<String, Object>();
    map.put(KEY_DIR, absoluteProjectPath);
    map.put(KEY_INCLUDES, includes);
    map.put(KEY_EXCLUDES, excludes);

    ConfigurableFileTree fileTree = project.fileTree(map);
    asFileTree = fileTree.getAsFileTree();
}
项目:GradleSassPlugin    文件:AbstractSassCompileTask.java   
FileCollection getSassFiles() {
    if(getSrcDir().exists() == false)
        throw new RuntimeException("srcDir doesn't exists");
    if(getSrcDir().isDirectory() == false)
        throw new RuntimeException("srcDir isn't directory");

    ConfigurableFileTree fileTree = getProject().fileTree(getSrcDir());
    if(getInclude() != null)
        fileTree.include(getInclude());
    if(getExclude() != null)
        fileTree.exclude(getExclude());

    return fileTree;
}
项目:GradleSassPlugin    文件:AbstractSassCompileTask.java   
@InputFiles
FileCollection getInputFiles() {
    if(getSrcDir().exists() == false)
        throw new RuntimeException("srcDir doesn't exists");
    if(getSrcDir().isDirectory() == false)
        throw new RuntimeException("srcDir isn't directory");

    ConfigurableFileTree fileTree = getProject().fileTree(getSrcDir());
    return fileTree;
}
项目:Pushjet-Android    文件:InputDirectoryPropertyAnnotationHandler.java   
public void validate(String propertyName, Object value, Collection<String> messages) {
    File fileValue = (value instanceof ConfigurableFileTree) ? ((ConfigurableFileTree) value).getDir() : (File) value;
    if (!fileValue.exists()) {
        messages.add(String.format("Directory '%s' specified for property '%s' does not exist.", fileValue, propertyName));
    } else if (!fileValue.isDirectory()) {
        messages.add(String.format("Directory '%s' specified for property '%s' is not a directory.", fileValue, propertyName));
    }
}
项目:Pushjet-Android    文件:InputDirectoryPropertyAnnotationHandler.java   
public void validate(String propertyName, Object value, Collection<String> messages) {
    File fileValue = (value instanceof ConfigurableFileTree) ? ((ConfigurableFileTree) value).getDir() : (File) value;
    if (!fileValue.exists()) {
        messages.add(String.format("Directory '%s' specified for property '%s' does not exist.", fileValue, propertyName));
    } else if (!fileValue.isDirectory()) {
        messages.add(String.format("Directory '%s' specified for property '%s' is not a directory.", fileValue, propertyName));
    }
}
项目:Reer    文件:DefaultProject.java   
public ConfigurableFileTree fileTree(Object baseDir) {
    return getFileOperations().fileTree(baseDir);
}
项目:Reer    文件:DefaultProject.java   
public ConfigurableFileTree fileTree(Object baseDir, Closure closure) {
    return ConfigureUtil.configure(closure, getFileOperations().fileTree(baseDir));
}
项目:Reer    文件:DefaultProject.java   
public ConfigurableFileTree fileTree(Map<String, ?> args) {
    return getFileOperations().fileTree(args);
}
项目:Reer    文件:DefaultConfigurableFileTree.java   
public ConfigurableFileTree builtBy(Object... tasks) {
    buildDependency.add(tasks);
    return this;
}
项目:Reer    文件:DefaultConfigurableFileTree.java   
public ConfigurableFileTree setBuiltBy(Iterable<?> tasks) {
    buildDependency.setValues(tasks);
    return this;
}
项目:Reer    文件:DefaultScript.java   
@Override
public ConfigurableFileTree fileTree(Object baseDir) {
    return fileOperations.fileTree(baseDir);
}
项目:Reer    文件:DefaultScript.java   
@Override
public ConfigurableFileTree fileTree(Map<String, ?> args) {
    return fileOperations.fileTree(args);
}
项目:Reer    文件:DefaultScript.java   
@Override
public ConfigurableFileTree fileTree(Object baseDir, Closure configureClosure) {
    return ConfigureUtil.configure(configureClosure, fileOperations.fileTree(baseDir));
}
项目:crnk-framework    文件:TSGeneratorPlugin.java   
void setupPackageTasks(Project project, Task generateTask) {
    final File buildDir = new File(project.getBuildDir(), "npm_compile");
    final File distDir = getNpmOutputDir(project);

    project.getTasks().create(PublishTypescriptStubsTask.NAME, PublishTypescriptStubsTask.class);
    TSGeneratorConfig config = project.getExtensions().getByType(TSGeneratorConfig.class);

    Copy copySources = project.getTasks().create("processTypescript", Copy.class);
    copySources.from(config.getGenDir());
    copySources.into(buildDir);
    copySources.dependsOn(generateTask);

    // copy .npmrc file from root to working directory if available
    final File npmrcFile = new File(project.getProjectDir(), ".npmrc");
    if (npmrcFile.exists()) {
        copySources.getInputs().file(npmrcFile);
        copySources.doFirst(new Action<Task>() {
            @Override
            public void execute(Task task) {
                File targetFile = new File(buildDir, ".npmrc");
                buildDir.mkdirs();
                TypescriptUtils.copyFile(npmrcFile, targetFile);
            }
        });
    }

    CompileTypescriptStubsTask compileTypescriptTask = project.getTasks().create(CompileTypescriptStubsTask.NAME,
            CompileTypescriptStubsTask.class);
    try {
        NpmInstallTask npmInstall = (NpmInstallTask) project.getTasks().getByName("npmInstall");
        npmInstall.setWorkingDir(buildDir);
        npmInstall.dependsOn(copySources);
        npmInstall.getInputs().file(new File(buildDir, "package.json"));
        npmInstall.getOutputs().dir(new File(buildDir, "node_modules"));
        compileTypescriptTask.dependsOn(npmInstall);
    }
    catch (UnknownTaskException e) {
        LOGGER.warn("task not found, ok in testing", e);
    }

    ConfigurableFileTree fileTree = project.fileTree(buildDir);
    fileTree.include("package.json");
    fileTree.include(".npmrc");
    fileTree.include("**/*.ts");
    fileTree.exclude("**/*.d.ts");
    compileTypescriptTask.getInputs().files(fileTree);
    compileTypescriptTask.setWorkingDir(buildDir);
    compileTypescriptTask.getOutputs().dir(buildDir);

    ConfigurableFileTree assembleFileTree = project.fileTree(new File(buildDir, "src"));
    assembleFileTree.include("**/*.ts");
    assembleFileTree.include("**/*.js");
    assembleFileTree.include("**/*.js.map");

    Copy assembleSources = project.getTasks().create("assembleTypescript", Copy.class);
    assembleSources.from(assembleFileTree);
    assembleSources.from(new File(buildDir, "package.json"));
    assembleSources.into(distDir);
    assembleSources.dependsOn(compileTypescriptTask);
}
项目:Pushjet-Android    文件:AbstractProject.java   
public ConfigurableFileTree fileTree(Object baseDir) {
    return getFileOperations().fileTree(baseDir);
}
项目:Pushjet-Android    文件:AbstractProject.java   
public ConfigurableFileTree fileTree(Object baseDir, Closure closure) {
    return ConfigureUtil.configure(closure, getFileOperations().fileTree(baseDir));
}
项目:Pushjet-Android    文件:AbstractProject.java   
public ConfigurableFileTree fileTree(Map<String, ?> args) {
    return getFileOperations().fileTree(args);
}
项目:Pushjet-Android    文件:DefaultConfigurableFileTree.java   
public ConfigurableFileTree builtBy(Object... tasks) {
    buildDependency.add(tasks);
    return this;
}
项目:Pushjet-Android    文件:DefaultConfigurableFileTree.java   
public ConfigurableFileTree setBuiltBy(Iterable<?> tasks) {
    buildDependency.setValues(tasks);
    return this;
}
项目:Pushjet-Android    文件:DefaultScript.java   
public ConfigurableFileTree fileTree(Object baseDir) {
    return fileOperations.fileTree(baseDir);
}
项目:Pushjet-Android    文件:DefaultScript.java   
public ConfigurableFileTree fileTree(Map<String, ?> args) {
    return fileOperations.fileTree(args);
}
项目:Pushjet-Android    文件:DefaultScript.java   
public ConfigurableFileTree fileTree(Object baseDir, Closure configureClosure) {
    return ConfigureUtil.configure(configureClosure, fileOperations.fileTree(baseDir));
}
项目:Pushjet-Android    文件:AbstractProject.java   
public ConfigurableFileTree fileTree(Object baseDir) {
    return fileOperations.fileTree(baseDir);
}
项目:Pushjet-Android    文件:AbstractProject.java   
public ConfigurableFileTree fileTree(Object baseDir, Closure closure) {
    return fileOperations.fileTree(baseDir, closure);
}
项目:Pushjet-Android    文件:AbstractProject.java   
public ConfigurableFileTree fileTree(Map<String, ?> args) {
    return fileOperations.fileTree(args);
}
项目:Pushjet-Android    文件:AbstractProject.java   
public ConfigurableFileTree fileTree(Closure closure) {
    DeprecationLogger.nagUserOfDeprecated("fileTree(Closure)", "Use fileTree((Object){ baseDir }) to have the closure used as the file tree base directory");
    return fileOperations.fileTree(closure);
}
项目:Pushjet-Android    文件:FileOperations.java   
@Deprecated
ConfigurableFileTree fileTree(Closure closure);
项目:Pushjet-Android    文件:DefaultConfigurableFileTree.java   
public ConfigurableFileTree builtBy(Object... tasks) {
    buildDependency.add(tasks);
    return this;
}
项目:Pushjet-Android    文件:DefaultConfigurableFileTree.java   
public ConfigurableFileTree setBuiltBy(Iterable<?> tasks) {
    buildDependency.setValues(tasks);
    return this;
}
项目:Pushjet-Android    文件:DefaultScript.java   
public ConfigurableFileTree fileTree(Object baseDir) {
    return fileOperations.fileTree(baseDir);
}
项目:Pushjet-Android    文件:DefaultScript.java   
public ConfigurableFileTree fileTree(Map<String, ?> args) {
    return fileOperations.fileTree(args);
}
项目:Pushjet-Android    文件:DefaultScript.java   
public ConfigurableFileTree fileTree(Closure closure) {
    DeprecationLogger.nagUserOfDeprecated("fileTree(Closure)", "Use fileTree((Object){ baseDir }) to have the closure used as the file tree base directory");
    //noinspection deprecation
    return fileOperations.fileTree(closure);
}
项目:Pushjet-Android    文件:DefaultScript.java   
public ConfigurableFileTree fileTree(Object baseDir, Closure configureClosure) {
    return fileOperations.fileTree(baseDir, configureClosure);
}
项目:gradle-defaults    文件:ExtBintrayPlugin.java   
private static List<String> filesToPluginIds(ConfigurableFileTree filesTree) {
    return stream(filesTree).map(ExtBintrayPlugin::filenameNoExtension).collect(Collectors.<String>toList());
}
项目:gradle-defaults    文件:ExtBintrayPlugin.java   
private static ConfigurableFileTree gradlePluginPropertyFiles(Project project) {
    val filetreeProps = new HashMap<String, String>();
    filetreeProps.put("dir", "src/main/resources/META-INF/gradle-plugins");
    filetreeProps.put("include", "*.properties");
    return project.fileTree(filetreeProps);
}