/** * Adds an exact dependency to the give package if it is not already contained in the given list. * @param deps the original dependencies * @param id the id to add * @return the new array of dependencies, or {@code deps} if nothing changed. */ public static Dependency[] addExact(@Nonnull Dependency[] deps, @Nonnull PackageId id) { if (matches(deps, id)) { return deps; } Dependency[] newDeps = new Dependency[deps.length + 1]; System.arraycopy(deps, 0, newDeps, 0, deps.length); newDeps[deps.length] = new Dependency(id); return newDeps; }
/** * Resolves a list of resolutions respecting their internal dependency references. * @param list list of resolutions * @return a new list of resolutions * @throws CyclicDependencyException if a cyclic dependency is detected */ public static List<PackageId> resolve(Map<PackageId, Dependency[]> list) throws CyclicDependencyException { // create fake deplist Dependency[] fake = new Dependency[list.size()]; int i=0; for (Map.Entry<PackageId, Dependency[]> entry: list.entrySet()) { fake[i++] = new Dependency(entry.getKey()); } Map<PackageId, Boolean> result = new LinkedHashMap<PackageId, Boolean>(list.size()); resolve(fake, list, result); return new ArrayList<PackageId>(result.keySet()); }
range = segs[2]; return new Dependency(groupId, name, range == null ? null : VersionRange.fromString(range));
Dependency autoDependency = hasOwnContent ? new Dependency(pkg.getId()) : null; registerSubPackages(pkg, packagesRoot, DEFAULT_PACKAGE_ROOT_PATH, replace, subpackages, autoDependency); dispatch(Type.EXTRACT_SUB_PACKAGES, pkg.getId(), subpackages.keySet().toArray(new PackageId[subpackages.size()]));