本文整理匯總了Java中org.gradle.api.file.FileCollection類的典型用法代碼示例。如果您正苦於以下問題:Java FileCollection類的具體用法?Java FileCollection怎麽用?Java FileCollection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FileCollection類屬於org.gradle.api.file包,在下文中一共展示了FileCollection類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createInstallTask
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
public static void createInstallTask(final NativeBinarySpecInternal binary, final NativeInstallationSpec installation, final NativeExecutableFileSpec executable, final BinaryNamingScheme namingScheme) {
binary.getTasks().create(namingScheme.getTaskName("install"), InstallExecutable.class, new Action<InstallExecutable>() {
@Override
public void execute(InstallExecutable installTask) {
installTask.setDescription("Installs a development image of " + binary.getDisplayName());
installTask.setGroup(LifecycleBasePlugin.BUILD_GROUP);
installTask.setToolChain(executable.getToolChain());
installTask.setPlatform(binary.getTargetPlatform());
installTask.setExecutable(executable.getFile());
installTask.setDestinationDir(installation.getDirectory());
//TODO:HH wire binary libs via executable
installTask.lib(new BinaryLibs(binary) {
@Override
protected FileCollection getFiles(NativeDependencySet nativeDependencySet) {
return nativeDependencySet.getRuntimeFiles();
}
});
//TODO:HH installTask.dependsOn(executable)
installTask.dependsOn(binary);
}
});
}
示例2: convertInto
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
public void convertInto(Object element, Collection<? super MinimalFileCollection> result, PathToFileResolver 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)));
}
}
示例3: execute
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
public void execute(FileCollection classpath, final FileCollection executionData, final File destinationFile) {
ant.withClasspath(classpath).execute(new Closure<Object>(this, this) {
@SuppressWarnings("UnusedDeclaration")
public Object doCall(Object it) {
final GroovyObjectSupport antBuilder = (GroovyObjectSupport) it;
antBuilder.invokeMethod("taskdef", ImmutableMap.of(
"name", "jacocoMerge",
"classname", "org.jacoco.ant.MergeTask"
));
Map<String, File> arguments = ImmutableMap.of("destfile", destinationFile);
antBuilder.invokeMethod("jacocoMerge", new Object[]{arguments, new Closure<Object>(this, this) {
public Object doCall(Object ignore) {
executionData.addToAntBuilder(antBuilder, "resources");
return null;
}
}});
return null;
}
});
}
示例4: execute
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
@Override
public void execute() {
ImmutableMap.Builder<String, Object> options = ImmutableMap.builder();
options.put("destDir", getDestinationDir());
options.putAll(compileOptions.getDependOptions().optionMap());
if (compileOptions.getDependOptions().isUseCache()) {
options.put("cache", dependencyCacheDir);
}
final AntBuilder ant = antBuilderFactory.create();
ant.getProject().addTaskDefinition("gradleDepend", AntDepend.class);
ant.invokeMethod("gradleDepend", new Object[]{options.build(), new Closure<Object>(this, this) {
@SuppressWarnings("UnusedDeclaration")
public void doCall(Object ignore) {
getSource().addToAntBuilder(ant, "src", FileCollection.AntType.MatchingTask);
}
}});
}
示例5: registerWatchPoints
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
@Override
public void registerWatchPoints(FileSystemSubset.Builder builder) {
for (Dependency dependency : allDependencies) {
if (dependency instanceof FileCollectionDependency) {
FileCollection files = ((FileCollectionDependency) dependency).getFiles();
((FileCollectionInternal) files).registerWatchPoints(builder);
}
}
super.registerWatchPoints(builder);
}
示例6: add
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
@Override
public UnionFileTree add(FileCollection source) {
if (!(source instanceof FileTree)) {
throw new UnsupportedOperationException(String.format("Can only add FileTree instances to %s.", getDisplayName()));
}
sourceTrees.add(Cast.cast(FileTreeInternal.class, source));
return this;
}
示例7: isEmpty
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
@Override
public boolean isEmpty() {
for (FileCollection collection : getSourceCollections()) {
if (!collection.isEmpty()) {
return false;
}
}
return true;
}
示例8: fixed
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
@Override
public FileCollection fixed(final String displayName, File... files) {
return new FileCollectionAdapter(new ListBackedFileSet(files) {
@Override
public String getDisplayName() {
return displayName;
}
});
}
示例9: execute
import org.gradle.api.file.FileCollection; //導入依賴的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));
}
示例10: getFilesToSign
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
/**
* All of the files that will be signed by this operation.
*/
public FileCollection getFilesToSign() {
return newSignatureFileCollection(new Function<Signature, File>() {
@Override
public File apply(Signature input) {
return input.getToSign();
}
});
}
示例11: createWorkerProcess
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
private FindBugsWorker createWorkerProcess(File workingDir, WorkerProcessFactory workerFactory, FileCollection findBugsClasspath, FindBugsSpec spec) {
SingleRequestWorkerProcessBuilder<FindBugsWorker> builder = workerFactory.singleRequestWorker(FindBugsWorker.class, FindBugsExecuter.class);
builder.setBaseName("Gradle FindBugs Worker");
builder.applicationClasspath(findBugsClasspath);
builder.sharedPackages(Arrays.asList("edu.umd.cs.findbugs"));
JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
javaCommand.setWorkingDir(workingDir);
javaCommand.setMaxHeapSize(spec.getMaxHeapSize());
return builder.build();
}
示例12: doResolve
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
private <T> List<T> doResolve(Converter<? extends T> converter) {
List<T> result = new ArrayList<T>();
while (!queue.isEmpty()) {
Object element = queue.remove(0);
// TODO - need to sync with BuildDependenciesOnlyFileCollectionResolveContext
if (element instanceof DefaultFileCollectionResolveContext) {
DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element;
converter.convertInto(nestedContext, result, fileResolver);
} else if (element instanceof FileCollectionContainer) {
FileCollectionContainer fileCollection = (FileCollectionContainer) element;
resolveNested(fileCollection, result, converter);
} else if (element instanceof FileCollection || element instanceof MinimalFileCollection) {
converter.convertInto(element, result, fileResolver);
} else if (element instanceof Task) {
Task task = (Task) element;
queue.add(0, task.getOutputs().getFiles());
} else if (element instanceof TaskOutputs) {
TaskOutputs outputs = (TaskOutputs) element;
queue.add(0, outputs.getFiles());
} else if (element instanceof Callable) {
Callable callable = (Callable) element;
Object callableResult = uncheckedCall(callable);
if (callableResult != null) {
queue.add(0, callableResult);
}
} else if (element instanceof Iterable) {
Iterable<?> iterable = (Iterable) element;
GUtil.addToCollection(queue.subList(0, 0), iterable);
} else if (element instanceof Object[]) {
Object[] array = (Object[]) element;
GUtil.addToCollection(queue.subList(0, 0), Arrays.asList(array));
} else {
converter.convertInto(element, result, fileResolver);
}
}
return result;
}
示例13: configureWithJavaPluginApplied
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
private void configureWithJavaPluginApplied(final Project project, final EarPluginConvention earPluginConvention, PluginContainer plugins) {
plugins.withType(JavaPlugin.class, new Action<JavaPlugin>() {
public void execute(JavaPlugin javaPlugin) {
final JavaPluginConvention javaPluginConvention = project.getConvention().findPlugin(JavaPluginConvention.class);
SourceSet sourceSet = javaPluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
sourceSet.getResources().srcDir(new Callable() {
public Object call() throws Exception {
return earPluginConvention.getAppDirName();
}
});
project.getTasks().withType(Ear.class, new Action<Ear>() {
public void execute(final Ear task) {
task.dependsOn(new Callable<FileCollection>() {
public FileCollection call() throws Exception {
return javaPluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME)
.getRuntimeClasspath();
}
});
task.from(new Callable<FileCollection>() {
public FileCollection call() throws Exception {
return javaPluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput();
}
});
}
});
}
});
}
示例14: apply
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
public void apply(Project project) {
project.getPluginManager().apply(JavaScriptBasePlugin.class);
JavaScriptExtension jsExtension = project.getExtensions().findByType(JavaScriptExtension.class);
final RhinoExtension rhinoExtension = ((ExtensionAware) jsExtension).getExtensions().create(RhinoExtension.NAME, RhinoExtension.class);
final Configuration configuration = addClasspathConfiguration(project.getConfigurations());
configureDefaultRhinoDependency(configuration, project.getDependencies(), rhinoExtension);
ConventionMapping conventionMapping = ((IConventionAware) rhinoExtension).getConventionMapping();
conventionMapping.map("classpath", new Callable<Configuration>() {
public Configuration call() {
return configuration;
}
});
conventionMapping.map("version", new Callable<String>() {
public String call() {
return RhinoExtension.DEFAULT_RHINO_DEPENDENCY_VERSION;
}
});
project.getTasks().withType(RhinoShellExec.class, new Action<RhinoShellExec>() {
public void execute(RhinoShellExec task) {
task.getConventionMapping().map("classpath", new Callable<FileCollection>() {
public FileCollection call() {
return rhinoExtension.getClasspath();
}
});
task.getConventionMapping().map("main", new Callable<String>() {
public String call() {
return RhinoExtension.RHINO_SHELL_MAIN;
}
});
task.setClasspath(rhinoExtension.getClasspath());
}
});
}
示例15: createScalaSdkFromPlatform
import org.gradle.api.file.FileCollection; //導入依賴的package包/類
private static ProjectLibrary createScalaSdkFromPlatform(ScalaPlatform platform, FileCollection scalaClasspath, boolean useScalaSdk) {
String version = platform.getScalaVersion();
if (useScalaSdk) {
return createScalaSdkLibrary("scala-sdk-" + version, scalaClasspath);
}
return createProjectLibrary("scala-compiler-" + version, scalaClasspath);
}