+ ". Available options are " + getAllowedLogOptions());
}
ModuleRevisionId mrid = ModuleRevisionId.newInstance("", "",
Ivy.getWorkingRevision());
DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(mrid, null);
Iterator itDeps = dependencies.iterator();
while (itDeps.hasNext()) {
IvyDependency dep = (IvyDependency) itDeps.next();
DependencyDescriptor dd = dep.asDependencyDescriptor(md, "default", settings);
md.addDependency(dd);
}
Iterator itExcludes = excludes.iterator();
while (itExcludes.hasNext()) {
IvyExclude exclude = (IvyExclude) itExcludes.next();
DefaultExcludeRule rule = exclude.asRule(settings);
rule.addConfiguration("default");
md.addExcludeRule(rule);
}
Iterator itConflicts = conflicts.iterator();
while (itConflicts.hasNext()) {
IvyConflict conflict = (IvyConflict) itConflicts.next();
conflict.addConflict(md, settings);
}
report = ivy
.resolve(md, getResolveOptions(ivy, new String[] {"default"}, settings));
} else if (isInline()) {
if (organisation == null) {
throw new BuildException("'organisation' is required when using inline mode");
}
if (module == null) {
throw new BuildException("'module' is required when using inline mode");
}
if (file != null) {
throw new BuildException("'file' not allowed when using inline mode");
}
if (!getAllowedLogOptions().contains(log)) {
throw new BuildException("invalid option for 'log': " + log
+ ". Available options are " + getAllowedLogOptions());
}
for (int i = 0; i < confs.length; i++) {
if ("*".equals(confs[i])) {
confs[i] = "*(public)";
}
}
if (revision == null) {
revision = "latest.integration";
}
report = ivy.resolve(
ModuleRevisionId.newInstance(organisation, module, branch, revision),
getResolveOptions(ivy, confs, settings), changing);
} else {
if (organisation != null) {
throw new BuildException(
"'organisation' not allowed when not using 'org' attribute");
}
if (module != null) {
throw new BuildException("'module' not allowed when not using 'org' attribute");
}
if (file == null) {
file = getProject().resolveFile(getProperty(settings, "ivy.dep.file"));
}
report = ivy.resolve(file.toURI().toURL(), getResolveOptions(ivy, confs, settings));
}
if (report.hasError()) {
if (failureProperty != null) {
getProject().setProperty(failureProperty, "true");
}
if (isHaltonfailure()) {
throw new BuildException("resolve failed - see output for details");
}
}
setResolved(report, resolveId, isKeep());
confs = report.getConfigurations();
if (isKeep()) {
ModuleDescriptor md = report.getModuleDescriptor();
// put resolved infos in ant properties and ivy variables
// putting them in ivy variables is important to be able to change from one resolve
// call to the other
String mdOrg = md.getModuleRevisionId().getOrganisation();
String mdName = md.getModuleRevisionId().getName();
String mdRev = md.getResolvedModuleRevisionId().getRevision();
getProject().setProperty("ivy.organisation", mdOrg);
settings.setVariable("ivy.organisation", mdOrg);
getProject().setProperty("ivy.module", mdName);
settings.setVariable("ivy.module", mdName);
getProject().setProperty("ivy.revision", mdRev);
settings.setVariable("ivy.revision", mdRev);
for (int i = 0; i < md.getInheritedDescriptors().length; i++) {
ExtendsDescriptor parent = md.getInheritedDescriptors()[i];
String parentOrg = parent.getResolvedParentRevisionId().getOrganisation();
String parentModule = parent.getResolvedParentRevisionId().getName();
String parentRevision = parent.getResolvedParentRevisionId().getRevision();
String parentBranch = parent.getResolvedParentRevisionId().getBranch();
getProject().setProperty("ivy.parent[" + i + "].organisation", parentOrg);
settings.setVariable("ivy.parent[" + i + "].organisation", parentOrg);
getProject().setProperty("ivy.parent[" + i + "].module", parentModule);
settings.setVariable("ivy.parent[" + i + "].module", parentModule);
getProject().setProperty("ivy.parent[" + i + "].revision", parentRevision);
settings.setVariable("ivy.parent[" + i + "].revision", parentRevision);
if (parentBranch != null) {
getProject().setProperty("ivy.parent[" + i + "].branch", parentBranch);
settings.setVariable("ivy.parent[" + i + "].branch", parentBranch);
}
}
getProject().setProperty("ivy.parents.count",
String.valueOf(md.getInheritedDescriptors().length));
settings.setVariable("ivy.parents.count",
String.valueOf(md.getInheritedDescriptors().length));
Boolean hasChanged = null;
if (getCheckIfChanged()) {
hasChanged = Boolean.valueOf(report.hasChanged());
getProject().setProperty("ivy.deps.changed", hasChanged.toString());