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}"/> location="${maven.castor.dest}"/>
<maven:addPath id="maven.compile.src.set" <maven:addPath id="maven.compile.src.set"
refid="maven.castor.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> </goal>
<define:taglib uri="castor"> <define:taglib uri="castor">
<define:tag name="generate"> <define:tag name="generate">
<j:set var="fileVar" value="${schema}.filename"/> <j:set var="fileVar" value="${schema}.filename"/>
<j:set var="uptodateVar" value="${schema}.uptodate"/> <j:set var="uptodateVar" value="${schema}.uptodate"/>
<ant:basename property="${fileVar}" file="${schema}"/> <ant:basename property="${fileVar}" file="${schema}"/>
<!-- wtf? shouldn't this be plugin.context? -->
<j:set var="filename" value="${pom.context.getVariable(fileVar)}"/> <!-- need to jump through some hoops to get values, in order to -->
<j:set var="log" value="${maven.castor.tstamp}"/> <!-- support maven 1.0-beta-10 -->
<j:set var="gen" value="${maven.castor.dest}"/> <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:uptodate property="${uptodateVar}" targetfile="${log}/${filename}">
<ant:srcfiles dir="${basedir}" includes="${schema}"/> <ant:srcfiles dir="${basedir}" includes="${schema}"/>
</ant:uptodate> </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}"> <j:if test="${uptodate == null}">
<ant:echo message="Generating sources for ${schema}"/> <ant:echo message="Generating sources for ${schema}"/>
<ant:java className="org.exolab.castor.builder.SourceGenerator" <ant:java className="org.exolab.castor.builder.SourceGenerator"
fork="${maven.castor.fork}"
failonerror="true"> failonerror="true">
<ant:arg value="-i"/> <ant:arg value="-i"/>
<ant:arg value="${schema}"/> <ant:arg value="${schema}"/>
@ -60,6 +88,8 @@
</j:if> </j:if>
<ant:arg value="-dest"/> <ant:arg value="-dest"/>
<ant:arg value="${gen}"/> <ant:arg value="${gen}"/>
<ant:classpath refid="maven.castor.classpath"/>
</ant:java> </ant:java>
<ant:touch file="${log}/${filename}"/> <ant:touch file="${log}/${filename}"/>
</j:if> </j:if>
@ -68,6 +98,7 @@
<!-- needs to be deprecated --> <!-- needs to be deprecated -->
<define:tag name="srcgen"> <define:tag name="srcgen">
<ant:echo message="DEPRECATED: castor:srcgen. Use castor:generate"/>
<ant:java <ant:java
className="org.exolab.castor.builder.SourceGenerator" className="org.exolab.castor.builder.SourceGenerator"
failonerror="true"> failonerror="true">

View File

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

View File

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

View File

@ -6,6 +6,15 @@
</properties> </properties>
<body> <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"> <release version="1.0" date="2002-08-04">
<action dev="jvanzyl" type="add"> <action dev="jvanzyl" type="add">
Original release for Maven 1.0-beta8 Original release for Maven 1.0-beta8

View File

@ -15,6 +15,14 @@
<th>Description</th> <th>Description</th>
<th>Optional?</th> <th>Optional?</th>
</tr> </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> <tr>
<td>maven.castor.dest</td> <td>maven.castor.dest</td>
<td> <td>