You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2007/09/24 16:25:40 UTC

svn commit: r578826 - in /incubator/qpid/trunk/qpid/java: common/pom.xml plugins/src/main/java/org/apache/qpid/plugins/JythonMojo.java

Author: rhs
Date: Mon Sep 24 07:25:39 2007
New Revision: 578826

URL: http://svn.apache.org/viewvc?rev=578826&view=rev
Log:
rerun generate script when it is modified

Modified:
    incubator/qpid/trunk/qpid/java/common/pom.xml
    incubator/qpid/trunk/qpid/java/plugins/src/main/java/org/apache/qpid/plugins/JythonMojo.java

Modified: incubator/qpid/trunk/qpid/java/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/pom.xml?rev=578826&r1=578825&r2=578826&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/pom.xml (original)
+++ incubator/qpid/trunk/qpid/java/common/pom.xml Mon Sep 24 07:25:39 2007
@@ -90,7 +90,10 @@
                                 <param>org.apache.qpidity.transport</param>
                                 <param>${specs.dir}/amqp.0-10-preview.xml</param>
                             </params>
-                            <source>${specs.dir}/amqp.0-10-preview.xml</source>
+                            <sources>
+                              <source>${specs.dir}/amqp.0-10-preview.xml</source>
+                              <source>${basedir}/generate</source>
+                            </sources>
                             <timestamp>${generated.path}/generated.timestamp</timestamp>
                         </configuration>
                         <goals>

Modified: incubator/qpid/trunk/qpid/java/plugins/src/main/java/org/apache/qpid/plugins/JythonMojo.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/plugins/src/main/java/org/apache/qpid/plugins/JythonMojo.java?rev=578826&r1=578825&r2=578826&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/plugins/src/main/java/org/apache/qpid/plugins/JythonMojo.java (original)
+++ incubator/qpid/trunk/qpid/java/plugins/src/main/java/org/apache/qpid/plugins/JythonMojo.java Mon Sep 24 07:25:39 2007
@@ -52,7 +52,7 @@
      *
      * @parameter
      */
-    private File source;
+    private File[] sources;
 
     /**
      * Optional timestamp.
@@ -63,27 +63,37 @@
 
     public void execute() throws MojoExecutionException
     {
-        if (source != null && timestamp != null)
+        boolean stale = true;
+
+        if (sources != null && sources.length > 0 && timestamp != null)
         {
-            if (timestamp.lastModified() > source.lastModified())
+            stale = false;
+            for (File source : sources)
             {
-                return;
+                if (source.lastModified() > timestamp.lastModified())
+                {
+                    stale = true;
+                    break;
+                }
             }
         }
 
-        jython.main(params);
-
-        if (timestamp != null)
+        if (stale)
         {
-            try
-            {
-                timestamp.createNewFile();
-            }
-            catch (IOException e)
+            jython.main(params);
+
+            if (timestamp != null)
             {
-                throw new MojoExecutionException("cannot create timestamp", e);
+                try
+                {
+                    timestamp.createNewFile();
+                }
+                catch (IOException e)
+                {
+                    throw new MojoExecutionException("cannot create timestamp", e);
+                }
+                timestamp.setLastModified(System.currentTimeMillis());
             }
-            timestamp.setLastModified(System.currentTimeMillis());
         }
     }