org.gradle.api.internal.file.UnionFileCollection Java Examples

The following examples show how to use org.gradle.api.internal.file.UnionFileCollection. 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 File: ResolveJavadocLinks.java    From gradle-plugins with MIT License 6 votes vote down vote up
private Stream<Configuration> findConfigurations(FileCollection classpath) {
    if (classpath instanceof Configuration) {
        return Stream.of((Configuration) classpath);
    }
    else if (classpath instanceof UnionFileCollection) {
        return ((UnionFileCollection) classpath).getSources()
                .stream()
                .flatMap(this::findConfigurations);
    }
    else if (classpath instanceof ConfigurableFileCollection) {
        return ((ConfigurableFileCollection) classpath).getFrom()
                .stream()
                .flatMap(this::findConfigurations);

    }
    return Stream.empty();
}
 
Example #2
Source File: ResolveJavadocLinks.java    From gradle-plugins with MIT License 6 votes vote down vote up
private Stream<Configuration> findConfigurations(FileCollection classpath) {
    if (classpath instanceof Configuration) {
        return Stream.of((Configuration) classpath);
    }
    else if (classpath instanceof UnionFileCollection) {
        return ((UnionFileCollection) classpath).getSources()
                .stream()
                .flatMap(this::findConfigurations);
    }
    else if (classpath instanceof ConfigurableFileCollection) {
        return ((ConfigurableFileCollection) classpath).getFrom()
                .stream()
                .flatMap(this::findConfigurations);

    }
    return Stream.empty();
}
 
Example #3
Source File: GeneratePlugin.java    From jpa2ddl with Apache License 2.0 6 votes vote down vote up
@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.getFiles();
		} else {
			paths = new HashSet<>();
		}
		generateTask.setOutputClassesDirs(paths);
	});
}
 
Example #4
Source File: TestReport.java    From pushfish-android with 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 #5
Source File: TestReport.java    From Pushjet-Android with 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 #6
Source File: CachingDependencyResolveContext.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public FileCollection resolve() {
    try {
        walker.add(queue);
        return new UnionFileCollection(walker.findValues());
    } finally {
        queue.clear();
    }
}
 
Example #7
Source File: TestReport.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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));
    }
}
 
Example #8
Source File: TestReport.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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));
    }
}
 
Example #9
Source File: CachingDependencyResolveContext.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public FileCollection resolve() {
    try {
        walker.add(queue);
        return new UnionFileCollection(walker.findValues());
    } finally {
        queue.clear();
    }
}
 
Example #10
Source File: CachingDependencyResolveContext.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public FileCollection resolve() {
    try {
        walker.add(queue);
        return new UnionFileCollection(walker.findValues());
    } finally {
        queue.clear();
    }
}
 
Example #11
Source File: TestReport.java    From Pushjet-Android with 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 #12
Source File: TestReport.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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));
    }
}
 
Example #13
Source File: TestReport.java    From pushfish-android with 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 #14
Source File: CachingDependencyResolveContext.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public FileCollection resolve() {
    try {
        walker.add(queue);
        return new UnionFileCollection(walker.findValues());
    } finally {
        queue.clear();
    }
}
 
Example #15
Source File: TestReport.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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));
    }
}
 
Example #16
Source File: DefaultTaskInputs.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getFiles() {
    return new UnionFileCollection(inputFiles, sourceFiles);
}
 
Example #17
Source File: GenerateHensonNavigatorTask.java    From dart with Apache License 2.0 4 votes vote down vote up
@TaskAction
public void generateHensonNavigator() {
  TaskProvider<JavaCompile> javaCompiler = variant.getJavaCompileProvider();
  FileCollection variantCompileClasspath = getJarDependencies();
  FileCollection uft =
      new UnionFileCollection(
          javaCompiler.get().getSource(), project.fileTree(destinationFolder));
  javaCompiler.get().setSource(uft);
  logger.debug("Analyzing configuration: " + variantCompileClasspath.getFiles());
  Set<String> targetActivities = new HashSet<>();
  Streams.stream(variantCompileClasspath)
      .forEach(
          dependency -> {
            logger.debug("Detected dependency: {}", dependency.getAbsolutePath());
            if (dependency.getName().endsWith(".jar")) {
              logger.debug("Detected navigation API dependency: {}", dependency.getName());
              if (!dependency.exists()) {
                logger.debug("Dependency jar doesn't exist {}", dependency.getAbsolutePath());
              } else {
                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 = getHensonNavigatorSourceFile();
  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);
  }
}
 
Example #18
Source File: DefaultIvyPublication.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getPublishableFiles() {
    return new UnionFileCollection(ivyArtifacts.getFiles(), descriptorFile);
}
 
Example #19
Source File: DefaultMavenPublication.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getPublishableFiles() {
    return new UnionFileCollection(mavenArtifacts.getFiles(), pomFile);
}
 
Example #20
Source File: DefaultMavenPublication.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getPublishableFiles() {
    return new UnionFileCollection(mavenArtifacts.getFiles(), pomFile);
}
 
Example #21
Source File: DefaultTaskInputs.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getFiles() {
    return new UnionFileCollection(inputFiles, sourceFiles);
}
 
Example #22
Source File: DefaultIvyPublication.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getPublishableFiles() {
    return new UnionFileCollection(ivyArtifacts.getFiles(), descriptorFile);
}
 
Example #23
Source File: DefaultMavenPublication.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getPublishableFiles() {
    return new UnionFileCollection(mavenArtifacts.getFiles(), pomFile);
}
 
Example #24
Source File: DefaultTaskInputs.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getFiles() {
    return new UnionFileCollection(inputFiles, sourceFiles);
}
 
Example #25
Source File: DefaultIvyPublication.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getPublishableFiles() {
    return new UnionFileCollection(ivyArtifacts.getFiles(), descriptorFile);
}
 
Example #26
Source File: DefaultMavenPublication.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getPublishableFiles() {
    return new UnionFileCollection(mavenArtifacts.getFiles(), pomFile);
}
 
Example #27
Source File: DefaultTaskInputs.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getFiles() {
    return new UnionFileCollection(inputFiles, sourceFiles);
}
 
Example #28
Source File: DefaultIvyPublication.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FileCollection getPublishableFiles() {
    return new UnionFileCollection(ivyArtifacts.getFiles(), descriptorFile);
}