private ModuleRevisionId getRevision( ResolvedResource ivyRef, ModuleRevisionId askedMrid, ModuleDescriptor md) throws ParseException { Map allAttributes = new HashMap(); allAttributes.putAll(md.getQualifiedExtraAttributes()); allAttributes.putAll(askedMrid.getQualifiedExtraAttributes()); String revision = ivyRef.getRevision(); if (revision == null) { Message.debug("no revision found in reference for " + askedMrid); if (getSettings().getVersionMatcher().isDynamic(askedMrid)) { if (md.getModuleRevisionId().getRevision() == null) { revision = "working@" + getName(); } else { Message.debug("using " + askedMrid); revision = askedMrid.getRevision(); } } else { Message.debug("using " + askedMrid); revision = askedMrid.getRevision(); } } return ModuleRevisionId.newInstance( askedMrid.getOrganisation(), askedMrid.getName(), askedMrid.getBranch(), revision, allAttributes); }
/** * This ModuleInSort has already been analyzed. It is either already added to the sorted list, * either it is included in a loop and will be added when the root of the loop will be added to * the list. */ public boolean isProcessed() { if (isSorted || isLoopIntermediateElement) { Message.debug("Module descriptor is processed : " + module.getModuleRevisionId().toString()); return true; } else { return false; } }
/** This ModuleInSort has been placed on the sorted list */ public boolean isSorted() { if (isSorted) { Message.debug( "Module descriptor already sorted : " + module.getModuleRevisionId().toString()); return true; } else { return false; } }
@Nullable private ModuleId getModuleId(Module module) throws IvySettingsNotFoundException, IvySettingsFileReadException { if (!moduleDependencies.values().contains(module)) { final ModuleDescriptor ivyModuleDescriptor = ivyManager.getModuleDescriptor(module); if (ivyModuleDescriptor != null) { moduleDependencies.put(ivyModuleDescriptor.getModuleRevisionId().getModuleId(), module); } } for (ModuleId moduleId : moduleDependencies.keySet()) { if (module.equals(moduleDependencies.get(moduleId))) { return moduleId; } } return null; }
private Artifact expectedIvyArtifact( Configuration configuration, ModuleDescriptor moduleDescriptor, Map<String, String> additionalExtraAttributes) { PublishArtifact publishArtifact = configuration.getArtifacts().iterator().next(); Map<String, String> extraAttributes = WrapUtil.toMap(Dependency.CLASSIFIER, publishArtifact.getClassifier()); extraAttributes.putAll(additionalExtraAttributes); return new DefaultArtifact( moduleDescriptor.getModuleRevisionId(), publishArtifact.getDate(), publishArtifact.getName(), publishArtifact.getType(), publishArtifact.getExtension(), extraAttributes); }
public void resolve(DependencyMetaData dependency, BuildableModuleVersionResolveResult result) { DependencyDescriptor descriptor = dependency.getDescriptor(); if (descriptor instanceof ProjectDependencyDescriptor) { ProjectDependencyDescriptor desc = (ProjectDependencyDescriptor) descriptor; ModuleDescriptor moduleDescriptor = projectModuleRegistry.findProject(desc); final ModuleRevisionId moduleRevisionId = moduleDescriptor.getModuleRevisionId(); final DefaultModuleVersionIdentifier moduleVersionIdentifier = new DefaultModuleVersionIdentifier( moduleRevisionId.getOrganisation(), moduleRevisionId.getName(), moduleRevisionId.getRevision()); result.resolved(moduleVersionIdentifier, moduleDescriptor, artifactResolver); } else { resolver.resolve(dependency, result); } }
// --------------------------------------------------------------------------- public void doMakeAction(Rule rule) throws TablesawException { System.out.println("Ivy retrieving dependencies."); try { ModuleDescriptor md = m_resolveRule.getReport().getModuleDescriptor(); Ivy ivy = m_resolveRule.getIvyInstance(); String pattern; if (m_useWorkingDir && m_make.getWorkingDirectory() != null) { pattern = m_make.getWorkingDirectory().getPath(); pattern += "/" + m_retrievePattern; } else pattern = m_retrievePattern; if (m_make.isVerbose()) System.out.println("Ivy retrieve pattern: " + pattern); ivy.retrieve(md.getModuleRevisionId(), pattern, m_retreiveOptions); } catch (IOException ioe) { throw new TablesawException(ioe); } }
public String toString() { return module.getModuleRevisionId().toString(); }
// private boolean isResolved(ResolveData data, ModuleRevisionId mrid) { // IvyNode node = getSystemNode(data, mrid); // return node != null && node.getModuleRevision() != null; // } // private void checkDescriptorConsistency( ModuleRevisionId mrid, ModuleDescriptor md, ResolvedResource ivyRef) throws ParseException { boolean ok = true; StringBuffer errors = new StringBuffer(); if (!mrid.getOrganisation().equals(md.getModuleRevisionId().getOrganisation())) { Message.error( "\t" + getName() + ": bad organisation found in " + ivyRef.getResource() + ": expected='" + mrid.getOrganisation() + "' found='" + md.getModuleRevisionId().getOrganisation() + "'"); errors.append( "bad organisation: expected='" + mrid.getOrganisation() + "' found='" + md.getModuleRevisionId().getOrganisation() + "'; "); ok = false; } if (!mrid.getName().equals(md.getModuleRevisionId().getName())) { Message.error( "\t" + getName() + ": bad module name found in " + ivyRef.getResource() + ": expected='" + mrid.getName() + " found='" + md.getModuleRevisionId().getName() + "'"); errors.append( "bad module name: expected='" + mrid.getName() + "' found='" + md.getModuleRevisionId().getName() + "'; "); ok = false; } if (mrid.getBranch() != null && !mrid.getBranch().equals(md.getModuleRevisionId().getBranch())) { Message.error( "\t" + getName() + ": bad branch name found in " + ivyRef.getResource() + ": expected='" + mrid.getBranch() + " found='" + md.getModuleRevisionId().getBranch() + "'"); errors.append( "bad branch name: expected='" + mrid.getBranch() + "' found='" + md.getModuleRevisionId().getBranch() + "'; "); ok = false; } if (ivyRef.getRevision() != null && !ivyRef.getRevision().startsWith("working@")) { ModuleRevisionId expectedMrid = ModuleRevisionId.newInstance(mrid, ivyRef.getRevision()); if (!getSettings().getVersionMatcher().accept(expectedMrid, md)) { Message.error( "\t" + getName() + ": bad revision found in " + ivyRef.getResource() + ": expected='" + ivyRef.getRevision() + " found='" + md.getModuleRevisionId().getRevision() + "'"); errors.append( "bad revision: expected='" + ivyRef.getRevision() + "' found='" + md.getModuleRevisionId().getRevision() + "'; "); ok = false; } } if (!getSettings().getStatusManager().isStatus(md.getStatus())) { Message.error( "\t" + getName() + ": bad status found in " + ivyRef.getResource() + ": '" + md.getStatus() + "'"); errors.append("bad status: '" + md.getStatus() + "'; "); ok = false; } for (Iterator it = mrid.getExtraAttributes().entrySet().iterator(); it.hasNext(); ) { Entry extra = (Entry) it.next(); if (extra.getValue() != null && !extra.getValue().equals(md.getExtraAttribute((String) extra.getKey()))) { String errorMsg = "bad " + extra.getKey() + " found in " + ivyRef.getResource() + ": expected='" + extra.getValue() + "' found='" + md.getExtraAttribute((String) extra.getKey()) + "'"; Message.error("\t" + getName() + ": " + errorMsg); errors.append(errorMsg + ";"); ok = false; } } if (!ok) { throw new ParseException( "inconsistent module descriptor file found in '" + ivyRef.getResource() + "': " + errors, 0); } }