db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1523801 - in /db/torque/torque4/trunk: torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
Date Mon, 16 Sep 2013 20:39:40 GMT
Author: tfischer
Date: Mon Sep 16 20:39:39 2013
New Revision: 1523801

URL: http://svn.apache.org/r1523801
Log:
TORQUE-292 implement runOnlyOnSourceChange in ant task and maven plugin

Modified:
    db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java
    db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java

Modified: db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java?rev=1523801&r1=1523800&r2=1523801&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java
(original)
+++ db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java
Mon Sep 16 20:39:39 2013
@@ -134,6 +134,12 @@ public class TorqueGeneratorTask extends
     private String loglevel;
 
     /**
+     * Whether the generator should only run if one of the source files
+     * changes.
+     */
+    private boolean runOnlyOnSourceChange = false;
+
+    /**
      * Whether to add debug information to the output.
      */
     private boolean addDebuggingInfoToOutput = false;
@@ -333,6 +339,7 @@ public class TorqueGeneratorTask extends
         unitDescriptor.setOverrideSourceProvider(fileSourceProvider);
         unitDescriptor.setOverrideOptions(optionConfiguration);
         unitDescriptor.setLoglevel(convertedLoglevel);
+        unitDescriptor.setRunOnlyOnSourceChange(runOnlyOnSourceChange);
         unitDescriptor.setAddDebuggingInfoToOutput(addDebuggingInfoToOutput);
         unitDescriptor.setDefaultOutputEncoding(defaultOutputEncoding);
         log("unit descriptor created", Project.MSG_DEBUG);
@@ -374,7 +381,7 @@ public class TorqueGeneratorTask extends
      *
      * @param packaging the packaging, either "jar" or "directory"
      */
-    public void setPackaging(String packaging)
+    public void setPackaging(final String packaging)
     {
         this.packaging = packaging;
     }
@@ -384,17 +391,17 @@ public class TorqueGeneratorTask extends
      *
      * @param projectRootDir the project root Directory.
      */
-    public void setProjectRootDir(File projectRootDir)
+    public void setProjectRootDir(final File projectRootDir)
     {
         this.projectRootDir = projectRootDir;
     }
 
-    public void setConfigDir(File configDir)
+    public void setConfigDir(final File configDir)
     {
         this.configDir = configDir;
     }
 
-    public void setConfigPackage(String configPackage)
+    public void setConfigPackage(final String configPackage)
     {
         this.configPackage = configPackage;
     }
@@ -405,7 +412,7 @@ public class TorqueGeneratorTask extends
      * @param targetDir the default output directory,
      *                  or null to use the default.
      */
-    public void setDefaultOutputDir(File defaultOutputDir)
+    public void setDefaultOutputDir(final File defaultOutputDir)
     {
         this.defaultOutputDir = defaultOutputDir;
     }
@@ -416,7 +423,7 @@ public class TorqueGeneratorTask extends
      *
      * @param outputDirMap the new outputDirMap.
      */
-    public void setOutputDirMap(Map<String, File> outputDirMap)
+    public void setOutputDirMap(final Map<String, File> outputDirMap)
     {
         this.outputDirMap = outputDirMap;
     }
@@ -426,7 +433,7 @@ public class TorqueGeneratorTask extends
      *
      * @param jarFile the jar file, or null.
      */
-    public void setJarFile(String jarFile)
+    public void setJarFile(final String jarFile)
     {
         this.jarFile = jarFile;
     }
@@ -436,7 +443,7 @@ public class TorqueGeneratorTask extends
      *
      * @param sourceDir the directory in which the source files are located.
      */
-    public void setSourceDir(File sourceDir)
+    public void setSourceDir(final File sourceDir)
     {
         this.sourceDir = sourceDir;
     }
@@ -447,7 +454,7 @@ public class TorqueGeneratorTask extends
      * @param sourceIncludes a list containing the include patterns, or null
      *        if no include pattern should be used.
      */
-    public void setSourceIncludes(Set<String> sourceIncludes)
+    public void setSourceIncludes(final Set<String> sourceIncludes)
     {
         this.sourceIncludes = sourceIncludes;
     }
@@ -458,7 +465,7 @@ public class TorqueGeneratorTask extends
      * @param sourceExcludes a list containing the exclude patterns, or null
      *        if no exclude pattern should be used.
      */
