public List<ModuleIdentifier> getExcludedModules() { Element exclusionsElement = getFirstChildElement(depElement, EXCLUSIONS); if (exclusionsElement != null) { NodeList childs = exclusionsElement.getChildNodes(); List<ModuleIdentifier> exclusions = Lists.newArrayList(); for (int i = 0; i < childs.getLength(); i++) { Node node = childs.item(i); if (node instanceof Element && EXCLUSION.equals(node.getNodeName())) { String groupId = getFirstChildText((Element) node, GROUP_ID); String artifactId = getFirstChildText((Element) node, ARTIFACT_ID); if ((groupId != null) && (artifactId != null)) { exclusions.add(DefaultModuleIdentifier.newId(groupId, artifactId)); } } } return exclusions; } return Collections.emptyList(); }
private ProjectComponentIdentifier getReplacementFor(ModuleComponentSelector selector) { ModuleIdentifier candidateId = DefaultModuleIdentifier.newId(selector.getGroup(), selector.getModule()); Collection<ProjectComponentIdentifier> providingProjects = replacementMap.get(candidateId); if (providingProjects.isEmpty()) { LOGGER.info("Found no composite build substitute for module '" + candidateId + "'."); return null; } if (providingProjects.size() == 1) { ProjectComponentIdentifier match = providingProjects.iterator().next(); LOGGER.info("Found project '" + match + "' as substitute for module '" + candidateId + "'."); return match; } SortedSet<String> sortedProjects = Sets.newTreeSet(CollectionUtils.collect(providingProjects, new Transformer<String, ProjectComponentIdentifier>() { @Override public String transform(ProjectComponentIdentifier projectComponentIdentifier) { return projectComponentIdentifier.getDisplayName(); } })); String failureMessage = String.format("Module version '%s' is not unique in composite: can be provided by %s.", selector.getDisplayName(), sortedProjects); throw new ModuleVersionResolveException(selector, failureMessage); }
public void listModuleVersions(DependencyMetaData dependency, BuildableModuleVersionSelectionResolveResult result) { ModuleIdentifier module = new DefaultModuleIdentifier(dependency.getRequested().getGroup(), dependency.getRequested().getName()); VersionList versionList = versionLister.getVersionList(module); // List modules based on metadata files ModuleVersionArtifactMetaData metaDataArtifact = getMetaDataArtifactFor(dependency); listVersionsForAllPatterns(getIvyPatterns(), metaDataArtifact, versionList); // List modules with missing metadata files if (isAllownomd()) { for (ModuleVersionArtifactMetaData otherArtifact : getDefaultMetaData(dependency).getArtifacts()) { listVersionsForAllPatterns(getArtifactPatterns(), otherArtifact, versionList); } } DefaultModuleVersionListing moduleVersions = new DefaultModuleVersionListing(); for (VersionList.ListedVersion listedVersion : versionList.getVersions()) { moduleVersions.add(listedVersion.getVersion()); } result.listed(moduleVersions); }
public ModuleForcingResolveRule(Collection<? extends ModuleVersionSelector> forcedModules) { if (!forcedModules.isEmpty()) { this.forcedModules = new HashMap<ModuleIdentifier, String>(); for (ModuleVersionSelector module : forcedModules) { this.forcedModules.put(new DefaultModuleIdentifier(module.getGroup(), module.getName()), module.getVersion()); } } else { this.forcedModules = null; } }
@Override public void execute(DependencySubstitutionInternal details) { if (forcedModules == null) { return; } ModuleIdentifier key = new DefaultModuleIdentifier(details.getOldRequested().getGroup(), details.getOldRequested().getName()); if (forcedModules.containsKey(key) && details.getRequested() instanceof ModuleComponentSelector) { details.useTarget(DefaultModuleComponentSelector.newSelector(key.getGroup(), key.getName(), forcedModules.get(key)), VersionSelectionReasons.FORCED); } }
private boolean isExcluded(ModuleExclusion selector, DependencyMetadata dependency) { if (!resolveState.edgeFilter.isSatisfiedBy(dependency)) { LOGGER.debug("{} is filtered.", dependency); return true; } ModuleIdentifier targetModuleId = DefaultModuleIdentifier.newId(dependency.getRequested().getGroup(), dependency.getRequested().getName()); if (selector.excludeModule(targetModuleId)) { LOGGER.debug("{} is excluded from {}.", targetModuleId, this); return true; } return false; }
private void doListModuleVersions(DependencyMetadata dependency, BuildableModuleVersionListingResolveResult result) { ModuleIdentifier module = new DefaultModuleIdentifier(dependency.getRequested().getGroup(), dependency.getRequested().getName()); Set<String> versions = new LinkedHashSet<String>(); VersionPatternVisitor visitor = versionLister.newVisitor(module, versions, result); // List modules based on metadata files (artifact version is not considered in listVersionsForAllPatterns()) IvyArtifactName metaDataArtifact = getMetaDataArtifactName(dependency.getRequested().getName()); listVersionsForAllPatterns(ivyPatterns, metaDataArtifact, visitor); // List modules with missing metadata files for (IvyArtifactName otherArtifact : getDependencyArtifactNames(dependency.getRequested().getName(), dependency.getArtifacts())) { listVersionsForAllPatterns(artifactPatterns, otherArtifact, visitor); } result.listed(versions); }
private ModuleIdentifier getModuleIdentifier(RenderableDependency renderableDependency) { if (renderableDependency.getId() instanceof ModuleComponentIdentifier) { ModuleComponentIdentifier id = (ModuleComponentIdentifier) renderableDependency.getId(); return new DefaultModuleIdentifier(id.getGroup(), id.getModule()); } return null; }
private Map<ModuleIdentifier, String> getAwbDependencies(String awb) { ParsedModuleStringNotation parsedNotation = new ParsedModuleStringNotation(awb); String group = parsedNotation.getGroup(); String name = parsedNotation.getName(); ModuleIdentifier moduleIdentifier = DefaultModuleIdentifier.newId(group, name); Map<ModuleIdentifier, String> awbDependencies = mAwbDependenciesMap.get(moduleIdentifier); if (awbDependencies == null) { awbDependencies = Maps.newHashMap(); mAwbDependenciesMap.put(moduleIdentifier, awbDependencies); } return awbDependencies; }
private void addDependency(String dependencyString, Map<ModuleIdentifier, String> awb) { ParsedModuleStringNotation parsedNotation = new ParsedModuleStringNotation(dependencyString); ModuleIdentifier moduleIdentifier = DefaultModuleIdentifier.newId(parsedNotation.getGroup(), parsedNotation.getName()); String version = parsedNotation.getVersion(); awb.put(moduleIdentifier, version); mFlatDependenciesMap.put(moduleIdentifier, version); }
public void execute(DependencyResolveDetailsInternal details) { if (forcedModules == null) { return; } ModuleIdentifier key = new DefaultModuleIdentifier(details.getRequested().getGroup(), details.getRequested().getName()); if (forcedModules.containsKey(key)) { details.useVersion(forcedModules.get(key), VersionSelectionReasons.FORCED); } }
private void doListModuleVersions(DependencyMetaData dependency, BuildableModuleComponentVersionSelectionResolveResult result) { ModuleIdentifier module = new DefaultModuleIdentifier(dependency.getRequested().getGroup(), dependency.getRequested().getName()); Set<String> versions = new LinkedHashSet<String>(); VersionPatternVisitor visitor = versionLister.newVisitor(module, versions, result); // List modules based on metadata files (artifact version is not considered in listVersionsForAllPatterns()) IvyArtifactName metaDataArtifact = getMetaDataArtifactName(dependency.getRequested().getName()); listVersionsForAllPatterns(ivyPatterns, metaDataArtifact, visitor); // List modules with missing metadata files for (IvyArtifactName otherArtifact : getDependencyArtifactNames(dependency)) { listVersionsForAllPatterns(artifactPatterns, otherArtifact, visitor); } result.listed(versions); }
public ModuleKey read(Decoder decoder) throws Exception { String resolverId = decoder.readString(); String group = decoder.readString(); String module = decoder.readString(); return new ModuleKey(resolverId, new DefaultModuleIdentifier(group, module)); }
UnversionedModuleComponentSelector(String group, String name) { this.moduleIdentifier = DefaultModuleIdentifier.newId(group, name); }
private DefaultModuleIdentifier getCacheKey(ModuleVersionSelector requested) { return new DefaultModuleIdentifier(requested.getGroup(), requested.getName()); }
public ModuleIdExcludeSpec(String group, String name) { this.moduleId = DefaultModuleIdentifier.newId(group, name); }
private ModuleVersionSelectorResolveState(DependencyMetadata dependencyMetadata, DependencyToComponentIdResolver resolver, ResolveState resolveState) { this.dependencyMetadata = dependencyMetadata; this.resolver = resolver; this.resolveState = resolveState; targetModule = resolveState.getModule(new DefaultModuleIdentifier(dependencyMetadata.getRequested().getGroup(), dependencyMetadata.getRequested().getName())); }
public DefaultExclude(String group, String module, String artifact, String type, String extension, String[] configurations, String patternMatcher) { this.moduleId = DefaultModuleIdentifier.newId(group, module); this.artifact = new DefaultIvyArtifactName(artifact, type, extension); this.configurations = ImmutableSet.copyOf(configurations); this.patternMatcher = patternMatcher; }
public DefaultExclude(String group, String module, String[] configurations, String patternMatcher) { this.moduleId = DefaultModuleIdentifier.newId(group, module); this.artifact = new DefaultIvyArtifactName(PatternMatchers.ANY_EXPRESSION, PatternMatchers.ANY_EXPRESSION, PatternMatchers.ANY_EXPRESSION); this.configurations = ImmutableSet.copyOf(configurations); this.patternMatcher = patternMatcher; }
public DefaultExclude(String group, String module) { this.moduleId = DefaultModuleIdentifier.newId(group, module); this.artifact = new DefaultIvyArtifactName(PatternMatchers.ANY_EXPRESSION, PatternMatchers.ANY_EXPRESSION, PatternMatchers.ANY_EXPRESSION); this.configurations = ImmutableSet.of(); this.patternMatcher = PatternMatchers.EXACT; }
public Map<ModuleIdentifier, String> getAwbDependencies(String group, String name) { ModuleIdentifier moduleIdentifier = DefaultModuleIdentifier.newId(group, name); Map<ModuleIdentifier, String> awbDependencies = mAwbDependenciesMap.get(moduleIdentifier); return awbDependencies; }
public boolean isMainLibrary(ResolvedDependencyInfo dependencyInfo) { return mMainDependenciesMap.containsKey( DefaultModuleIdentifier.newId(dependencyInfo.getGroup(), dependencyInfo.getName())); }
private ModuleVersionSelectorResolveState(DependencyMetaData dependencyMetaData, DependencyToComponentIdResolver resolver, ResolveState resolveState) { this.dependencyMetaData = dependencyMetaData; this.resolver = resolver; this.resolveState = resolveState; targetModule = resolveState.getModule(new DefaultModuleIdentifier(dependencyMetaData.getRequested().getGroup(), dependencyMetaData.getRequested().getName())); }
public ModuleIdentifier transform(ModuleVersionSelector original) { return new DefaultModuleIdentifier(original.getGroup(), original.getName()); }
public ModuleIdentifier transform(ModuleVersionSelector original) { return new DefaultModuleIdentifier(original.getGroup(), original.getName() + ":" + original.getVersion()); }
private ModuleVersionSelectorResolveState(DependencyMetaData dependencyMetaData, DependencyToModuleVersionIdResolver resolver, ResolveState resolveState) { this.dependencyMetaData = dependencyMetaData; this.resolver = resolver; this.resolveState = resolveState; targetModule = resolveState.getModule(new DefaultModuleIdentifier(dependencyMetaData.getRequested().getGroup(), dependencyMetaData.getRequested().getName())); }