Upgraded common build script.

This commit is contained in:
Jonathan Bernard 2011-01-21 11:21:03 -06:00
parent 2b256c1d27
commit 8a6181fc84
2 changed files with 56 additions and 35 deletions

View File

@ -2,7 +2,7 @@
<property file="project.properties"/> <property file="project.properties"/>
<import file="jdb-build-1.4.xml"/> <import file="jdb-build-1.5.xml"/>
<target name="package" depends="-build-modular"> <target name="package" depends="-build-modular">
<copy <copy

View File

@ -3,6 +3,20 @@
<property environment="env"/> <property environment="env"/>
<!--======== INIT TARGETS ========-->
<target name="-init" depends="-common-init,init"/>
<target name="-common-init">
<!-- Set default values for some key properties. Since properties are
write once, any value set before this point takes precedence. -->
<property name="versioning.file" value="project.properties"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="resources.dir" value="${basedir}/resources"/>
<!--======== PATHS ========--> <!--======== PATHS ========-->
<path id="groovy.classpath"> <path id="groovy.classpath">
<fileset dir="${env.GROOVY_HOME}/lib"> <fileset dir="${env.GROOVY_HOME}/lib">
@ -28,19 +42,17 @@
</fileset> </fileset>
</path> </path>
<!--======== INIT TARGETS ========-->
<target name="-init" depends="-common-init,init"/>
<target name="-common-init">
<property name="versioning.file" value="project.properties"/>
</target> </target>
<target name="-init-groovy"> <target name="-init-groovy">
<taskdef name="groovyc" classpathref="groovy.classpath" <taskdef name="groovyc" classpathref="groovy.classpath"
classname="org.codehaus.groovy.ant.Groovyc"/> classname="org.codehaus.groovy.ant.Groovyc"/>
<taskdef name="groovy" classpathref="groovy.classpath"
classname="org.codehaus.groovy.ant.Groovy"/>
</target> </target>
<target name="clean"> <target name="clean" depends="-init">
<delete dir="${build.dir}"/> <delete dir="${build.dir}"/>
</target> </target>
@ -50,11 +62,14 @@
<target name="-lib-ivy" unless="${lib.local}"/> <target name="-lib-ivy" unless="${lib.local}"/>
<target name="-lib-local" if="${lib.local}"> <target name="-lib-local" if="${lib.local}">
<copy todir="${build.dir}/lib/compile/jar"> <echo message="Resolving libraries locally."/>
<mkdir dir="${build.dir}/lib/compile/jar"/>
<mkdir dir="${build.dir}/lib/runtime/jar"/>
<copy todir="${build.dir}/lib/compile/jar" failonerror="false">
<fileset dir="${lib.dir}/compile/jar"/> <fileset dir="${lib.dir}/compile/jar"/>
</copy> </copy>
<copy todir="${build.dir}/lib/runtime/jar"> <copy todir="${build.dir}/lib/runtime/jar" failonerror="false">
<fileset dir="${lib.dir}/runtime/jar"/> <fileset dir="${lib.dir}/runtime/jar"/>
</copy> </copy>
</target> </target>
@ -79,7 +94,8 @@
<!--======== COMPILATION TARGETS ========--> <!--======== COMPILATION TARGETS ========-->
<target name="-compile-groovy" depends="-init,-init-groovy,lib"> <target name="-compile-groovy" depends="-init,-init-groovy,lib">
<groovyc srcdir="${src.dir}" destdir="${build.dir}/main/classes" <mkdir dir="${build.dir}/main/classes"/>
<groovyc srcdir="${src.dir}/main" destdir="${build.dir}/main/classes"
includeAntRuntime="false"> includeAntRuntime="false">
<classpath> <classpath>
@ -91,7 +107,8 @@
</target> </target>
<target name="-compile-java" depends="-init,lib"> <target name="-compile-java" depends="-init,lib">
<javac srcdir="${src.dir}" destdir="${build.dir}/main/classes" <mkdir dir="${build.dir}/main/classes"/>
<javac srcdir="${src.dir}/main" destdir="${build.dir}/main/classes"
includeAntRuntime="false" classpathref="compile-libs"/> includeAntRuntime="false" classpathref="compile-libs"/>
</target> </target>
@ -99,7 +116,8 @@
<!--======== JUNIT TARGETS ========--> <!--======== JUNIT TARGETS ========-->
<target name="-compile-tests-groovy" depends="-init,compile"> <target name="-compile-tests-groovy" depends="-init,compile">
<groovyc srcdir="${test.dir}" destdir="${build.dir}/test/classes" <mkdir dir="${build.dir}/test/classes"/>
<groovyc srcdir="${src.dir}/test" destdir="${build.dir}/test/classes"
includeAntRuntime="false"> includeAntRuntime="false">
<classpath> <classpath>
@ -111,7 +129,8 @@
</target> </target>
<target name="-compile-tests-java" depends="-init,compile"> <target name="-compile-tests-java" depends="-init,compile">
<javac srcdir="${test.dir}" destdir="${build.dir}/test/classes" <mkdir dir="${build.dir}/test/classes"/>
<javac srcdir="${src.dir}/test" destdir="${build.dir}/test/classes"
includeAntRuntime="false"> includeAntRuntime="false">
<classpath> <classpath>
<path refid="compile-libs"/> <path refid="compile-libs"/>
@ -142,13 +161,15 @@
<!--======== RESOURCES TARGETS ========--> <!--======== RESOURCES TARGETS ========-->
<target name="resources" depends="-init"> <target name="resources" depends="-init">
<copy todir="${build.dir}/main/classes"> <mkdir dir="${build.dir}/main/classes"/>
<copy todir="${build.dir}/main/classes" failonerror="false">
<fileset dir="${resources.dir}/main/"/> <fileset dir="${resources.dir}/main/"/>
</copy> </copy>
</target> </target>
<target name="resources-test" depends="-init"> <target name="resources-test" depends="-init">
<copy todir="${build.dir}/test/classes"> <mkdir dir="${build.dir}/test/classes"/>
<copy todir="${build.dir}/test/classes" failonerror="false">
<fileset dir="${resources.dir}/test/"/> <fileset dir="${resources.dir}/test/"/>
</copy> </copy>
</target> </target>