}
return null;
}
});
child.addAttribute(reppatternTagAttribute);
child.addAttribute(new IvyBooleanTagAttribute("ivys",
"true if ivy file can be found on this repository", false));
child.addAttribute(new IvyBooleanTagAttribute("artifacts",
"true if module artifacts can be found on this repository", false));
addTag(child);
info.addChildIvyTag(child);
child = new IvyTag("description", "gives general description about the module");
child.addAttribute(new IvyTagAttribute("homepage", "the url of the homepage of the module",
false, defaultOrganizationURLProvider));
addTag(child);
info.addChildIvyTag(child);
ivyTag.addChildIvyTag(info);
// configurations
IvyTag configurations = new IvyTag("configurations",
"container for configuration elements");
IvyTag conf = new IvyTag("conf", "declares a configuration of this module");
conf.addAttribute(new IvyTagAttribute("name", "the name of the declared configuration",
true));
conf.addAttribute(new IvyTagAttribute("description",
"a short description for the declared configuration", false));
IvyTagAttribute visibilityTagAttribute = new IvyTagAttribute("visibility",
"the visibility of the declared configuration.\n"
+ "'public' means that this configuration can be used by other modules, \n"
+ "while 'private' means that this configuration is used only in the\n"
+ "module itself, and is not exposed to other modules", false);
visibilityTagAttribute.setValueProvider(new IValueProvider() {
public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
return new String[] {"public", "private"};
}
});
conf.addAttribute(visibilityTagAttribute);
IvyTagAttribute confExtTagAttribute = new IvyTagAttribute("extends",
"a comma separated list of configurations of this module \n"
+ "that the current configuration extends", false);
IValueProvider masterConfsValueProvider = new IValueProvider() {
public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
StringBuffer base = new StringBuffer();
String qualifier = ivyFile.getAttributeValueQualifier();
int comma = qualifier.lastIndexOf(",") + 1;
base.append(qualifier.substring(0, comma));
qualifier = qualifier.substring(comma);
while (qualifier.length() > 0 && qualifier.charAt(0) == ' ') {
base.append(' ');
qualifier = qualifier.substring(1);
}
String[] confs = ((IvyModuleDescriptorFile) ivyFile).getConfigurationNames();
for (int i = 0; i < confs.length; i++) {
confs[i] = base + confs[i];
}
return confs;
}
};
IValueProvider masterConfValueProvider = new IValueProvider() {
public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
return ((IvyModuleDescriptorFile) ivyFile).getConfigurationNames();
}
};
confExtTagAttribute.setValueProvider(masterConfsValueProvider);
conf.addAttribute(confExtTagAttribute);
IvyTagAttribute deprecatedTagAttribute = new IvyTagAttribute("deprecated",
"indicates that this conf has been deprecated \n"
+ "by giving the date of the deprecation. \n"
+ "It should be given in this format: yyyyMMddHHmmss", false);
deprecatedTagAttribute.setValueProvider(new IValueProvider() {
public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
return new String[] {Ivy.DATE_FORMAT.format(new Date())};
}
});
conf.addAttribute(deprecatedTagAttribute);
configurations.addChildIvyTag(conf);
List allConf = new ArrayList();
allConf.add(conf);
addTag(conf.getName(), allConf);
ivyTag.addChildIvyTag(configurations);
addTag(configurations);
// configurations
IvyTag publications = new IvyTag("publications",
"container for published artifact elements");
IvyTag artifact = new IvyTag("artifact", "declares a published artifact for this module");
artifact.addAttribute(new IvyTagAttribute("name",
"the name of the published artifact. This name must not include revision.", true,
projectNameValueProvider));
artifact.addAttribute(new IvyTagAttribute("type", "the type of the published artifact. \n"
+ "It's usually its extension, but not necessarily. \n"
+ "For instance, ivy files are of type 'ivy' but have 'xml' extension", true,
new ListValueProvider(getDefault("type"))));
artifact.addAttribute(new IvyTagAttribute("ext", "the extension of the published artifact",
false, new ListValueProvider(getDefault("ext"))));
artifact.addAttribute(new IvyTagAttribute("conf",
"comma separated list of public configurations in which this artifact\n"
+ "is published. '*' wildcard can be used to designate all public\n"
+ "configurations of this module", false, masterConfsValueProvider));
IvyTag conf2 = new IvyTag("conf",
"indicates a public configuration in which this artifact is published");
conf2.addAttribute(new IvyTagAttribute("name",
"the name of a module public configuration in which this artifact\n"
+ "is published. '*' wildcard can be used to designate all\n"
+ "public configurations of this module", true, masterConfValueProvider));
allConf.add(conf2);
artifact.addChildIvyTag(conf2);
publications.addChildIvyTag(artifact);
addTag(publications);
addTag(artifact);
ivyTag.addChildIvyTag(publications);
// dependencies
IvyTag dependencies = new IvyTag("dependencies", "container for dependency elements");
// dependency
IvyTag dependency = new IvyTag("dependency", "declares a dependency for this module") {
public String[] getPossibleValuesForAttribute(String att, IvyFile ivyfile) {
String[] r = super.getPossibleValuesForAttribute(att, ivyfile);
if (r == null) { // listing can be used even for extra attributes
List ret = listDependencyTokenValues(att, ivyfile);
return (String[]) ret.toArray(new String[ret.size()]);
} else {
return r;
}
}
};
IvyTagAttribute orgAtt = new IvyTagAttribute("org",
"the name of the organisation of the dependency.", false);
orgAtt.setValueProvider(new IValueProvider() {
public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
List ret = listDependencyTokenValues(att.getName(), ivyFile);
ret.add(getSettings().getDefaultOrganization());
String org = ((IvyModuleDescriptorFile) ivyFile).getOrganisation();
if (org != null) {
ret.add(org);
}
return (String[]) ret.toArray(new String[ret.size()]);
}
});
dependency.addAttribute(orgAtt);
IvyTagAttribute module = new IvyTagAttribute("name", "the module name of the dependency",
true);
module.setValueProvider(new IValueProvider() {
public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
List ret = listDependencyTokenValues(att.getName(), ivyFile);
return (String[]) ret.toArray(new String[ret.size()]);
}
});
dependency.addAttribute(module);
IvyTagAttribute branch = new IvyTagAttribute("branch",
"the branch of the dependency. \nDo not set if not needed.", false);
branch.setValueProvider(new IValueProvider() {
public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
List ret = listDependencyTokenValues(att.getName(), ivyFile);
return (String[]) ret.toArray(new String[ret.size()]);
}
});
dependency.addAttribute(branch);
IvyTagAttribute rev = new IvyTagAttribute("rev", "the revision of the dependency. \n"
+ "Use 'latest.integration' to get the latest version of the dependency. \n"
+ "You can also end the revision asked with a '+' to get the latest"
+ " matching revision.", true);
rev.setValueProvider(new IValueProvider() {
public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
List ret = listDependencyTokenValues(att.getName(), ivyFile);
ret.add("latest.integration");
return (String[]) ret.toArray(new String[ret.size()]);
}
});
dependency.addAttribute(rev);
dependency.addAttribute(new IvyBooleanTagAttribute("force",
"a boolean to give an indication to conflict manager \n"
+ "that this dependency should be forced to this revision", false));
dependency.addAttribute(new IvyBooleanTagAttribute("transitive",
"a boolean indicating if this dependency should be resolved transitively or not",
false));
IvyTagAttribute confAtt = new IvyTagAttribute("conf",
"an inline mapping configuration spec", false);
dependency.addAttribute(confAtt);