From 36816ec8660c0bdf964d8d6e745754382c9f001f Mon Sep 17 00:00:00 2001
Message-Id:
<36816ec8660c0bdf964d8d6e745754382c9f001f.1350037981.git.cbley(a)av-test.de>
In-Reply-To: <cover.1350037981.git.cbley(a)av-test.de>
References:
<2DA6F4A3691599408358374D182280F9141CF6(a)xmb-rcd-x04.cisco.com> <cover.1350037981.git.cbley(a)av-test.de>
From: cbley(a)av-test.de (Claudio Bley)
Date: Thu, 23 Aug 2012 09:36:39 +0200
Subject: [PATCH 10/15] Split "build" target and automatically rebuild out of
date files.
To: libvir-list(a)redhat.com
Organization: AV-Test GmbH, Germany
The "build" target was split into these individual targets:
"build" (default target) only compiles the main files
"jar" packages the main files into a jar
"buildtests" compiles the test classes
The class files are rebuild when any of their dependent source
file changed.
---
build.xml | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/build.xml b/build.xml
index 4b73562..970b91a 100644
--- a/build.xml
+++ b/build.xml
@@ -33,6 +33,7 @@
<target name="init">
<mkdir dir="target/classes" />
<mkdir dir="target/testclasses" />
+ <mkdir dir="target/cache" />
<copy file="README.in" tofile="README"
overwrite="true" filtering="true">
<filterset filtersfile="build.properties" />
</copy>
@@ -42,13 +43,27 @@
<delete dir="target" />
</target>
- <target name="build" depends="init" description="builds the
code and jar files">
- <javac srcdir="src/main/java" debug="${javac.debug}"
includes="**/*.java" classpathref="compile.classpath"
destdir="target/classes" includeAntRuntime="false" />
- <javac srcdir="src/test/java" debug="${javac.debug}"
includes="**/*.java" classpathref="test.classpath"
destdir="target/testclasses" includeAntRuntime="false" />
+ <target name="jar" description="build the jar"
depends="build">
<jar destfile="${jar.file}" basedir="target/classes" />
</target>
- <target name="test" depends="build" description="tests the
code">
+ <target name="buildtests" description="build test classes"
depends="build">
+ <depend srcdir="src/test/java"
+ destdir="target/testclasses"
+ cache="target/cache"
+ closure="true" />
+ <javac srcdir="src/test/java" debug="${javac.debug}"
includes="**/*.java" classpathref="test.classpath"
destdir="target/testclasses" includeAntRuntime="false" />
+ </target>
+
+ <target name="build" depends="init" description="builds the
code">
+ <depend srcdir="src/main/java"
+ destdir="target/classes"
+ cache="target/cache"
+ closure="true" />
+ <javac srcdir="src/main/java" debug="${javac.debug}"
includes="**/*.java" classpathref="compile.classpath"
destdir="target/classes" includeAntRuntime="false" />
+ </target>
+
+ <target name="test" depends="buildtests" description="tests
the code">
<junit printsummary="yes" fork="yes"
forkMode="perBatch">
<formatter type="plain" />
<classpath refid="test.classpath" />
@@ -81,7 +96,7 @@
</copy>
</target>
- <target name="deb" depends="build" description="build a
debian Debian package">
+ <target name="deb" depends="build,jar" description="build a
debian Debian package">
<mkdir dir="${debian.pkgdir}/DEBIAN" />
<copy file="debian/control.in" tofile="${debian.controlfile}"
overwrite="true" filtering="true">
<filterset filtersfile="build.properties" />
@@ -103,7 +118,7 @@
<rpm specfile="${spec}" command="-ba"
topdir="${rpm.topdir}" />
</target>
- <target name="maven" depends="build,docs,src"
description="publish the maven repo">
+ <target name="maven" depends="build,jar,docs,src"
description="publish the maven repo">
<mkdir dir="target/repo" />
<get
src="http://repo1.maven.org/maven2/org/apache/maven/maven-ant-tasks/...
dest="target/maven-ant-tasks-2.1.3.jar" />
<copy file="pom.xml.in" tofile="target/pom.xml"
overwrite="true" filtering="true">
--
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>
Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern