本文整理汇总了Java中org.gradle.api.internal.file.UnionFileCollection类的典型用法代码示例。如果您正苦于以下问题:Java UnionFileCollection类的具体用法?Java UnionFileCollection怎么用?Java UnionFileCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnionFileCollection类属于org.gradle.api.internal.file包,在下文中一共展示了UnionFileCollection类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTestResultDirs
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
/**
* 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;
}
示例2: addTo
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
private void addTo(Object result, UnionFileCollection dirs) {
if (result instanceof Test) {
Test test = (Test) result;
dirs.add(getProject().files(test.getBinResultsDir()).builtBy(test));
} else if (result instanceof Iterable<?>) {
Iterable<?> iterable = (Iterable<?>) result;
for (Object nested : iterable) {
addTo(nested, dirs);
}
} else {
dirs.add(getProject().files(result));
}
}
示例3: resolve
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
public FileCollection resolve() {
try {
walker.add(queue);
return new UnionFileCollection(walker.findValues());
} finally {
queue.clear();
}
}
示例4: apply
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
@Override
public void apply(Project project) {
GeneratePluginExtension generatePluginExtension = project.getExtensions().create(EXTENSION_NAME,
GeneratePluginExtension.class, project);
GenerateTask generateTask = project.getTasks().create(TASK_NAME, GenerateTask.class);
generateTask.setGroup(BasePlugin.BUILD_GROUP);
generateTask.setDescription("Generates DDL scripts based on JPA model.");
generateTask.setExtension(generatePluginExtension);
generateTask.dependsOn(JavaBasePlugin.BUILD_TASK_NAME);
project.afterEvaluate(evaluatedProject -> {
fillDefaults(evaluatedProject, generatePluginExtension);
SourceSetContainer sourceSets = (SourceSetContainer) project.getProperties().get("sourceSets");
Set<File> paths;
if (sourceSets != null) {
UnionFileCollection mainClasspath = (UnionFileCollection) sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
paths = mainClasspath.getSources()
.stream()
.filter(fileCollection -> fileCollection instanceof DefaultSourceSetOutput)
.map(DefaultSourceSetOutput.class::cast)
.flatMap(fileCollection -> fileCollection.getClassesDirs().getFiles().stream())
.collect(Collectors.toSet());
} else {
paths = new HashSet<>();
}
generateTask.setOutputClassesDirs(paths);
});
}
示例5: findConfiguraion
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
private Configuration findConfiguraion(FileCollection classpath) {
if (classpath instanceof Configuration) {
return (Configuration) classpath;
} else if (classpath instanceof UnionFileCollection) {
for (FileCollection files : ((UnionFileCollection) classpath).getSources()) {
Configuration configuraion = findConfiguraion(files);
if (configuraion != null) return configuraion;
}
}
return null;
}
示例6: exec
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
/**
* @param project the project on which we'll call {@link Project#javaexec(Action)}.
* @param input the JavaExecable which we'll take as input and call run() on.
* @param settings any extra settings you'd like to set on the JavaExec (e.g. heap)
* @return the JavaExecable after it has had run() called.
*/
public static <T extends JavaExecable> T exec(Project project, T input, Action<JavaExecSpec> settings) throws Throwable {
// copy the classpath from the project's buildscript (and its parents)
List<FileCollection> classpaths = TreeStream.toParent(ProjectPlugin.treeDef(), project)
.map(p -> p.getBuildscript().getConfigurations().getByName(BUILDSCRIPT_CLASSPATH))
.collect(Collectors.toList());
// add the gradleApi, workaround from https://discuss.gradle.org/t/gradle-doesnt-add-the-same-dependencies-to-classpath-when-applying-plugins/9759/6?u=ned_twigg
classpaths.add(project.getConfigurations().detachedConfiguration(project.getDependencies().gradleApi()));
// add stuff from the local classloader too, to fix testkit's classpath
classpaths.add(JavaExecableImp.fromLocalClassloader());
// run it
FileCollection classpath = new UnionFileCollection(classpaths);
return JavaExecableImp.execInternal(input, classpath, settings, execSpec -> JavaExecWinFriendly.javaExec(project, execSpec));
}
示例7: getPublishableFiles
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
public FileCollection getPublishableFiles() {
return new UnionFileCollection(mavenArtifacts.getFiles(), pomFile);
}
示例8: getPublishableFiles
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
public FileCollection getPublishableFiles() {
return new UnionFileCollection(ivyArtifacts.getFiles(), descriptorFile);
}
示例9: getFiles
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
public FileCollection getFiles() {
return new UnionFileCollection(inputFiles, sourceFiles);
}
示例10: createHensonNavigatorGenerationTask
import org.gradle.api.internal.file.UnionFileCollection; //导入依赖的package包/类
/**
* A henson navigator is a class that helps a consumer to consume the navigation api that it
* declares in its dependencies. The henson navigator will wrap the intent builders. Thus, a
* henson navigator, is driven by consumption of intent builders, whereas the henson classes are
* driven by the production of an intent builder.
*
* <p>This task is created per android variant:
*
* <ul>
* <li>we scan the variant compile configuration for navigation api dependencies
* <li>we generate a henson navigator class for this variant that wraps the intent builders
* </ul>
*
* @param variant the variant for which to create a builder.
* @param hensonNavigatorPackageName the package name in which we create the class.
*/
public Task createHensonNavigatorGenerationTask(
BaseVariant variant, String hensonNavigatorPackageName, File destinationFolder) {
Task generateHensonNavigatorTask =
project.getTasks().create("generate" + capitalize(variant.getName()) + "HensonNavigator");
generateHensonNavigatorTask.doFirst(
task -> {
JavaCompile javaCompiler = (JavaCompile) variant.getJavaCompiler();
FileCollection variantCompileClasspath = javaCompiler.getClasspath();
FileCollection uft =
new UnionFileCollection(
javaCompiler.getSource(), project.fileTree(destinationFolder));
javaCompiler.setSource(uft);
logger.debug("Analyzing configuration: " + variantCompileClasspath.getFiles());
Set<String> targetActivities = new HashSet<>();
Streams.stream(variantCompileClasspath)
.forEach(
dependency -> {
logger.debug("Detected dependency: {}", dependency.getName());
if (dependency.getName().matches("classes.jar")) {
logger.debug("Detected navigation API dependency: {}", dependency.getName());
File file = dependency.getAbsoluteFile();
List<String> entries = getJarContent(file);
entries.forEach(
entry -> {
if (entry.matches(".*__IntentBuilder.class")) {
logger.debug("Detected intent builder: {}", entry);
String targetActivityFQN =
entry
.substring(
0, entry.length() - "__IntentBuilder.class".length())
.replace('/', '.');
targetActivities.add(targetActivityFQN);
}
});
}
String hensonNavigator =
hensonNavigatorGenerator.generateHensonNavigatorClass(
targetActivities, hensonNavigatorPackageName);
destinationFolder.mkdirs();
String generatedFolderName =
hensonNavigatorPackageName.replace('.', '/').concat("/");
File generatedFolder = new File(destinationFolder, generatedFolderName);
generatedFolder.mkdirs();
File generatedFile = new File(generatedFolder, "HensonNavigator.java");
try {
logger.debug(
"Generating Henson navigator in " + generatedFile.getAbsolutePath());
logger.debug(hensonNavigator);
Files.write(generatedFile.toPath(), singletonList(hensonNavigator));
} catch (IOException e) {
throw new RuntimeException(e);
}
});
});
//we put the task right before compilation so that all dependencies are resolved
// when the task is executed
generateHensonNavigatorTask.setDependsOn(variant.getJavaCompiler().getDependsOn());
variant.getJavaCompiler().dependsOn(generateHensonNavigatorTask);
return generateHensonNavigatorTask;
}