source: josm/trunk/build.xml@ 1751

Last change on this file since 1751 was 1751, checked in by Gubaer, 15 years ago

patch by dmuecke - improved unit tests and test targets in build.xml

File size: 4.5 KB
Line 
1<project name="josm" default="dist" basedir=".">
2 <property name="test.dir" value="test" />
3 <property name="src.dir" value="src" />
4 <property name="build.dir" value="build"/>
5
6 <!-- Java classpath addition (all jar files to compile tests with this) -->
7 <path id="classpath">
8 <fileset dir="lib">
9 <include name="**/*.jar"/>
10 </fileset>
11 </path>
12
13 <target name="dist" depends="compile">
14
15 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
16 <env key="LANG" value="C"/>
17 <arg value="info"/>
18 <arg value="--xml"/>
19 <arg value="."/>
20 </exec>
21 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
22 <delete file="REVISION"/>
23 <property name="version.entry.commit.revision" value="UNKNOWN"/>
24 <property name="version.entry.commit.date" value="UNKNOWN"/>
25
26 <copy file="CONTRIBUTION" todir="build"/>
27 <copy file="README" todir="build"/>
28 <copy file="LICENSE" todir="build"/>
29
30 <!-- styles -->
31 <copy file="styles/standard/elemstyles.xml" todir="build/styles/standard"/>
32
33 <!-- create josm-custom.jar -->
34 <delete file="dist/josm-custom.jar"/>
35 <jar destfile="dist/josm-custom.jar" basedir="build">
36 <manifest>
37 <attribute name="Main-class" value="JOSM" />
38 <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
39 <attribute name="Main-Date" value="${version.entry.commit.date}"/>
40 </manifest>
41 <zipfileset dir="presets" prefix="presets" />
42 <zipfileset dir="images" prefix="images" />
43 <zipfileset src="lib/josm-translation.jar" />
44
45 <!-- All jar files necessary to run only JOSM (no tests) -->
46 <zipfileset src="lib/gettext-commons-0.9.6.jar" />
47 <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar" />
48 </jar>
49 </target>
50
51 <target name="distmac" depends="dist">
52 <!-- modify MacOS X Info.plist file to hold the SVN version number -->
53 <copy file="macosx/JOSM.app/Contents/Info.plist" todir="build"/>
54 <replace file="build/Info.plist" token="@SVNVersion@" value="${version.entry.commit.revision}"/>
55 <!-- create ZIP file with MacOS X application bundle -->
56 <zip destfile="dist/josm-custom-macosx.zip" update="true">
57 <zipfileset dir="build" includes="CONTRIBUTION README LICENSE"/>
58 <zipfileset dir="macosx" includes="JOSM.app/Contents JOSM.app/Contents/MacOS JOSM.app/Contents/Resources JOSM.app/Contents/Resources/Java JOSM.app/Contents/PkgInfo JOSM.app/Contents/Resources/JOSM.icns"/>
59 <zipfileset dir="build" includes="Info.plist" prefix="JOSM.app/Contents"/>
60 <zipfileset dir="dist" includes="josm-custom.jar" prefix="JOSM.app/Contents/Resources/Java"/>
61 <zipfileset dir="macosx" includes="JOSM.app/Contents/MacOS/JOSM" filemode="755"/>
62 </zip>
63 </target>
64
65 <target name="compile" depends="init">
66 <javac srcdir="src" classpathref="classpath" destdir="build"
67 target="1.5" source="1.5" debug="on" encoding="UTF-8">
68 <compilerarg value="-Xlint:deprecation"/>
69 </javac>
70 </target>
71
72 <target name="init">
73 <mkdir dir="build" />
74 <mkdir dir="dist" />
75 </target>
76
77 <target name="clean">
78 <delete dir="build" />
79 <delete dir="dist" />
80 </target>
81
82 <path id="test.classpath">
83 <fileset dir="${test.dir}/lib">
84 <include name="**/*.jar"/>
85 </fileset>
86 <fileset dir="lib">
87 <include name="**/*.jar"/>
88 </fileset>
89 </path>
90
91 <target name="test-init">
92 <mkdir dir="${test.dir}/${build.dir}" />
93 <mkdir dir="${test.dir}/report" />
94 </target>
95
96 <target name="test-clean">
97 <delete dir="${test.dir}/${build.dir}"/>
98 <delete dir="${test.dir}/report"/>
99 </target>
100
101 <target name="test-compile" depends="test-init">
102 <javac srcdir="${src.dir}:${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
103 target="1.5" source="1.5" debug="on" encoding="UTF-8">
104 <compilerarg value="-Xlint:deprecation"/>
105 </javac>
106 </target>
107
108 <target name="test" depends="test-compile">
109 <junit printsummary="yes">
110 <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
111 <classpath>
112 <path refid="test.classpath"/>
113 <pathelement path="${test.dir}/${build.dir}"/>
114 <pathelement path="${test.dir}/config"/>
115 </classpath>
116 <formatter type="plain"/>
117 <batchtest fork="no" todir="${test.dir}/report">
118 <fileset dir="${test.dir}/unit" includes="**/*.java"/>
119 </batchtest>
120 </junit>
121 </target>
122
123</project>
Note: See TracBrowser for help on using the repository browser.