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; }
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ddmrid, false); md.addConfiguration(new Configuration(CONF_USE_PREFIX + name, Visibility.PUBLIC, "Exported package " + name, new String[] {CONF_NAME_DEFAULT}, true, null)); dd.addDependencyConfiguration(conf, conf); dd.addDependencyConfiguration(CONF_NAME_OPTIONAL, conf); dd.addDependencyConfiguration(CONF_NAME_TRANSITIVE_OPTIONAL, CONF_NAME_TRANSITIVE_OPTIONAL); } else { dd.addDependencyConfiguration(CONF_NAME_DEFAULT, conf);
public void addMappingConfs(DefaultDependencyDescriptor dd, boolean isOptional) { if (isOptional) { dd.addDependencyConfiguration("optional", "compile(*)"); dd.addDependencyConfiguration("optional", "provided(*)"); dd.addDependencyConfiguration("optional", "master(*)"); } else { dd.addDependencyConfiguration("runtime", "compile(*)"); dd.addDependencyConfiguration("runtime", "runtime(*)"); dd.addDependencyConfiguration("runtime", "master(*)"); } } });
public DependencyDescriptor clone(ModuleRevisionId revision) { return new DefaultDependencyDescriptor(this, revision); } }
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, mrid, force, changing, transitive); if (conf != null) { dd.addDependencyConfiguration(masterConf, conf); } else { dd.addDependencyConfiguration(masterConf, "*"); IvyDependencyExclude exclude = (IvyDependencyExclude) itExcludes.next(); DefaultExcludeRule rule = exclude.asRule(settings); dd.addExcludeRule(masterConf, rule); IvyDependencyInclude include = (IvyDependencyInclude) itIncludes.next(); DefaultIncludeRule rule = include.asRule(settings); dd.addIncludeRule(masterConf, rule);
boolean changing = options.containsKey("changing") && options.get("changing") instanceof Boolean ? (Boolean) options.get("changing") : false; DefaultDependencyDescriptor depDescriptor = new DefaultDependencyDescriptor(descriptor, depId, force, changing, transitive); for (String conf : confs) { depDescriptor.addDependencyConfiguration("default", conf); PatternMatcher matcher = new ExactOrRegexpPatternMatcher(); ExcludeRule excludeRule = new DefaultExcludeRule(aid, matcher, new HashMap()); depDescriptor.addExcludeRule("default", excludeRule);
public void addArtifact(String groupId, String artifactId, String version) throws Exception { artifacts.add(groupId+":"+artifactId+":"+version); String[] dep = null; dep = new String[] { groupId, artifactId, version }; if (md == null) { md = DefaultModuleDescriptor.newDefaultInstance(ModuleRevisionId.newInstance(dep[0], dep[1] + "-caller", "working")); } DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, ModuleRevisionId.newInstance(dep[0], dep[1], dep[2]), false, false, true); md.addDependency(dd); ExcludeRule er = new DefaultExcludeRule(new ArtifactId(new ModuleId("org.walkmod", "walkmod-core"), PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION), ExactPatternMatcher.INSTANCE, null); dd.addExcludeRule(null, er); }
ModuleRevisionId transformDynamicMrid = t.transform(dd .getDynamicConstraintDependencyRevisionId()); DefaultDependencyDescriptor newdd = new DefaultDependencyDescriptor(null, transformMrid, transformDynamicMrid, dd.isForce(), dd.isChanging(), dd.isTransitive()); DefaultDependencyDescriptor ddd = (DefaultDependencyDescriptor) dd; newdd.confs = new LinkedHashMap(ddd.confs); newdd.setExcludeRules(new LinkedHashMap(ddd.getExcludeRules())); newdd.setIncludeRules(new LinkedHashMap(ddd.getIncludeRules())); newdd.setDependencyArtifacts(new LinkedHashMap(ddd.getDependencyArtifacts())); } else { throw new IllegalArgumentException( newdd.confs.put(moduleConfs[i], new ArrayList(Arrays.asList(dd.getDependencyConfigurations(moduleConfs[i])))); newdd.getExcludeRules().put(moduleConfs[i], new ArrayList(Arrays.asList(dd.getExcludeRules(moduleConfs[i])))); newdd.getIncludeRules().put(moduleConfs[i], new ArrayList(Arrays.asList(dd.getIncludeRules(moduleConfs[i])))); newdd.getDependencyArtifacts().put(moduleConfs[i], new ArrayList(Arrays.asList(dd.getDependencyArtifacts(moduleConfs[i]))));
dd, dd.getDependencyId().getName(), type, ext, null, extraAtt); dd.addDependencyArtifact(optionalizedScope, depArtifact); String[] confs = dd.getModuleConfigurations(); for (int k = 0; k < confs.length; k++) { dd.addExcludeRule(confs[k], new DefaultExcludeRule(new ArtifactId(excludedModule, PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION), ExactPatternMatcher.INSTANCE, null));
protected void addConfiguration(String c) { confAware.addConfiguration(c); if (state == State.EXCLUDE) { // we are adding a configuration to a module wide exclude rule // we have nothing special to do here, the rule has already been added to the module // descriptor } else { // we are currently adding a configuration to either an include, exclude or artifact // element // of a dependency. This means that we have to add this element to the corresponding // conf // of the current dependency descriptor if (confAware instanceof DependencyArtifactDescriptor) { dd.addDependencyArtifact(c, (DependencyArtifactDescriptor) confAware); } else if (confAware instanceof IncludeRule) { dd.addIncludeRule(c, (IncludeRule) confAware); } else if (confAware instanceof ExcludeRule) { dd.addExcludeRule(c, (ExcludeRule) confAware); } } }
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); } }
public static DefaultModuleDescriptor newCallerInstance(ModuleRevisionId[] mrid, boolean transitive, boolean changing) { DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptor( ModuleRevisionId.newInstance("caller", "all-caller", "working"), "integration", null, true); moduleDescriptor.addConfiguration(new Configuration(DEFAULT_CONFIGURATION)); moduleDescriptor.setLastModified(System.currentTimeMillis()); for (int i = 0; i < mrid.length; i++) { DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(moduleDescriptor, mrid[i], true, changing, transitive); dd.addDependencyConfiguration(DEFAULT_CONFIGURATION, "*"); moduleDescriptor.addDependency(dd); } return moduleDescriptor; }
public void addMappingConfs(DefaultDependencyDescriptor dd, boolean isOptional) { // optional doesn't make sense in the test scope dd.addDependencyConfiguration("test", "runtime(*)"); dd.addDependencyConfiguration("test", "master(*)"); } });
protected DependencyDescriptor getDefaultConfMappingDescriptor() { if (defaultConfMappingDescriptor == null) { defaultConfMappingDescriptor = new DefaultDependencyDescriptor( ModuleRevisionId.newInstance("", "", ""), false); parseDepsConfs(defaultConfMapping, defaultConfMappingDescriptor, false, false); } return defaultConfMappingDescriptor; }
public void addArtifact(String groupId, String artifactId, String version) throws Exception { artifacts.add(groupId+":"+artifactId+":"+version); String[] dep = null; dep = new String[] { groupId, artifactId, version }; if (md == null) { md = DefaultModuleDescriptor.newDefaultInstance(ModuleRevisionId.newInstance(dep[0], dep[1] + "-caller", "working")); } DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, ModuleRevisionId.newInstance(dep[0], dep[1], dep[2]), false, false, true); md.addDependency(dd); ExcludeRule er = new DefaultExcludeRule(new ArtifactId(new ModuleId("org.walkmod", "walkmod-core"), PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION), ExactPatternMatcher.INSTANCE, null); dd.addExcludeRule(null, er); }
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, dependency.getMrid(), false, false, true); dd.addDependencyConfiguration(ModuleDescriptor.DEFAULT_CONFIGURATION, ModuleDescriptor.DEFAULT_CONFIGURATION); md.addDependency(dd);
public void addMappingConfs(DefaultDependencyDescriptor dd, boolean isOptional) { // optional doesn't make sense in the system scope dd.addDependencyConfiguration("system", "master(*)"); } });
private void loadModuleRevision(ModuleRevisionId mrid) throws Exception { ResolvedModuleRevision module = settings.getResolver(mrid).getDependency( new DefaultDependencyDescriptor(mrid, false), newResolveData()); if (module == null) { Message.warn("module not found while listed: " + mrid); } else { revisions.put(module.getId(), module.getDescriptor()); getAllRevisions(module.getId()).add(module.getDescriptor()); } Message.progress(); }
public static DefaultModuleDescriptor newCallerInstance(ModuleRevisionId mrid, String[] confs, boolean transitive, boolean changing) { DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptor( ModuleRevisionId.newInstance(mrid.getOrganisation(), mrid.getName() + "-caller", "working"), "integration", null, true); for (int i = 0; i < confs.length; i++) { moduleDescriptor.addConfiguration(new Configuration(confs[i])); } moduleDescriptor.setLastModified(System.currentTimeMillis()); DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(moduleDescriptor, mrid, true, changing, transitive); for (int j = 0; j < confs.length; j++) { dd.addDependencyConfiguration(confs[j], confs[j]); } moduleDescriptor.addDependency(dd); return moduleDescriptor; }
public void addMappingConfs(DefaultDependencyDescriptor dd, boolean isOptional) { if (isOptional) { dd.addDependencyConfiguration("optional", "compile(*)"); // dd.addDependencyConfiguration("optional", "provided(*)"); dd.addDependencyConfiguration("optional", "master(*)"); } else { dd.addDependencyConfiguration("compile", "compile(*)"); // dd.addDependencyConfiguration("compile", "provided(*)"); dd.addDependencyConfiguration("compile", "master(*)"); dd.addDependencyConfiguration("runtime", "runtime(*)"); } } });