private File getIvyfile(String org, String name, String rev, String[] confs, Set<Map<String, Object>> artifacts) throws IOException { File ivyfile; ivyfile = File.createTempFile("ivy", ".xml"); ivyfile.deleteOnExit(); DefaultModuleDescriptor md = DefaultModuleDescriptor .newDefaultInstance(ModuleRevisionId.newInstance(org, name + "-caller", "working")); DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, ModuleRevisionId.newInstance(org, name, rev), false, false, true); if (artifacts != null && !artifacts.isEmpty()) { for (Map<String, Object> artifact : artifacts) { String artifactName = (String) artifact.get("name"); String artifactType = (String) artifact.get("type"); String artifactExt = (String) artifact.get("ext"); URL artifactUrl = (URL) artifact.get("url"); Map<?, ?> extraAttributes = (Map<?, ?>) artifact.get("extraAttributes"); DefaultDependencyArtifactDescriptor dad = new DefaultDependencyArtifactDescriptor(dd, artifactName, artifactType, artifactExt, artifactUrl, extraAttributes); dd.addDependencyArtifact("default", dad); } } for (int i = 0; i < confs.length; i++) { dd.addDependencyConfiguration("default", confs[i]); } md.addDependency(dd); md.addExtraAttributeNamespace("m", "http://ant.apache.org/ivy/maven"); XmlModuleDescriptorWriter.write(md, ivyfile); return ivyfile; }
private void initStandardAttributes() { setStandardAttribute(IvyPatternHelper.ARTIFACT_KEY, getName()); setStandardAttribute(IvyPatternHelper.TYPE_KEY, getType()); setStandardAttribute(IvyPatternHelper.EXT_KEY, getExt()); setStandardAttribute("url", url != null ? String.valueOf(url) : ""); }
public int hashCode() { return getAttributes().hashCode(); }
/** * @param dd * @param name * @param type * @param url */ public DefaultDependencyArtifactDescriptor(DependencyDescriptor dd, String name, String type, String ext, URL url, Map extraAttributes) { super(null, extraAttributes); Checks.checkNotNull(dd, "dd"); Checks.checkNotNull(name, "name"); Checks.checkNotNull(type, "type"); Checks.checkNotNull(ext, "ext"); this.dd = dd; this.name = name; this.type = type; this.ext = ext; this.url = url; initStandardAttributes(); }
public boolean equals(Object obj) { if (!(obj instanceof DependencyArtifactDescriptor)) { return false; } DependencyArtifactDescriptor dad = (DependencyArtifactDescriptor) obj; return getAttributes().equals(dad.getAttributes()); }
void addArtifact(DefaultDependencyDescriptor dd, String masterConf) { String typePattern = type == null ? PatternMatcher.ANY_EXPRESSION : type; String extPattern = ext == null ? typePattern : ext; URL u; try { u = url == null ? null : new URL(url); } catch (MalformedURLException e) { throw new BuildException("Malformed url in the artifact: " + e.getMessage(), e); } DefaultDependencyArtifactDescriptor dad = new DefaultDependencyArtifactDescriptor(dd, name, typePattern, extPattern, u, null); dd.addDependencyArtifact(masterConf, dad); } }
Map extraAtt = ExtendableItemHelper.getExtraAttributes(settings, attributes, new String[] {"name", "type", "ext", "url", "conf"}); confAware = new DefaultDependencyArtifactDescriptor(dd, name, type, ext, url == null ? null : new URL(url), extraAtt); } else if (state == State.ARTIFACT_INCLUDE) {
extraAtt.put("m:classifier", dep.getClassifier()); DefaultDependencyArtifactDescriptor depArtifact = new DefaultDependencyArtifactDescriptor( dd, dd.getDependencyId().getName(), type, ext, null, extraAtt);