You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2010/02/25 10:40:14 UTC
svn commit: r916203 - in
/db/torque/torque4/trunk/maven-torque-generator-plugin/src:
main/java/org/apache/torque/gf/maven/TorqueGfMojo.java
test/gettingStarted/src/main/torque-gf/conf/control.xml
Author: tfischer
Date: Thu Feb 25 09:40:13 2010
New Revision: 916203
URL: http://svn.apache.org/viewvc?rev=916203&view=rev
Log:
Allow source files to be overridden in the Mojo configuration.
Modified:
db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/TorqueGfMojo.java
db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/conf/control.xml
Modified: db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/TorqueGfMojo.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/TorqueGfMojo.java?rev=916203&r1=916202&r2=916203&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/TorqueGfMojo.java (original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/TorqueGfMojo.java Thu Feb 25 09:40:13 2010
@@ -23,6 +23,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.Mojo;
@@ -39,9 +40,10 @@
import org.apache.torque.gf.configuration.paths.Maven2JarProjectPaths;
import org.apache.torque.gf.configuration.paths.ProjectPaths;
import org.apache.torque.gf.control.Controller;
+import org.apache.torque.gf.file.Fileset;
/**
- * Executes a unit of generation within torque-gf.
+ * Executes a unit of generation within the torque generator.
*
* $Id: $
*
@@ -89,6 +91,28 @@
* @parameter
*/
private File sourceDir;
+
+ /**
+ * Include patterns for the source files.
+ * If set, the include and exclude patterns from the templates
+ * are overridden.
+ * If not set, then the include patterns from the templates are used.
+ * The patterns are case sensitive, wildcards are * and ?.
+ *
+ * @parameter
+ */
+ private Set<String> sourceIncludes;
+
+ /**
+ * Exclude patterns for the source files.
+ * If set, the include and exclude patterns from the templates
+ * are overridden.
+ * If not set, then the include patterns from the templates are used.
+ * The patterns are case sensitive, wildcards are * and ?.
+ *
+ * @parameter
+ */
+ private Set<String> sourceExcludes;
/**
* The target directory for files which are generated each time anew.
@@ -237,6 +261,16 @@
getLog().debug("Setting source dir to " + sourceDir.toString());
}
+ Fileset sourceFileset = null;
+ if (sourceIncludes != null || sourceExcludes != null)
+ {
+ sourceFileset = new Fileset(null, sourceIncludes, sourceExcludes);
+ getLog().debug("Setting source includes to "
+ + sourceIncludes.toString());
+ getLog().debug("Setting source excludes to "
+ + sourceExcludes.toString());
+ }
+
if (newFileTargetDir != null)
{
projectPaths.setNewFileTargetDir(newFileTargetDir);
@@ -266,6 +300,7 @@
projectPaths,
new DefaultTorqueGfPaths(),
null,
+ sourceFileset,
optionConfiguration,
convertedLoglevel);
getLog().debug("unit descriptor created");
@@ -279,6 +314,7 @@
childProjectPaths,
new DefaultTorqueGfPaths(),
unitDescriptor,
+ sourceFileset,
optionConfiguration,
convertedLoglevel);
getLog().debug("child unit descriptor created");
@@ -286,7 +322,7 @@
unitDescriptors.add(unitDescriptor);
try
{
- getLog().debug("about to run controller");
+ getLog().debug("Generation started");
controller.run(unitDescriptors);
getLog().info("Generation successful");
}
Modified: db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/conf/control.xml?rev=916203&r1=916202&r2=916203&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/conf/control.xml (original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/conf/control.xml Thu Feb 25 09:40:13 2010
@@ -24,7 +24,9 @@
loglevel="debug">
<output name="propertyKeys"
file="org/apache/torque/gf/example/gettingstarted/PropertyKeys.java">
- <source path="propertiesData.properties"/>
+ <source>
+ <include>propertiesData.properties</include>
+ </source>
<generator name="classFrame"/>
</output>
</control>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org