Finally we have the tasks.xml where all the magic occurs:
| <?xml version="1.0"?>
|
| <!--
| JBoss, the OpenSource J2EE webOS
|
| Distributable under LGPL license.
| See terms of license at gnu.org.
| -->
| <project name="jboss.ant.tasks"
| default="help"
| >
| <!-- PROPERTIES -->
|
| <!-- JBoss Tasks Classpath -->
| <property name="jboss.tasks.path"
| value="../jbossbuild/output/eclipse-classes/main"
| />
|
| <!-- TYPEDEFS -->
|
| <!-- The build type -->
| <typedef name="build"
| classname="org.jboss.ant.types.build.Build"
| loaderRef="jboss.tasks.path"
| classpath="${jboss.tasks.path}"
| />
|
| <!-- The artifact type definition type -->
| <typedef name="artifacttype"
| classname="org.jboss.ant.types.build.ArtifactType"
| loaderRef="jboss.tasks.path"
| classpath="${jboss.tasks.path}"
| />
|
| <!-- The component definition type -->
| <typedef name="componentdef"
| classname="org.jboss.ant.types.component.ComponentDefinition"
| loaderRef="jboss.tasks.path"
| classpath="${jboss.tasks.path}"
| />
|
| <!-- The includes type -->
| <typedef name="includes"
| classname="org.jboss.ant.types.Includes"
| loaderRef="jboss.tasks.path"
| classpath="${jboss.tasks.path}"
| />
|
| <!-- The build targets type -->
| <typedef name="targets"
| classname="org.jboss.ant.types.target.TargetDefinitions"
| loaderRef="jboss.tasks.path"
| classpath="${jboss.tasks.path}"
| />
|
| <!-- TASKDEFS -->
|
| <!-- Update ide info for the main build -->
| <taskdef name="idemain"
| classname="org.jboss.ant.tasks.build.IDETask"
| loaderRef="jboss.tasks.path"
| classpath="${jboss.tasks.path}"
| />
|
| <!-- Update ide info for the component -->
| <taskdef name="idecomponent"
| classname="org.jboss.ant.tasks.component.IDETask"
| loaderRef="jboss.tasks.path"
| classpath="${jboss.tasks.path}"
| />
|
| <!-- DEFINITIONS -->
|
| <!-- The artifact types -->
| <artifacttype id="jar" outputtype="lib"/>
| <artifacttype id="api" outputtype="api"/>
|
| <!-- The default targets -->
| <targets id="targets">
|
| <!-- Build All -->
| <targetdef target="all" description="Build All">
| <main depends="build, doc, test, archives" components="none"/>
| <component depends="build, doc, test"/>
| </targetdef>
|
| <!-- Build -->
| <targetdef target="build" description="Build">
|
| <!-- Build the main release -->
| <main>
| <mkdir dir="@{releaseDir}"/>
| <antCall target="release"/>
| </main>
|
| <!-- Build the component -->
| <component>
| <mkdir dir="@{output}"/>
| </component>
|
| <!-- Compile the source -->
| <source>
| <mkdir dir="@{output}"/>
| <depend srcdir="@{sourcePath}" destdir="@{output}">
| <classpath>
| <pathelements/>
| </classpath>
| </depend>
| <javac srcdir="@{sourcePath}" destdir="@{output}">
| <classpath>
| <pathelements/>
| </classpath>
| </javac>
| </source>
|
| <!-- Create a jar archive -->
| <jar>
| <mkdir dir="@{parentDir}"/>
| <jar destfile="@{output}">
| <filesets/>
| </jar>
| </jar>
| </targetdef>
|
| <!-- Build the release -->
| <targetdef target="release">
|
| <!-- Copy the artifact into the release -->
| <artifact when="@{release}">
| <mkdir dir="@{release}"/>
| <copy todir="@{release}">
| <output/>
| </copy>
| </artifact>
| </targetdef>
|
| <!-- Build the release archives -->
| <targetdef target="archives">
|
| <!-- Make the archives -->
| <main>
|
| <!-- Create the zip file -->
| <zip destfile="@{output}/@{releaseName}.zip"
| basedir="@{releaseDir}"
| />
| </main>
| </targetdef>
|
| <!-- Documentation -->
| <targetdef target="doc" description="Documentation">
|
| <!-- Generate the documentation -->
| <component depends="api"/>
| </targetdef>
|
| <!-- Javadoc -->
| <targetdef target="api" description="Javadoc">
|
| <!-- Generate the javadoc -->
| <component/>
| <api>
| <mkdir dir="@{output}"/>
| <javadoc packagenames="*"
| destdir="@{output}"
| >
| <doctitle>
| <![CDATA[<h1>@{description} API Documentation</h1>]]>
| </doctitle>
| <bottom>
| <![CDATA[
| <i>
| <div align="center">
| <font size="-1">
| Copyright © 2005 JBoss Inc. All Rights
Reservered.
| </font>
| </div>
| </i>
| ]]>
| </bottom>
| <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
| <sourcepath>
| <sourcepaths/>
| </sourcepath>
| <classpath>
| <sourcepathelements/>
| </classpath>
| </javadoc>
| </api>
| </targetdef>
|
| <!-- Clean the output -->
| <targetdef target="clean" description="Clean">
| <common>
| <delete dir="@{output}"/>
| </common>
| </targetdef>
|
| <!-- Clobber everything -->
| <targetdef target="clobber" description="Clobber">
| <main depends="clean">
| <delete dir="@{thirdparty}"/>
| </main>
| </targetdef>
|
| <!-- Synchronize -->
| <targetdef target="synchronize" description="Synchronize">
| <main components="none">
| <echo>FIXME cvsupdate ${basedir}</echo>
| <execant target="synchronize.components"/>
| <execant target="synchronize.main.after"/>
| </main>
| <component>
| <echo>FIXME cvsupdate ${basedir}</echo>
| <execant target="synchronize.component.after"/>
| </component>
| <artifact local="false">
| <echo>FIXME download/cvscheckout</echo>
| <mkdir dir="@{parentDir}"/>
| <get src="@{location}"
| dest="@{output}"
| useTimestamp="true"
| verbose="true"
| />
| </artifact>
| </targetdef>
|
| <!-- Commit -->
| <targetdef target="commit" description="Commit">
| <common>
| <echo>FIXME cvscommit</echo>
| </common>
| </targetdef>
|
| <!-- Test -->
| <targetdef target="test" description="Run the Tests">
| <component depends="build, runtest"/>
| </targetdef>
|
| <!-- Run the Test -->
| <targetdef target="runtest">
| <component/>
| <source when="@{test}">
| <mkdir dir="@{testDir}"/>
| <junit fork="true"
| printSummary="true">
| <formatter type="plain"/>
| <classpath>
| <pathElements/>
| </classpath>
| <batchtest todir="@{testDir}">
| <fileset dir="@{sourceDir}" includes="@{test}"/>
| </batchtest>
| </junit>
| </source>
| </targetdef>
| </targets>
|
| <!-- MACROS -->
|
| <!-- The execant macro -->
| <macrodef name="execant">
| <attribute name="dir"
| default="${basedir}"
| description="The directory"
| />
| <attribute name="target"
| description="The target"
| />
| <sequential>
| <!-- Invoke using a new ant -->
| <exec dir="@{dir}"
| executable="ant"
| >
| <arg line="@{target}"/>
| </exec>
| </sequential>
| </macrodef>
|
| <!-- The invoke macro -->
| <macrodef name="invoke">
| <attribute name="dir"
| default="${basedir}"
| description="The directory"
| />
| <attribute name="target"
| description="The target"
| />
| <sequential>
| <!-- Invoke using a new ant -->
| <ant dir="@{dir}" target="@{target}"/>
| </sequential>
| </macrodef>
|
| <!-- TARGETS -->
|
| <target name="rebuild" depends="synchronize" description="Synchronize
then build">
| <execant target="build"/>
| </target>
|
| <target name="rebuildall" depends="synchronize" description="Synchronize
then build all">
| <execant target="all"/>
| </target>
|
| <!-- After synchronization processing for the main build -->
| <target name="synchronize.main.after">
| <idemain/>
| </target>
|
| <!-- After synchronization processing for a component -->
| <target name="synchronize.component.after">
| <idecomponent/>
| </target>
|
| <target name="help">
| <fail message="Do not execute this build fragment directly!"/>
| </target>
|
| </project>
|
|
The elements are as follows:
typedef - this defines the classes that handle the declarations from the other
files
taskdef - standard stuff, in this case I have two custom task to generate ide
files
for the projects (one for the integration bulld, for the component)
definition - this is an implementation detail. Rather than hardwiring what to
do with
each artifact, the artifacttype lets you override parameters like the output
directory
targetdef - this is where the real work is done, there are a number of different
target types each inside a targetdef which I will explain in the next post.
macrodef - these are just ant-1.6 macros which are helpers
targets - some common targets that don't need to defined in the targetdefs (but
they could be
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3860512#3860512
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3860512
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development