ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r695383 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/ant/IvyPublish.java src/java/org/apache/ivy/core/publish/PublishEngine.java src/java/org/apache/ivy/core/publish/PublishOptions.java
Date Mon, 15 Sep 2008 08:54:58 GMT
Author: xavier
Date: Mon Sep 15 01:54:57 2008
New Revision: 695383

URL: http://svn.apache.org/viewvc?rev=695383&view=rev
Log:
FIX: Publish Ant Task 'warnonmissing' ignored (IVY-867)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=695383&r1=695382&r2=695383&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Sep 15 01:54:57 2008
@@ -112,6 +112,7 @@
 - IMPROVEMENT: Add a memory cache for the module descriptor that are parsed from the cache
(IVY-883)
 - IMPROVEMENT: Improve performance (IVY-872)
 
+- FIX: Publish Ant Task 'warnonmissing' ignored (IVY-867)
 - FIX: Ivy stand-alone ignores -cache argument (IVY-901) (thanks to Chris)
 - FIX: ivy.cache.dir.${settingsRef} is set to default instead of the defaultCacheDir from
the ivysettings.xml after ivy:resolve (IVY-898)
 - FIX: Ivy ibiblio resolver chokes on variables while checking descriptor consistency (IVY-818)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java?rev=695383&r1=695382&r2=695383&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java Mon Sep 15 01:54:57 2008
@@ -23,7 +23,6 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -34,7 +33,6 @@
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.publish.PublishOptions;
 import org.apache.ivy.core.settings.IvySettings;
-import org.apache.ivy.util.Message;
 import org.apache.tools.ant.BuildException;
 
 /**
@@ -298,7 +296,7 @@
                 deliver.execute();
             }
 
-            Collection missing = ivy.publish(mrid, artifactspattern, publishResolverName,
+            ivy.publish(mrid, artifactspattern, publishResolverName,
                 new PublishOptions()
                     .setPubrevision(getPubrevision())
                     .setPubbranch(getPubbranch())
@@ -310,14 +308,9 @@
                     .setValidate(doValidate(settings))
                     .setOverwrite(overwrite)
                     .setUpdate(update)
+                    .setWarnOnMissing(warnonmissing)
                     .setHaltOnMissing(haltonmissing)
                     .setConfs(splitConfs(conf)));
-            if (warnonmissing) {
-                for (Iterator iter = missing.iterator(); iter.hasNext();) {
-                    Artifact artifact = (Artifact) iter.next();
-                    Message.warn("missing artifact: " + artifact);
-                }
-            }
         } catch (Exception e) {
             if (e instanceof BuildException) {
                 throw (BuildException) e;

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java?rev=695383&r1=695382&r2=695383&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java Mon Sep 15
01:54:57 2008
@@ -209,12 +209,18 @@
                 }
             }
             if (!artifactsFiles.containsKey(artifact)) {
-                Message.info("missing artifact " + artifact + ":");
+                StringBuffer sb = new StringBuffer();
+                sb.append("missing artifact " + artifact + ":\n");
                 for (Iterator iterator = srcArtifactPattern.iterator(); iterator.hasNext();)
{
                     String pattern = (String) iterator.next();
-                    Message.info("\t"
-                            + settings.resolveFile(IvyPatternHelper.substitute(pattern, artifact))
-                            + " file does not exist");
+                    sb.append("\t"
+                          + settings.resolveFile(IvyPatternHelper.substitute(pattern, artifact))
+                          + " file does not exist\n");
+                }
+                if (options.isWarnOnMissing() || options.isHaltOnMissing()) {
+                    Message.warn(sb.toString());
+                } else {
+                    Message.verbose(sb.toString());
                 }
                 if (options.isHaltOnMissing()) {
                     throw new IOException("missing artifact " + artifact);
@@ -227,10 +233,13 @@
             File artifactFile = settings.resolveFile(
                 IvyPatternHelper.substitute(options.getSrcIvyPattern(), artifact));
             if (!artifactFile.exists()) {
-                Message.info("missing ivy file for "
-                        + md.getModuleRevisionId()
-                        + ": "
-                        + artifactFile + " file does not exist");
+                String msg = "missing ivy file for " + md.getModuleRevisionId() + ": \n"
+                                + artifactFile + " file does not exist";
+                if (options.isWarnOnMissing() || options.isHaltOnMissing()) {
+                    Message.warn(msg);
+                } else {
+                    Message.verbose(msg);
+                }
                 if (options.isHaltOnMissing()) {
                     throw new IOException("missing ivy artifact " + artifact);
                 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java?rev=695383&r1=695382&r2=695383&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java Mon Sep 15
01:54:57 2008
@@ -59,6 +59,8 @@
 
     private String pubBranch;
 
+    private boolean warnonmissing;
+
     public String[] getConfs() {
         return confs;
     }
@@ -158,4 +160,13 @@
         return this;
     }
 
+    public boolean isWarnOnMissing() {
+        return warnonmissing;
+    }
+    
+    public PublishOptions setWarnOnMissing(boolean warnonmissing) {
+        this.warnonmissing = warnonmissing;
+        return this;
+    }
+
 }



Mime
View raw message