configuration .getAllDependencies() .stream() .map( dependency -> {
public static Optional<TestEngine> select(Project project) { var configurations = project.getConfigurations(); var testImplementation = configurations.getByName("testImplementation").getDependencies().stream(); var testCompile = configurations.getByName("testCompile").getDependencies().stream(); return Stream.concat(testImplementation, testCompile) .map(d -> TestEngine.select(d.getGroup(), d.getName())) .filter(Optional::isPresent) .map(Optional::get) .findAny(); }
public ParallelWheelGenerationTask() { onlyIf(task -> { ByteArrayOutputStream stdOut = new ByteArrayOutputStream(); getProject().exec(execSpec -> { execSpec.setExecutable(getPythonDetails().getVirtualEnvInterpreter()); execSpec.args(getPythonDetails().getVirtualEnvironment().getPip(), "freeze", "--all"); execSpec.setStandardOutput(stdOut); }); Configuration requiredDependencies = getProject().getConfigurations() .getByName(CONFIGURATION_SETUP_REQS.getValue()); Set<String> setupRequiresDependencies = requiredDependencies.getIncoming().getDependencies().stream() .flatMap(it -> Stream.of(it.getName(), it.getName().replace("-", "_"))) .collect(Collectors.toSet()); Set<String> extraDependencies = Arrays.stream(stdOut.toString().trim().split(System.lineSeparator())) .filter(it -> it.contains("==")).map(it -> it.split("==")[0]) .filter(it -> !setupRequiresDependencies.contains(it)) .collect(Collectors.toSet()); if (!extraDependencies.isEmpty()) { logger.info("Extra dependencies found ({}). Skipping parallel wheel building.", extraDependencies); } return extraDependencies.isEmpty(); }); }
public ParallelWheelGenerationTask() { onlyIf(task -> { ByteArrayOutputStream stdOut = new ByteArrayOutputStream(); getProject().exec(execSpec -> { execSpec.setExecutable(getPythonDetails().getVirtualEnvInterpreter()); execSpec.args(getPythonDetails().getVirtualEnvironment().getPip(), "freeze", "--all"); execSpec.setStandardOutput(stdOut); }); Configuration requiredDependencies = getProject().getConfigurations() .getByName(CONFIGURATION_SETUP_REQS.getValue()); Set<String> setupRequiresDependencies = requiredDependencies.getIncoming().getDependencies().stream() .flatMap(it -> Stream.of(it.getName(), it.getName().replace("-", "_"))) .collect(Collectors.toSet()); Set<String> extraDependencies = Arrays.stream(stdOut.toString().trim().split(System.lineSeparator())) .filter(it -> it.contains("==")).map(it -> it.split("==")[0]) .filter(it -> !setupRequiresDependencies.contains(it)) .collect(Collectors.toSet()); if (!extraDependencies.isEmpty()) { logger.info("Extra dependencies found ({}). Skipping parallel wheel building.", extraDependencies); } return extraDependencies.isEmpty(); }); }
.getByName(DependencyRecommendationsPlugin.NEBULA_RECOMMENDER_BOM) .getAllDependencies() .stream() .map(dep -> dep.getGroup() + ":" + dep.getName()) .collect(Collectors.toSet());
Map<String, Dependency> generators = conjureGeneratorsConfiguration .getAllDependencies() .stream() .collect(Collectors.toMap(dependency -> { Preconditions.checkState(dependency.getName().startsWith(CONJURE_GENERATOR_DEP_PREFIX),
@Override public List<Buildable> call() { return getProject().getConfigurations() .getByName(getTargetConfiguration()) .getAllDependencies().stream() .filter(dependency -> dependency instanceof ProjectDependency) .flatMap(dependency -> { final ProjectDependency projectDependency = (ProjectDependency) dependency; final Project project = projectDependency.getDependencyProject(); final String configurationName = projectDependency.getTargetConfiguration(); return ConfigurationUtils.getConfiguration (project, configurationName) .getAllArtifacts().stream(); }) .collect(Collectors.toList()); } });
@Override protected void applyOnce(Project project) { ProjectDepsExtension extension = project.getExtensions().create(ProjectDepsExtension.NAME, ProjectDepsExtension.class); EclipseProjectPlugin.modifyEclipseProject(project, eclipseModel -> { // find the project's referenced projects and reference them explicitly in the eclipse model Task prepareEclipse = project.task("prepareEclipse"); prepareEclipse.doLast(task -> { Set<String> referencedProjects = eclipseModel.getProject().getReferencedProjects(); project.getConfigurations().stream() .flatMap(config -> config.getDependencies().stream()) .filter(dep -> dep instanceof ProjectDependency) .forEach(dep -> { referencedProjects.add(dep.getName()); }); }); // it's needed for generating the eclipseClasspath and eclipseProject Iterables.getOnlyElement(project.getTasksByName("eclipseClasspath", false)).dependsOn(prepareEclipse); Iterables.getOnlyElement(project.getTasksByName("eclipseProject", false)).dependsOn(prepareEclipse); // create robust classpath entries for all referenced projects eclipseModel.getClasspath().getFile().getXmlTransformer().addAction(xmlProvider -> { modifyClasspath(xmlProvider.asNode(), eclipseModel, extension); }); }); }