tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject svn commit: r379783 - /incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java
Date Wed, 22 Feb 2006 15:08:45 GMT
Author: jboynes
Date: Wed Feb 22 07:08:42 2006
New Revision: 379783

URL: http://svn.apache.org/viewcvs?rev=379783&view=rev
Log:
only generate if source changes

Modified:
    incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java

Modified: incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java?rev=379783&r1=379782&r2=379783&view=diff
==============================================================================
--- incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java
(original)
+++ incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java
Wed Feb 22 07:08:42 2006
@@ -19,6 +19,7 @@
 
 import java.io.File;
 import java.io.FileFilter;
+import java.io.IOException;
 import java.util.List;
 
 import org.apache.maven.plugin.AbstractMojo;
@@ -66,11 +67,6 @@
     private List compilerSourceRoots;
 
     public void execute() throws MojoExecutionException {
-        getLog().info("schemaDir = " + schemaDir);
-        getLog().info("targetDirectory = " + targetDirectory);
-        getLog().info("javaPackage = " + javaPackage);
-        getLog().info("Generating SDO interfaces");
-
         File[] files;
         if (schemaFile == null) {
             files = new File(schemaDir).listFiles(FILTER);
@@ -80,8 +76,17 @@
 
         for (int i = 0; i < files.length; i++) {
             File file = files[i];
-            getLog().info("Generating from " + file);
-            JavaGenerator.generateFromXMLSchema(file.toString(), targetDirectory, javaPackage,
null, 0);
+            File marker = new File(targetDirectory, ".gen#" + file.getName());
+            if (file.lastModified() > marker.lastModified()) {
+                getLog().info("Generating SDO interfaces from " + file);
+                JavaGenerator.generateFromXMLSchema(file.toString(), targetDirectory, javaPackage,
null, 0);
+            }
+            try {
+                marker.createNewFile();
+            } catch (IOException e) {
+                throw new MojoExecutionException(e.getMessage(), e);
+            }
+            marker.setLastModified(System.currentTimeMillis());
         }
 
         compilerSourceRoots.add(targetDirectory);



Mime
View raw message