jdillon 2003/09/01 10:31:26
Modified: etc maven.xml
Log:
o added functional castor:generate tag
o using uptodate to prevent xdoclet from running when nothing has changed
Revision Changes Path
1.15 +114 -20 incubator-geronimo/etc/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/etc/maven.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- maven.xml 1 Sep 2003 16:46:34 -0000 1.14
+++ maven.xml 1 Sep 2003 17:31:26 -0000 1.15
@@ -8,7 +8,8 @@
xmlns:ant="jelly:ant"
xmlns:maven="jelly:maven"
xmlns:define="jelly:define"
- xmlns:xdoclet="common:xdoclet">
+ xmlns:xdoclet="common:xdoclet"
+ xmlns:castor="common:castor">
<!-- ================= -->
<!-- Global Properties -->
@@ -147,6 +148,7 @@
</goal>
+
<!-- =================== -->
<!-- XDoclet Integration -->
<!-- =================== -->
@@ -167,27 +169,40 @@
<maven:addPath id="${appendSet}"
refid="xdoclet.jmx.compile.src.set"/>
</j:if>
- <echo>Generating MBean interfaces...</echo>
-
- <!-- Load the jmxdoclet task -->
- <taskdef name="jmxdoclet"
classname="xdoclet.modules.jmx.JMXDocletTask">
- <classpath>
- <path refid="maven.dependency.classpath"/>
- </classpath>
- </taskdef>
-
- <!-- Where sources will be generated -->
- <mkdir dir="${destdir}"/>
+ <j:set var="uptodatePropName" value="xdoclet.jmx.uptodate"/>
+ <j:remove var="${uptodatePropName}"/>
+ <j:set var="uptodateFile" value="${destdir}/tstamp"/>
+
+ <uptodate property="${uptodatePropName}"
+ targetfile="${uptodateFile}">
+ <srcfiles dir= "${srcdic}" includes="**/*.java"/>
+ </uptodate>
- <!-- Generate MBean interfaces -->
- <jmxdoclet destDir="${destdir}" verbose="false">
+ <j:if test="${context.getVariable(uptodatePropName) == null}">
+ <echo>Generating MBean interfaces...</echo>
- <fileset dir="${srcdir}">
- <include name="**/*.java"/>
- </fileset>
+ <!-- Load the jmxdoclet task -->
+ <taskdef name="jmxdoclet"
classname="xdoclet.modules.jmx.JMXDocletTask">
+ <classpath>
+ <path refid="maven.dependency.classpath"/>
+ </classpath>
+ </taskdef>
+
+ <!-- Where sources will be generated -->
+ <mkdir dir="${destdir}"/>
- <mbeaninterface
templateFile="${project.root}/etc/xdoclet/template/jmx/mbean.xdt"/>
- </jmxdoclet>
+ <!-- Generate MBean interfaces -->
+ <jmxdoclet destDir="${destdir}" verbose="false">
+
+ <fileset dir="${srcdir}">
+ <include name="**/*.java"/>
+ </fileset>
+
+ <mbeaninterface
templateFile="${project.root}/etc/xdoclet/template/jmx/mbean.xdt"/>
+ </jmxdoclet>
+
+ <touch file="${uptodateFile}"/>
+ </j:if>
</define:tag>
</define:taglib>
@@ -206,4 +221,83 @@
appendSet="maven.test.compile.src.set"/>
</goal>
+
+ <!-- ===================================== -->
+ <!-- Castor Integration (Plugin is Broken) -->
+ <!-- ===================================== -->
+
+ <define:taglib uri="common:castor">
+
+ <define:tag name="generate" xmlns="jelly:ant">
+ <j:if test="${schema == null}">
+ <fail>Missing required attribute: schema</fail>
+ </j:if>
+ <j:if test="${package == null}">
+ <fail>Missing required attribute: package</fail>
+ </j:if>
+ <!-- types can be null -->
+ <!-- marshal can be null -->
+ <!-- binding can be null -->
+
+ <j:set var="maven.castor.dest" value="${basedir}/target/castor/gen"/>
+ <mkdir dir="${maven.castor.dest}"/>
+
+ <path id="maven.castor.compile.src.set"
+ location="${maven.castor.dest}"/>
+ <maven:addPath id="maven.compile.src.set"
+ refid="maven.castor.compile.src.set"/>
+
+ <j:new var="schemaFile" className="java.io.File">
+ <j:arg type="java.lang.String" value="${schema}"/>
+ </j:new>
+
+ <j:set var="uptodatePropName"
value="castor.schema.${schemaFile.name}.uptodate"/>
+ <j:remove var="${uptodatePropName}"/>
+ <j:set var="uptodateFile"
value="${basedir}/target/castor/${schemaFile.name}.tstamp"/>
+
+ <uptodate property="${uptodatePropName}"
+ srcfile="${schema}"
+ targetfile="${uptodateFile}"/>
+
+ <j:if test="${context.getVariable(uptodatePropName) == null}">
+ <echo message="Generating sources for ${schema}"/>
+
+ <path id="castor.classpath">
+ <path refid="maven.dependency.classpath"/>
+ </path>
+
+ <java className="org.exolab.castor.builder.SourceGenerator"
+ failonerror="true" fork="yes">
+ <classpath refid="castor.classpath"/>
+ <arg value="-i"/>
+ <arg value="${schema}"/>
+
+ <j:if test="${binding != null}">
+ <arg value="-binding-file"/>
+ <arg value="${binding}"/>
+ </j:if>
+
+ <arg value="-package"/>
+ <arg value="${package}"/>
+
+ <j:if test="${types != null}">
+ <arg value="-types"/>
+ <arg value="${types}"/>
+ </j:if>
+
+ <j:if test="${marshal == 'false'}">
+ <arg value="-nomarshall"/>
+ </j:if>
+
+ <arg value="-f"/>
+ <arg value="-dest"/>
+ <arg value="${maven.castor.dest}"/>
+ </java>
+
+ <touch file="${uptodateFile}"/>
+ </j:if>
+
+ </define:tag>
+ </define:taglib>
+
</project>