root/trunk/build-common.xml

Revision 521, 2.6 KB (checked in by martijn, 11 months ago)

Use bnd to generate OSGi headers. Merge common build file bits in build-common.xml

Line 
1<?xml version="1.0"?>
2<project name="common" basedir=".">
3
4        <!-- always be java 1.5 compatible -->
5        <property name="ant.build.javac.target" value="1.5"/>
6        <property name="ant.build.javac.source" value="1.5"/>
7       
8        <property name="checkstyle.output.file" value="warnings.txt"/>
9
10        <property file="version.props"/>
11
12        <target name="prepare-common">
13                <mkdir dir="build"/>
14
15                <!-- the following property is used to skip the "test" target if there is no test subdirectory -->
16                <condition property="test.dir.exists"><available file="test"/></condition>
17        </target>
18
19        <path id="absolute.and.libs">
20                <path refid="absolute.deps"/>
21                <fileset dir="lib" erroronmissingdir="false">
22                        <include name="*.jar"/>
23                </fileset>
24        </path>
25
26        <target name="prepare"/> <!-- designed to be overriden by project build file -->
27
28        <target name="build" depends="prepare, prepare-common">
29                <javac srcdir="src"
30                           includes="**"
31                           debug="true"
32                           destdir="build">
33                           <classpath refid="absolute.and.libs"/>
34                </javac>
35        </target>
36
37        <target name="jar" depends="build">
38                <taskdef resource="aQute/bnd/ant/taskdef.properties"
39                        classpath="../build-lib/biz.aQute.bnd.jar"/>
40                <bnd
41                        output="${jar.name}"
42                        eclipse="false"
43                        files="package.bnd"
44                        classpath="build,resources">
45                </bnd>
46        </target>
47
48        <target name="clean">
49                <delete dir="build"/>
50        </target>
51
52        <target name="dist-clean" depends="clean">
53                <delete file="${jar.name}"/>
54        </target>
55
56        <target name="dist" depends="jar">
57                <copy todir="../dist">
58                        <fileset dir="lib" erroronmissingdir="false">
59                                <include name="*.jar"/>
60                        </fileset>
61                </copy>
62        </target>
63
64        <target name="test" depends="build" if="test.dir.exists">
65                <path id="test.classpath">
66                        <path refid="absolute.deps"/>
67                        <path refid="transient.deps"/>
68                        <path refid="test.deps"/>
69                        <pathelement location="resources"/>
70                        <pathelement location="build"/>
71                </path>
72                <javac srcdir="test" debug="true"
73                                        includes="**"
74                                        destdir="build"
75                                        source="1.5">
76                        <classpath refid="test.classpath"/>
77                </javac>               
78                <junit printsummary="on" haltonfailure="true" fork="true">
79                        <formatter type="brief" usefile="false"/>
80                        <classpath refid="test.classpath"/>
81                        <batchtest>
82                                <fileset dir="test">
83                                        <include name="**/*Test*.java"/>
84                                </fileset>
85                        </batchtest>
86                </junit>
87        </target>
88       
89        <target name="checkstyle">
90                <taskdef resource="checkstyletask.properties"
91                                 classpath="../org.bridgedb.bio/build-lib/checkstyle-all-5.0.jar"/>
92                <checkstyle config="checks.xml">
93                        <fileset dir="src">
94                                <include name="**/*.java"/>
95                        </fileset>
96                        <formatter toFile="${checkstyle.output.file}"/>
97                </checkstyle>   
98        </target>
99
100</project>
Note: See TracBrowser for help on using the browser.