.map( dep -> { if (dep.getVersion() == null || dep.getVersion().length() == 0) { return String.format("%s-%s", dep.getGroup(), dep.getName()); } else { return String.format( "%s-%s-%s", dep.getGroup(), dep.getName(), dep.getVersion()); .filter( dep -> dep.getGroup() != null && dep.getGroup().equals(AnnotationProcessorCache.AUTO_VALUE_GROUP) && dep.getName().equals(AnnotationProcessorCache.AUTO_VALUE_NAME)) .map( dep -> String.format("%s-%s-%s", dep.getGroup(), dep.getName(), dep.getVersion())) .findAny();
@Override public boolean isSatisfiedBy(Dependency element) { return element.getName().equals(GROUP_FG); } }), null);
if (!dependency.getVersion().equals(projectDependency.getVersion())) { getLogger().error( "Version '{}' of local project '{}' does not match version '{}' specified in build file '{}'", projectDependency.getVersion(), projectDependency.getName(), dependency.getVersion(), project.getRootProject().relativePath(project.getBuildFile()));
public GolangDependency(@Nonnull Dependency raw) { if (raw instanceof GolangDependency) { final GolangDependency original = (GolangDependency) raw; setGroup(original.getGroup()); setVersion(original.getVersion()); setRepositoryUri(original.getRepositoryUri()); setRepositoryType(original.getRepositoryType()); setUpdatePolicy(original.getUpdatePolicy()); } else { setGroup(raw.getGroup()); setVersion(raw.getVersion()); } }
/** * Provide a string key for a dependency artifact * * @param dependency Dependency the artifact belongs to * @param artifact Artifact to provide key for * @return Module key */ protected String moduleKey(Dependency dependency, DependencyArtifact artifact) { String key = Objects.requireNonNull(ARTIFACT_JOINER.join(dependency.getGroup(), artifact.getName(), artifact.getType(), artifact.getExtension(), Strings.emptyToNull(artifact.getClassifier()))); return key; }
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; }
@Override public boolean isSatisfiedBy(Dependency element) { return element.contentEquals(fgDep); } })));
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 static Configuration dependenciesWithinProjectGroup(final Configuration testCompile, final Project project) { return testCompile.copyRecursive(dep -> isInSameGroup(dep.getGroup(), project)); }
private static VersionNumber retrolambdaVersion(Configuration retrolambdaConfig) { retrolambdaConfig.resolve(); Dependency retrolambdaDep = retrolambdaConfig.getDependencies().iterator().next(); if (retrolambdaDep.getVersion() == null) { // Don't know version return null; } return VersionNumber.parse(retrolambdaDep.getVersion()); }
@Override public void inspectDependency(Dependency dependency) { if (dependency.getVersion() != null && !dependency.getVersion().isEmpty()) { firstOrderDepsWithVersions.add(dependency.getGroup() + ":" + dependency.getName()); } }
private boolean isDirectDependency(DependencyResolveDetails details) { if (this.directDependencies == null) { Set<String> directDependencies = new HashSet<String>(); for (Dependency dependency : this.configuration.getAllDependencies()) { directDependencies.add(dependency.getGroup() + ":" + dependency.getName()); } this.directDependencies = directDependencies; } return this.directDependencies.contains(details.getRequested().getGroup() + ":" + details.getRequested().getName()); }
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 void clearJavaFXDependencies() { var implementationConfiguration = project.getConfigurations().findByName("implementation"); if (implementationConfiguration != null) { implementationConfiguration.getDependencies() .removeIf(dependency -> MAVEN_JAVAFX_ARTIFACT_GROUP_ID.equals(dependency.getGroup())); } } }
/** * Format a dependency for printing * * @param dependency Dependency to format * @return Dependency information for printing */ private String formatDependency(Dependency dependency) { @NonNull String info; if (dependency instanceof SelfResolvingDependency) { SelfResolvingDependency selfResolvingDependency = (SelfResolvingDependency) dependency; info = Validate.notNull(Joiner.on(", ").join(selfResolvingDependency.resolve())); } else { info = dependency.getGroup() + ":" + dependency.getName() + ":" + dependency.getVersion(); } return info; } }
public String getArtifactWithVersion(String groupId, String artifactId, String configurationName) { final ResolvedConfiguration resolvedConfiguration = configurations.getByName( configurationName ).getResolvedConfiguration(); resolvedConfiguration.rethrowFailure(); final LenientConfiguration lenientConfiguration = resolvedConfiguration.getLenientConfiguration(); final Optional<ResolvedDependency> dependency = lenientConfiguration. getFirstLevelModuleDependencies( d -> ( d.getGroup().equals( groupId ) && d.getName().equals( artifactId ) ) ) .stream() .findFirst(); return dependency.get().getModuleVersion(); }
.stream() .collect(Collectors.toMap(dependency -> { Preconditions.checkState(dependency.getName().startsWith(CONJURE_GENERATOR_DEP_PREFIX), "Generators should start with '%s' according to conjure RFC 002, " + "but found name: '%s' (%s)", CONJURE_GENERATOR_DEP_PREFIX, dependency.getName(), dependency); return dependency.getName().substring(CONJURE_GENERATOR_DEP_PREFIX.length()); }, Function.identity())); dep -> dep.getName().equals(CONJURE_GENERATOR_DEP_PREFIX + subprojectName));
/** * Format a dependency for printing * * @param dependency Dependency to format * @return Dependency information for printing */ private String formatDependency(Dependency dependency) { @NonNull String info; if (dependency instanceof SelfResolvingDependency) { SelfResolvingDependency selfResolvingDependency = (SelfResolvingDependency) dependency; info = Validate.notNull(Joiner.on(", ").join(selfResolvingDependency.resolve())); } else { info = dependency.getGroup() + ":" + dependency.getName() + ":" + dependency.getVersion(); } return info; } }