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); }
// 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); } }