use of org.apache.ivy.core.deliver.PublishingDependencyRevisionResolver in project ant-ivy by apache.
the class IvyDeliver method doExecute.
public void doExecute() throws BuildException {
Ivy ivy = getIvyInstance();
IvySettings settings = ivy.getSettings();
organisation = getProperty(organisation, settings, "ivy.organisation", resolveId);
module = getProperty(module, settings, "ivy.module", resolveId);
revision = getProperty(revision, settings, "ivy.revision", resolveId);
pubBranch = getProperty(pubBranch, settings, "ivy.deliver.branch");
pubRevision = getProperty(pubRevision, settings, "ivy.deliver.revision");
deliverpattern = getProperty(deliverpattern, settings, "ivy.deliver.ivy.pattern");
status = getProperty(status, settings, "ivy.status");
if (deliveryList == null) {
String deliveryListPath = getProperty(settings, "ivy.delivery.list.file");
if (deliveryListPath == null) {
deliveryList = new File(System.getProperty("java.io.tmpdir") + "/delivery.properties");
} else {
deliveryList = getProject().resolveFile(settings.substitute(deliveryListPath));
}
}
if (resolveId == null) {
if (organisation == null) {
throw new BuildException("no organisation provided for ivy deliver task: " + "It can either be set explicitly via the attribute 'organisation' " + "or via 'ivy.organisation' property or a prior call to <resolve/>");
}
if (module == null) {
throw new BuildException("no module name provided for ivy deliver task: " + "It can either be set explicitly via the attribute 'module' " + "or via 'ivy.module' property or a prior call to <resolve/>");
}
}
if (revision == null) {
revision = Ivy.getWorkingRevision();
}
Date pubdate = getPubDate(this.pubdate, new Date());
if (pubRevision == null) {
if (revision.startsWith("working@")) {
pubRevision = DateUtil.format(pubdate);
} else {
pubRevision = revision;
}
}
if (deliverpattern == null) {
throw new BuildException("deliver ivy pattern is missing: either provide it as parameters " + "or through ivy.deliver.ivy.pattern properties");
}
if (status == null) {
throw new BuildException("no status provided: either provide it as parameter or through " + "the ivy.status.default property");
}
ModuleRevisionId mrid = null;
if (resolveId == null) {
mrid = ModuleRevisionId.newInstance(organisation, module, revision);
}
boolean isLeading = false;
try {
if (!deliveryList.exists()) {
isLeading = true;
}
loadDeliveryList();
PublishingDependencyRevisionResolver drResolver;
if (isNullOrEmpty(deliverTarget)) {
drResolver = new DefaultPublishingDRResolver();
} else {
drResolver = new DeliverDRResolver();
}
DeliverOptions options = new DeliverOptions(status, pubdate, drResolver, doValidate(settings), replacedynamicrev, splitToArray(conf)).setResolveId(resolveId).setReplaceForcedRevisions(isReplaceForcedRev()).setGenerateRevConstraint(generateRevConstraint).setMerge(merge).setPubBranch(pubBranch);
if (mrid == null) {
ivy.deliver(pubRevision, deliverpattern, options);
} else {
ivy.deliver(mrid, pubRevision, deliverpattern, options);
}
} catch (Exception e) {
throw new BuildException("impossible to deliver " + (mrid == null ? resolveId : mrid) + ": " + e, e);
} finally {
if (isLeading) {
if (deliveryList.exists()) {
deliveryList.delete();
}
}
}
}
Aggregations