> <taskdef resource="bb-ant-defs.xml"
> classpath="${user.home}/.ant/lib/bb-ant-tools.jar" />
> <taskdef resource="net/sf/antcontrib/antlib.xml"
> classpath="${user.home}/.ant/lib/ant-contrib.jar" uri =
> "http://ant-contrib.sourceforge.net" description = "Needed to use
> ant-contrib." />
Another way of "installing" would be using Apache Ivy.
http://ant.apache.org/ivy/
>From Ant's check.xml:
<target name="init-ivy">
<property name="ivy.version" value="2.0.0-beta1"/>
<property name="ivy.jar.url"
value="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/i
vy-${ivy.version}.jar"/>
<property name="ivy.jar.dir" value="${build.dir}/ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<mkdir dir="${ivy.jar.dir}"/>
<get src="${ivy.jar.url}" dest="${ivy.jar.file}"
usetimestamp="true"/>
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="checkstyle" description="--> checks Ant codebase
according to ${config.dir}/checkstyle-config" depends="init-ivy">
<ivy:cachepath organisation="checkstyle" module="checkstyle"
revision="4.3"
inline="true" conf="default"
pathid="checkstyle.classpath" transitive="true"/>
<taskdef resource="checkstyletask.properties"
classpathref="checkstyle.classpath" />
<mkdir dir="${checkstyle.reportdir}"/>
<checkstyle config="${config.dir}/checkstyle-config"
failOnViolation="false">
<formatter type="xml" toFile="${checkstyle.raw}"/>
<fileset dir="${java.dir}">
<include name="${tocheck}"/>
<exclude name="**/bzip2/*.java"/>
<exclude name="**/CVSPass.java"/>
</fileset>
</checkstyle>
</target>
"init-ivy" loads the Ivy jar directly from the repository. This is Ivys
bootstrapping ;)
"checkstyle" uses "ivy:cachepath" for
- downloading the specified version of the specified artifact (here
Checkstyle 4.3) with
its dependencies (like
- caching the download
- creating an Ant path (pathid="...") with these files
The <taskdef> the could refer to that created path.
Finally it runs the task.
> <!-- MACROS -->
> <macrodef name="my.rapc">
> <attribute name="entryfile" default="--file
not-available--"/>
> <attribute name="output" default="${cod.name}"/>
> <attribute name="srcdir" default="${src.dir}"/>
> <attribute name="destdir" default="${build.dir}"/>
> <attribute name="jdp" default="project.properties"/>
> <element name="inside-rapc" implicit="true"/>
> <sequential>
> <ant-contrib:if>
> <available file="@{entryfile}"/>
> <then>
> <echo message="AltEntry
> exists" />
> <rapc
> output="@{output}" srcdir="@{srcdir}" destdir="@{destdir}">
> <jdp file="@{jdp}">
> <entry
> file="@{entryfile}" />
> </jdp>
> <inside-rapc/>
> </rapc>
> </then>
> <else>
> <echo message="AltEntry
> does not exist" />
> <rapc
> output="@{output}" srcdir="@{srcdir}" destdir="@{destdir}">
> <jdp file="@{jdp}" />
> <inside-rapc/>
> </rapc>
> </else>
> </ant-contrib:if>
> </sequential>
> </macrodef>
>
> <!-- Build cod -->
> <target name="-build" depends="-deps, -init">
> <mkdir dir="${build.dir}" />
> <my.rapc entryfile="entryGUI.properties">
> <import>
> <fileset
> dir="${common.basedir}/.." includes="${deps.list}/build/*.jar" />
> </import>
> <src>
> <fileset dir="${src.dir}">
> <include name="**/*.java" />
> <include name="**/*.png" />
> <include
> name="resources/**/*.*" />
> </fileset>
> </src>
If that <src><fileset dir="${src.dir}"/> is always the same you could
move that into the macro as well.
<macrodef ...>
<attribute name="srcdir" default="${src.dir}"/>
<attribute name="src-includes" default="**/*.java,**/*.png"/>
...
<rapc ...>
...
<src><fileset dir="@{srcdir}"
includes="@{src-includes}"/></src>
of course in both paths of the if-then-else ;)
Additional the first statement in the <sequential> could be the <mkdir
dir="@{destdir}"/> for
creating that directory. Maybe also the "output" directory (dont know
that meaning).
<target name="-build" depends="-deps, -init">
<my.rapc entryfile="entryGUI.properties">
<import>
<fileset dir="${common.basedir}/.."
includes="${deps.list}/build/*.jar" />
</import>
</my.rapc>
</target>
Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]