Apply MPCASTOR-2

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114664 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion 2004-02-03 00:28:03 +00:00
parent 4218dfe96c
commit 78f1aafd8b
5 changed files with 64 additions and 9 deletions

View File

@ -19,30 +19,58 @@
location="${maven.castor.dest}"/>
<maven:addPath id="maven.compile.src.set"
refid="maven.castor.compile.src.set"/>
<!-- determine if SourceGenerator needs to be run in a separate JVM, -->
<!-- to pick up the castorbuilder.properties file -->
<j:set var="dir" value="${maven.castor.properties.dir}"/>
<j:choose>
<!-- NOTE: need to set temp 'dir' var as -->
<!-- !empty{maven.castor.properties.dir} doesn't -->
<!-- work as expected. -->
<j:when test="${!empty(dir)}">
<ant:property name="maven.castor.fork" value="true"/>
<ant:path id="maven.castor.classpath">
<ant:path refid="maven.dependency.classpath"/>
<ant:pathelement location="${maven.castor.properties.dir}"/>
</ant:path>
</j:when>
<j:otherwise>
<ant:property name="maven.castor.fork" value="false"/>
<ant:path id="maven.castor.classpath">
<ant:path refid="maven.dependency.classpath"/>
</ant:path>
</j:otherwise>
</j:choose>
</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}"/>
<!-- need to jump through some hoops to get values, in order to -->
<!-- support maven 1.0-beta-10 -->
<j:set var="filename"
value="${pom.context.getVariable(fileVar)}"/>
<j:set var="context"
value="${pom.getPluginContext('maven-castor-plugin')}"/>
<j:set var="log" value="${context.getVariable('maven.castor.tstamp')}"/>
<j:set var="gen" value="${context.getVariable('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: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"
fork="${maven.castor.fork}"
failonerror="true">
<ant:arg value="-i"/>
<ant:arg value="${schema}"/>
@ -60,6 +88,8 @@
</j:if>
<ant:arg value="-dest"/>
<ant:arg value="${gen}"/>
<ant:classpath refid="maven.castor.classpath"/>
</ant:java>
<ant:touch file="${log}/${filename}"/>
</j:if>
@ -68,6 +98,7 @@
<!-- needs to be deprecated -->
<define:tag name="srcgen">
<ant:echo message="DEPRECATED: castor:srcgen. Use castor:generate"/>
<ant:java
className="org.exolab.castor.builder.SourceGenerator"
failonerror="true">

View File

@ -5,5 +5,6 @@
# keep them apart from the project specific properties.
# -------------------------------------------------------------------
maven.castor.properties.dir=
maven.castor.dest=${maven.build.dir}/castor/src
maven.castor.tstamp=${maven.build.dir}/castor/tstamp

View File

@ -5,7 +5,7 @@
<pomVersion>3</pomVersion>
<id>maven-castor-plugin</id>
<name>Maven Castor Plug-in</name>
<currentVersion>1.0</currentVersion>
<currentVersion>1.1-SNAPSHOT</currentVersion>
<description>Various goals for making development with Plexus easy.</description>
<shortDescription>Plexus Tools</shortDescription>
<url>http://maven.apache.org/reference/plugins/castor/</url>
@ -26,11 +26,17 @@
</roles>
</developer>
</developers>
<contributors>
<contributor>
<name>Tim Anderson</name>
<email>tma@netspace.net.au</email>
</contributor>
</contributors>
<dependencies>
<dependency>
<groupId>castor</groupId>
<artifactId>castor</artifactId>
<version>0.9.4.3</version>
<version>0.9.5</version>
<properties>
<classloader>root</classloader>
</properties>

View File

@ -6,6 +6,15 @@
</properties>
<body>
<release version="1.1" date="in CVS">
<action dev="tima" type="add">
Added <em>maven.castor.properties.dir</em> property.
</action>
<action dev="tima" type="update">
Updated to castor 0.9.5
</action>
</release>
<release version="1.0" date="2002-08-04">
<action dev="jvanzyl" type="add">
Original release for Maven 1.0-beta8

View File

@ -15,6 +15,14 @@
<th>Description</th>
<th>Optional?</th>
</tr>
<tr>
<td>maven.castor.properties.dir</td>
<td>
Specifies the directory to locate the
<em>castorbuilder.properties</em> file.
</td>
<td>Yes</td>
</tr>
<tr>
<td>maven.castor.dest</td>
<td>