-    public void setSourceExcludes(Set<String> sourceExcludes)
+    public void setSourceExcludes(final Set<String> sourceExcludes)
     {
         this.sourceExcludes = sourceExcludes;
     }
@@ -471,7 +478,7 @@ public class TorqueGeneratorTask extends
      * @parameter the config directory overriding the template settings,
      *            or null if the template settings will not be overridden.
      */
-    public void setOverrideConfigDir(File overrideConfigDir)
+    public void setOverrideConfigDir(final File overrideConfigDir)
     {
         this.overrideConfigDir = overrideConfigDir;
     }
@@ -483,7 +490,7 @@ public class TorqueGeneratorTask extends
      *        or error, or null if the loglevel defined in the templates
      *        should be used.
      */
-    public void setLoglevel(String loglevel)
+    public void setLoglevel(final String loglevel)
     {
         this.loglevel = loglevel;
     }
@@ -494,12 +501,25 @@ public class TorqueGeneratorTask extends
      * @param addDebuggingInfoToOutput true if debugging information
      *        should be added to the output, false otherwise.
      */
-    public void setAddDebuggingInfoToOutput(boolean addDebuggingInfoToOutput)
+    public void setAddDebuggingInfoToOutput(final boolean addDebuggingInfoToOutput)
     {
         this.addDebuggingInfoToOutput = addDebuggingInfoToOutput;
     }
 
     /**
+     * Sets whether the generator should only run if one of the source files
+     * changes. The default value is false.
+     *
+     * @param runOnlyOnSourceChange true if the generator should only run
+     *        if one of the source files changes, false if it should
+     *        always run irrespective of changes in the source files.
+     */
+    public void setRunOnlyOnSourceChange(final boolean runOnlyOnSourceChange)
+    {
+        this.runOnlyOnSourceChange = runOnlyOnSourceChange;
+    }
+
+    /**
      * Sets the encoding which should be used for the files which do not have
      * an output encoding set in the templates.
      *
@@ -507,7 +527,7 @@ public class TorqueGeneratorTask extends
      *        or null to use the generator default
      *        (the platform default encoding).
      */
-    public void setDefaultOutputEncoding(String defaultOutputEncoding)
+    public void setDefaultOutputEncoding(final String defaultOutputEncoding)
     {
         this.defaultOutputEncoding = defaultOutputEncoding;
     }
@@ -535,7 +555,7 @@ public class TorqueGeneratorTask extends
      *
      * @param combineFiles whether all sources should be combined.
      */
-    public void setCombineFiles(Boolean combineFiles)
+    public void setCombineFiles(final Boolean combineFiles)
     {
         this.combineFiles = combineFiles;
     }

Modified: db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java?rev=1523801&r1=1523800&r2=1523801&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
(original)
+++ db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
Mon Sep 16 20:39:39 2013
@@ -94,7 +94,7 @@ public class TorqueGeneratorMojo extends
          *
          * @param key the key for the enum.
          */
-        private OutputDirUsage(String key)
+        private OutputDirUsage(final String key)
         {
             this.key = key;
         }
@@ -115,7 +115,7 @@ public class TorqueGeneratorMojo extends
             return key;
         }
 
