blob: 2a23d3cc0e4c42b59848f2fc49d4ff2a5c2489e1 [file] [log] [blame]
<project default="java:jar" xmlns:j="jelly:core" xmlns:maven="jelly:maven" xmlns:util="jelly:util">
<!-- define the classpath used to run examples -->
<goal name="create-classpath" prereqs="java:compile,test:compile">
<path id="test.classpath">
<pathelement path="${maven.build.dest}"/>
<pathelement path="target/classes"/>
<pathelement path="target/test-classes"/>
<path refid="maven.dependency.classpath"/>
</path>
</goal>
<!-- runs the XML doclet -->
<goal name="doclet:xml" prereqs="java:compile">
<path id="doclet.classpath">
<pathelement path="${maven.build.dest}"/>
<path refid="maven.dependency.classpath"/>
</path>
<javadoc
sourcepath="src/java"
packagenames="org.apache.commons.jelly.tags.*"
doclet="org.apache.commons.jelly.util.XMLDoclet"
docletpathref="doclet.classpath">
</javadoc>
</goal>
<!-- runs the Tag doclet -->
<goal name="doclet:tag" prereqs="java:compile">
<path id="doclet.classpath">
<pathelement path="target/classes"/>
<pathelement path="${maven.build.dest}"/>
<path refid="maven.dependency.classpath"/>
</path>
<javadoc
sourcepath="src/java"
packagenames="org.apache.commons.jelly.tags.*"
doclet="org.apache.commons.jelly.util.TagXMLDoclet"
docletpathref="doclet.classpath">
</javadoc>
</goal>
<!-- creates the XML webpage from the tag XML information -->
<goal name="doc:tags" prereqs="doclet:tag, create-classpath"
description="Generates the tag documentation">
<mkdir dir="target/generated-xdocs"/>
<java classname="org.apache.commons.jelly.Jelly" fork="yes">
<classpath refid="test.classpath"/>
<arg value="src/script/makeTagDoc.jelly"/>
<arg value="-o"/>
<arg value="target/generated-xdocs/tags.xml"/>
</java>
</goal>
<!-- ensure that the tag documentation is generated as part of the site -->
<preGoal
name="site:generate">
<attainGoal name="doc:tags"/>
</preGoal>
<!-- create the lib and bin directories in the binary distro -->
<preGoal name="dist:build">
<echo>About to create lib and bin directories in ${maven.dist.assembly.dir}</echo>
<mkdir dir="${maven.dist.assembly.dir}/bin"/>
<mkdir dir="${maven.dist.assembly.dir}/lib"/>
<mkdir dir="${maven.dist.assembly.dir}/custom"/>
<copy todir="${maven.dist.assembly.dir}/bin">
<fileset dir="src/bin"/>
</copy>
<chmod file="${maven.dist.assembly.dir}/bin/jelly" perm="ugo+rx" />
<j:forEach var="dep" items="${pom.dependencies}">
<j:choose>
<j:when test="${dep.id == 'forehead'}">
<copy tofile="${maven.dist.assembly.dir}/lib/forehead.jar"
file="${maven.repo.local}/${dep.projectId}/jars/${dep.artifact}"/>
</j:when>
<j:otherwise>
<copy todir="${maven.dist.assembly.dir}/lib"
file="${maven.repo.local}/${dep.projectId}/jars/${dep.artifact}"/>
</j:otherwise>
</j:choose>
</j:forEach>
<!-- put a copy of Jelly's jar there too -->
<copy todir="${maven.dist.assembly.dir}/lib"
file="${maven.build.dir}/${maven.final.name}.jar"/>
</preGoal>
<!-- TAG LIBS BUILD -->
<goal
name="tags-build"
description="Build each tag into an installable jar">
<maven:reactor
basedir="jelly-tags"
includes="*/project.xml"
goals="clean,jar:install"
banner="Building tag"
ignoreFailures="false"/>
</goal>
<!-- ===================================================================== -->
<!-- D I S T : I N S T A L L -->
<!-- ===================================================================== -->
<!-- This installs Jelly on your system. With an installed Jelly, you'll -->
<!-- be able to run Jelly scripts from wherever your are, using : -->
<!-- "jelly <script> <outputfile>". -->
<!-- The installation dir is set in the project.properties file, under the -->
<!-- name "maven.dist.install.dir", which defaults to "/usr/local/jelly" -->
<!-- (yep, that's a Linux path :). Please override it to suit your needs -->
<!-- ===================================================================== -->
<goal name="dist:install"
description="Installs Jelly on your system."
prereqs="dist:build">
<echo>
+-------------------------------------------------------+
| I N S T A L L I N G J E L L Y |
+-------------------------------------------------------+
</echo>
<mkdir dir="${maven.dist.install.dir}"/>
<copy todir="${maven.dist.install.dir}">
<fileset dir="${maven.dist.assembly.dir}"/>
</copy>
<chmod file="${maven.dist.install.dir}/bin/jelly" perm="ugo+rx" />
<echo>
* ===================================================== *
* W A R N I N G *
* ===================================================== *
* Jelly is now almost installed on your system ! *
* Next, you must set JELLY_HOME to point to *
* "maven.dist.install.dir", and add JELLY_HOME/bin *
* to your PATH. *
* *
* Then, you will be able to run Jelly scripts using the *
* command : "jelly script outputfile". *
* *
* Enjoy ! *
* ===================================================== *
</echo>
</goal>
<!-- demo programs -->
<!-- a sample of using the command line interface to invoke Jelly -->
<goal name="demo:cmdline" prereqs="create-classpath"
description="Demonstrates how to use the command line interface to Jelly">
<java classname="org.apache.commons.jelly.Jelly" fork="yes">
<classpath refid="test.classpath"/>
<arg value="src/test/org/apache/commons/jelly/testCmdLineOptions.jelly"/>
<arg value="-a"/>
<arg value="valueOfA"/>
<arg value="-b"/>
<arg value="valueOfB"/>
<arg value="-c"/>
<arg value="valueOfC"/>
<arg value="-Dtestsysprop=valueOfTestSystemProp"/>
</java>
</goal>
<goal name="test:benchmark" prereqs="create-classpath"
description="A simple bit of Jelly script used as a benchmark to guage performance">
<java classname="org.apache.commons.jelly.Jelly" fork="yes">
<classpath refid="test.classpath"/>
<arg value="src/test/org/apache/commons/jelly/benchmark/benchmark.jelly"/>
</java>
</goal>
<goal name="demo:embed" prereqs="create-classpath"
description="A sample Swing app which lets you build a personalized homepage, and uses Jelly as a templating engine">
<java classname="org.apache.commons.jelly.demos.HomepageBuilder" fork="yes">
<classpath refid="test.classpath"/>
</java>
</goal>
<goal name="demo:async"
description="An example of using asynchronous invocation of goals">
<j:thread>
<attainGoal name="demo:asyncOtherThread"/>
</j:thread>
<echo>XXXX</echo>
<!-- FIXME: util now in a sep taglib <util:sleep millis="1000"/> -->
</goal>
<goal name="demo:asyncOtherThread"
description="A private target invoked by the async demo">
<echo>YYYY</echo>
</goal>
<!-- NOTE that the following 2 postGoals can be removed when we can assume 1.0 Maven everywhere -->
<!-- copies JAR resources stuff -->
<postGoal name="java:compile">
<copy todir="${maven.build.dest}">
<fileset dir="src/java">
<include name="**/*.properties"/>
</fileset>
</copy>
</postGoal>
<!-- copies unit testing stuff -->
<postGoal name="test:compile">
<copy todir="${maven.test.dest}">
<fileset dir="src/test">
<include name="**/*.properties"/>
<include name="META-INF/services/*"/>
<include name="**/*.jelly"/>
<include name="**/*.xml"/>
<include name="**/*.html"/>
<include name="**/*.dtd"/>
<include name="**/*.rng"/>
</fileset>
</copy>
</postGoal>
</project>