本文整理汇总了Java中org.gradle.api.file.ConfigurableFileTree类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableFileTree类的具体用法?Java ConfigurableFileTree怎么用?Java ConfigurableFileTree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurableFileTree类属于org.gradle.api.file包,在下文中一共展示了ConfigurableFileTree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAwSourceOutputDir
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
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();
}
示例2: findBukkitBuildToRun
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
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;
}
示例3: validate
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
@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));
}
}
示例4: execute
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
@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));
}
示例5: filesFor
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
private FileCollection filesFor(final Algorithm algo) {
return getProject().fileTree(getOutputDir(), new Action<ConfigurableFileTree>() {
@Override
public void execute(ConfigurableFileTree files) {
files.include("**/*." + algo.toString().toLowerCase());
}
});
}
示例6: Parser
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
/**
* 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();
}
示例7: getSassFiles
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
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;
}
示例8: getInputFiles
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
@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;
}
示例9: validate
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
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));
}
}
示例10: fileTree
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
public ConfigurableFileTree fileTree(Object baseDir) {
return getFileOperations().fileTree(baseDir);
}
示例11: builtBy
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
public ConfigurableFileTree builtBy(Object... tasks) {
buildDependency.add(tasks);
return this;
}
示例12: setBuiltBy
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
public ConfigurableFileTree setBuiltBy(Iterable<?> tasks) {
buildDependency.setValues(tasks);
return this;
}
示例13: fileTree
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
@Override
public ConfigurableFileTree fileTree(Object baseDir) {
return fileOperations.fileTree(baseDir);
}
示例14: setupPackageTasks
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
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);
}
示例15: fileTree
import org.gradle.api.file.ConfigurableFileTree; //导入依赖的package包/类
public ConfigurableFileTree fileTree(Object baseDir) {
return fileOperations.fileTree(baseDir);
}