-        public static OutputDirUsage get(String key)
+        public static OutputDirUsage get(final String key)
             throws MojoExecutionException
         {
             for (OutputDirUsage candidate : values())
@@ -360,6 +360,16 @@ public class TorqueGeneratorMojo extends
     private String loglevel;
 
     /**
+     * True if the generator should only run
+     * if one of the source files changes,
+     * false if it should always run irrespective of changes
+     * in the source files.
+     *
+     * @parameter
+     */
+    private boolean runOnlyOnSourceChange = false;
+
+    /**
      * Whether to add debug information to the output.
      *
      * @parameter
@@ -634,6 +644,7 @@ public class TorqueGeneratorMojo extends
         unitDescriptor.setLoglevel(convertedLoglevel);
         unitDescriptor.setDefaultOutputEncoding(encoding);
         unitDescriptor.setAddDebuggingInfoToOutput(addDebuggingInfoToOutput);
+        unitDescriptor.setRunOnlyOnSourceChange(runOnlyOnSourceChange);
         getLog().debug("unit descriptor created");
         if (overrideConfigDir != null)
         {
@@ -650,6 +661,8 @@ public class TorqueGeneratorMojo extends
             parentUnitDescriptor.setOverrideOptions(optionConfiguration);
             parentUnitDescriptor.setLoglevel(convertedLoglevel);
             parentUnitDescriptor.setDefaultOutputEncoding(encoding);
+            parentUnitDescriptor.setAddDebuggingInfoToOutput(addDebuggingInfoToOutput);
+            parentUnitDescriptor.setRunOnlyOnSourceChange(runOnlyOnSourceChange);
             getLog().debug("child unit descriptor created from directory");
             unitDescriptor = parentUnitDescriptor;
         }
@@ -668,6 +681,8 @@ public class TorqueGeneratorMojo extends
             parentUnitDescriptor.setOverrideOptions(optionConfiguration);
             parentUnitDescriptor.setLoglevel(convertedLoglevel);
             parentUnitDescriptor.setDefaultOutputEncoding(encoding);
+            parentUnitDescriptor.setAddDebuggingInfoToOutput(addDebuggingInfoToOutput);
+            parentUnitDescriptor.setRunOnlyOnSourceChange(runOnlyOnSourceChange);
             getLog().debug("child unit descriptor created from package");
             unitDescriptor = parentUnitDescriptor;
         }
@@ -806,7 +821,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param packaging the packaging, either "jar" or "directory"
      */
-    public void setPackaging(String packaging)
+    public void setPackaging(final String packaging)
     {
         this.packaging = packaging;
     }
@@ -816,17 +831,17 @@ public class TorqueGeneratorMojo extends
      *
      * @param projectRootDir the project root Directory.
      */
-    public void setProjectRootDir(File projectRootDir)
+    public void setProjectRootDir(final File projectRootDir)
     {
         this.projectRootDir = projectRootDir;
     }
 
-    public void setConfigDir(File configDir)
+    public void setConfigDir(final File configDir)
     {
         this.configDir = configDir;
     }
 
-    public void setConfigPackage(String configPackage)
+    public void setConfigPackage(final String configPackage)
     {
         this.configPackage = configPackage;
     }
@@ -836,7 +851,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param outputDir the default output directory, not null.
      */
-    public void setDefaultOutputDir(File outputDir)
+    public void setDefaultOutputDir(final File outputDir)
     {
         this.defaultOutputDir = outputDir;
     }
@@ -847,7 +862,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param targetDir the target directory, or null to use the default.
      */
-    public void setOutputDir(String outputDirKey, String outputDir)
+    public void setOutputDir(final String outputDirKey, final String outputDir)
     {
         this.outputDirMap.put(outputDirKey, outputDir);
     }
@@ -857,7 +872,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param jarFile the jar file, or null.
      */
-    public void setJarFile(String jarFile)
+    public void setJarFile(final String jarFile)
     {
         this.jarFile = jarFile;
     }
@@ -867,7 +882,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param project the maven project this mojo runs in.
      */
-    public void setProject(MavenProject project)
+    public void setProject(final MavenProject project)
     {
         this.project = project;
     }
@@ -877,7 +892,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param defaultOutputDirUsage the new usage, not null.
      */
-    public void setDefaultOutputDirUsage(String defaultOutputDirUsage)
+    public void setDefaultOutputDirUsage(final String defaultOutputDirUsage)
     {
         if (defaultOutputDirUsage == null)
         {
@@ -894,8 +909,8 @@ public class TorqueGeneratorMojo extends
      * @param outputDirUsage the new usage, not null.
      */
     public void setOutputDirUsage(
-            String outputDirKey,
-            String outputDirUsage)
+            final String outputDirKey,
+            final String outputDirUsage)
     {
         if (outputDirKey == null)
         {
@@ -915,7 +930,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param sourceDir the directory in which the source files are located.
      */
-    public void setSourceDir(File sourceDir)
+    public void setSourceDir(final File sourceDir)
     {
         this.sourceDir = sourceDir;
     }
@@ -926,7 +941,7 @@ public class TorqueGeneratorMojo extends
      * @param sourceIncludes a list containing the include patterns, or null
      *        if no include pattern should be used.
      */
-    public void setSourceIncludes(Set<String> sourceIncludes)
+    public void setSourceIncludes(final Set<String> sourceIncludes)
     {
         this.sourceIncludes = sourceIncludes;
     }
@@ -937,7 +952,7 @@ public class TorqueGeneratorMojo extends
      * @param sourceExcludes a list containing the exclude patterns, or null
      *        if no exclude pattern should be used.
      */
-    public void setSourceExcludes(Set<String> sourceExcludes)
+    public void setSourceExcludes(final Set<String> sourceExcludes)
     {
         this.sourceExcludes = sourceExcludes;
     }
@@ -950,7 +965,7 @@ public class TorqueGeneratorMojo extends
      * @parameter the config directory overriding the template settings,
      *            or null if the template settings will not be overridden.
      */
-    public void setOverrideConfigDir(File overrideConfigDir)
+    public void setOverrideConfigDir(final File overrideConfigDir)
     {
         this.overrideConfigDir = overrideConfigDir;
     }
@@ -963,7 +978,7 @@ public class TorqueGeneratorMojo extends
      * @parameter the config package of the project overriding the settings,
      *            or null if the template settings will not be overridden.
      */
-    public void setOverrideConfigPackage(String overrideConfigPackage)
+    public void setOverrideConfigPackage(final String overrideConfigPackage)
     {
         this.overrideConfigPackage = overrideConfigPackage;
     }
@@ -975,7 +990,7 @@ public class TorqueGeneratorMojo extends
      *        or error, or null if the loglevel defined in the templates
      *        should be used.
      */
-    public void setLoglevel(String loglevel)
+    public void setLoglevel(final String loglevel)
     {
         this.loglevel = loglevel;
     }
@@ -988,7 +1003,7 @@ public class TorqueGeneratorMojo extends
      *        or null to use the generator default
      *        (the platform default encoding).
      */
-    public void setDefaultOutputEncoding(String defaultOutputEncoding)
+    public void setDefaultOutputEncoding(final String defaultOutputEncoding)
     {
         this.defaultOutputEncoding = defaultOutputEncoding;
     }
@@ -1000,7 +1015,7 @@ public class TorqueGeneratorMojo extends
      * @param options the overriding options, or null if no options
      *        should be overridden.
      */
-    public void setOptions(Map<String, String> options)
+    public void setOptions(final Map<String, String> options)
     {
         this.options = options;
     }
@@ -1010,7 +1025,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param combineFiles whether the source file should be combined.
      */
-    public void setCombineFiles(Boolean combineFiles)
+    public void setCombineFiles(final Boolean combineFiles)
     {
         this.combineFiles = combineFiles;
     }
@@ -1020,7 +1035,7 @@ public class TorqueGeneratorMojo extends
      *
      * @param workDir the new workdir.
      */
-    public void setWorkDir(File workDir)
+    public void setWorkDir(final File workDir)
     {
         this.workDir = workDir;
     }
@@ -1031,7 +1046,7 @@ public class TorqueGeneratorMojo extends
      * @param optionsFile the path to the file containing the generation
      *        options.
      */
-    public void setOptionsFile(File optionsFile)
+    public void setOptionsFile(final File optionsFile)
     {
         this.optionsFile = optionsFile;
     }
@@ -1042,8 +1057,21 @@ public class TorqueGeneratorMojo extends
      * @param addDebuggingInfoToOutput true if debugging information
      *        should be added to the output, false otherwise.
      */
-    public void setAddDebuggingInfoToOutput(boolean addDebuggingInfoToOutput)
+    public void setAddDebuggingInfoToOutput(final boolean addDebuggingInfoToOutput)
     {
         this.addDebuggingInfoToOutput = addDebuggingInfoToOutput;
     }
+
+    /**
+     * Sets whether the generator should only run if one of the source files
+     * changes. The default value is false.
+     *
+     * @param runOnlyOnSourceChange true if the generator should only run
+     *        if one of the source files changes, false if it should
+     *        always run irrespective of changes in the source files.
+     */
+    public void setRunOnlyOnSourceChange(final boolean runOnlyOnSourceChange)
+    {
+        this.runOnlyOnSourceChange = runOnlyOnSourceChange;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message