private List<ModuleDependency> getVersionedModuleDependencies(Configuration configuration) { List<ModuleDependency> versionedModuleDependencies = new ArrayList<ModuleDependency>(); for (Dependency dependency : configuration.getIncoming().getDependencies()) { if (dependency instanceof ModuleDependency && dependency.getVersion() != null) { versionedModuleDependencies.add((ModuleDependency) dependency); } } return versionedModuleDependencies; }
private void applyMavenExclusions(ResolvableDependencies resolvableDependencies) { Set<DependencyCandidate> excludedDependencies = findExcludedDependencies(); if (logger.isInfoEnabled()) { logger.info("Excluding " + excludedDependencies); } List<Map<String, String>> exclusions = new ArrayList<Map<String, String>>(); for (DependencyCandidate excludedDependency : excludedDependencies) { Map<String, String> exclusion = new HashMap<String, String>(); exclusion.put("group", excludedDependency.groupId); exclusion.put("module", excludedDependency.artifactId); exclusions.add(exclusion); } for (org.gradle.api.artifacts.Dependency dependency : resolvableDependencies.getDependencies()) { if (dependency instanceof ModuleDependency) { for (Map<String, String> exclusion : exclusions) { ((ModuleDependency) dependency).exclude(exclusion); } } } }
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(); }); }
private Set<GradleLibrary> getLibrariesForFileDependencies(Configuration configuration, LibraryScope scope) { Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>(); for (Dependency dependency : configuration.getIncoming().getDependencies()) { if (dependency instanceof FileCollectionDependency) { FileCollectionDependency fileDependency = (FileCollectionDependency) dependency; for (File file : fileDependency.resolve()) { libraries.add(new GradleLibrary(fileDependency.getGroup(), file, scope)); } } else if (dependency instanceof ProjectDependency) { ProjectDependency projectDependency = (ProjectDependency) dependency; libraries.addAll(getLibrariesForFileDependencies(projectDependency.getProjectConfiguration(), scope)); } } return libraries; }
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(); }); }
for (Dependency dep : config.getIncoming().getDependencies())