maven-plugins/castor/plugin.jelly
2003-11-10 01:53:01 +00:00

87 lines
3.0 KiB
XML

<?xml version="1.0"?>
<project xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:define="jelly:define"
xmlns:castor="castor"
xmlns:maven="jelly:maven">
<!-- ================================================================== -->
<!-- C A S T O R -->
<!-- ================================================================== -->
<goal name="castor:prepare-filesystem"
description="Make any necessary directories for castor processing">
<ant:mkdir dir="${maven.castor.dest}"/>
<ant:mkdir dir="${maven.castor.tstamp}"/>
<ant:path id="maven.castor.compile.src.set"
location="${maven.castor.dest}"/>
<maven:addPath id="maven.compile.src.set"
refid="maven.castor.compile.src.set"/>
</goal>
<define:taglib uri="castor">
<define:tag name="generate">
<j:set var="fileVar" value="${schema}.filename"/>
<j:set var="uptodateVar" value="${schema}.uptodate"/>
<ant:basename property="${fileVar}" file="${schema}"/>
<!-- wtf? shouldn't this be plugin.context? -->
<j:set var="filename" value="${pom.context.getVariable(fileVar)}"/>
<j:set var="log" value="${maven.castor.tstamp}"/>
<j:set var="gen" value="${maven.castor.dest}"/>
<ant:uptodate property="${uptodateVar}" targetfile="${log}/${filename}">
<ant:srcfiles dir="${basedir}" includes="${schema}"/>
</ant:uptodate>
<!-- wtf? shouldn't this be plugin.context? -->
<j:set var="uptodate"
value="${pom.context.getVariable(uptodateVar)}"/>
<j:if test="${uptodate == null}">
<ant:echo message="Generating sources for ${schema}"/>
<ant:java className="org.exolab.castor.builder.SourceGenerator"
failonerror="true">
<ant:arg value="-i"/>
<ant:arg value="${schema}"/>
<ant:arg value="-f"/>
<j:if test="${!empty(package)}">
<ant:arg value="-package"/>
<ant:arg value="${package}"/>
</j:if>
<j:if test="${!empty(types)}">
<ant:arg value="-types"/>
<ant:arg value="${types}"/>
</j:if>
<j:if test="${!empty(marshal) and !marshal.trim().equals('true')}">
<ant:arg value="-nomarshall"/>
</j:if>
<ant:arg value="-dest"/>
<ant:arg value="${gen}"/>
</ant:java>
<ant:touch file="${log}/${filename}"/>
</j:if>
</define:tag>
<!-- needs to be deprecated -->
<define:tag name="srcgen">
<ant:java
className="org.exolab.castor.builder.SourceGenerator"
failonerror="true">
<ant:arg value="-i${schema}"/>
<ant:arg value="-f"/>
<ant:arg value="-package${package}"/>
<ant:arg value="-types${types}"/>
<ant:arg value="-nomarshall"/>
<ant:arg value="-dest${generationDirectory}"/>
</ant:java>
</define:tag>
</define:taglib>
</project>