source: josm/trunk/build.xml@ 2381

Last change on this file since 2381 was 2369, checked in by Gubaer, 14 years ago

fixed #3305: Version is UNKNOWN
see also howto create a JOSM build

File size: 5.9 KB
Line 
1<!--
2** build.xml - main ant file for JOSM
3**
4** To build run
5** ant clean
6** ant dist
7** This will create 'josm-custom.jar' in directory 'dist'. See also
8** https://josm.openstreetmap.de/wiki/CreateBuild
9**
10**
11-->
12<project name="josm" default="dist" basedir=".">
13 <property name="test.dir" value="test" />
14 <property name="src.dir" value="src" />
15 <property name="build.dir" value="build"/>
16
17 <!-- Java classpath addition (all jar files to compile tests with this) -->
18 <path id="classpath">
19 <fileset dir="lib">
20 <include name="**/*.jar"/>
21 </fileset>
22 </path>
23
24 <!--
25 ** Creates the REVISION file to be included in the distribution
26 -->
27 <target name="create-revision">
28 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
29 <env key="LANG" value="C"/>
30 <arg value="info"/>
31 <arg value="--xml"/>
32 <arg value="."/>
33 </exec>
34 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
35 <delete file="REVISION"/>
36 <tstamp>
37 <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
38 </tstamp>
39
40 <property name="version.entry.commit.revision" value="UNKNOWN"/>
41 <echo file="${build.dir}/REVISION">
42# automatically generated by JOSM build.xml - do not edit
43Revision: ${version.entry.commit.revision}
44Is-Local-Build: true
45Build-Date: ${build.tstamp}
46</echo>
47 </target>
48
49
50 <target name="dist" depends="compile,create-revision">
51
52 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
53 <env key="LANG" value="C"/>
54 <arg value="info"/>
55 <arg value="--xml"/>
56 <arg value="."/>
57 </exec>
58 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
59 <delete file="REVISION"/>
60 <property name="version.entry.commit.revision" value="UNKNOWN"/>
61 <property name="version.entry.commit.date" value="UNKNOWN"/>
62 <echo>Revision ${version.entry.commit.revision}</echo>
63 <copy file="CONTRIBUTION" todir="build"/>
64 <copy file="README" todir="build"/>
65 <copy file="LICENSE" todir="build"/>
66
67 <!-- styles -->
68 <copy file="styles/standard/elemstyles.xml" todir="build/styles/standard"/>
69
70 <!-- css-->
71 <copy file="src/org/openstreetmap/josm/gui/help/help-browser.css" todir="build/org/openstreetmap/josm/gui/help"/>
72
73 <!-- create josm-custom.jar -->
74 <delete file="dist/josm-custom.jar"/>
75 <jar destfile="dist/josm-custom.jar" basedir="build" level="9">
76 <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
77 <manifest>
78 <attribute name="Main-class" value="JOSM" />
79 <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
80 <attribute name="Main-Date" value="${version.entry.commit.date}"/>
81 </manifest>
82 <zipfileset dir="presets" prefix="presets" />
83 <zipfileset dir="images" prefix="images" />
84 <zipfileset src="lib/josm-translation.jar" />
85
86 <!-- All jar files necessary to run only JOSM (no tests) -->
87 <zipfileset src="lib/gettext-commons-0.9.6.jar" />
88 <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar" />
89 </jar>
90 </target>
91
92 <target name="distmac" depends="dist">
93 <!-- modify MacOS X Info.plist file to hold the SVN version number -->
94 <copy file="macosx/JOSM.app/Contents/Info.plist" todir="build"/>
95 <replace file="build/Info.plist" token="@SVNVersion@" value="${version.entry.commit.revision}"/>
96 <!-- create ZIP file with MacOS X application bundle -->
97 <zip destfile="dist/josm-custom-macosx.zip" update="true">
98 <zipfileset dir="build" includes="CONTRIBUTION README LICENSE"/>
99 <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"/>
100 <zipfileset dir="build" includes="Info.plist" prefix="JOSM.app/Contents"/>
101 <zipfileset dir="dist" includes="josm-custom.jar" prefix="JOSM.app/Contents/Resources/Java"/>
102 <zipfileset dir="macosx" includes="JOSM.app/Contents/MacOS/JOSM" filemode="755"/>
103 </zip>
104 </target>
105
106 <target name="compile" depends="init">
107 <javac srcdir="src" classpathref="classpath" destdir="build"
108 target="1.5" source="1.5" debug="on" encoding="UTF-8">
109 <compilerarg value="-Xlint:deprecation"/>
110 <compilerarg value="-Xlint:unchecked"/>
111 </javac>
112 </target>
113
114 <target name="init">
115 <mkdir dir="build" />
116 <mkdir dir="dist" />
117 </target>
118
119 <target name="clean">
120 <delete dir="build" />
121 <delete dir="dist" />
122 </target>
123
124 <path id="test.classpath">
125 <fileset dir="${test.dir}/lib">
126 <include name="**/*.jar"/>
127 </fileset>
128 <fileset dir="lib">
129 <include name="**/*.jar"/>
130 </fileset>
131 </path>
132
133 <target name="test-init">
134 <mkdir dir="${test.dir}/${build.dir}" />
135 <mkdir dir="${test.dir}/report" />
136 </target>
137
138 <target name="test-clean">
139 <delete dir="${test.dir}/${build.dir}"/>
140 <delete dir="${test.dir}/report"/>
141 </target>
142
143 <target name="test-compile" depends="test-init">
144 <javac srcdir="${src.dir}:${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
145 target="1.5" source="1.5" debug="on" encoding="UTF-8">
146 <compilerarg value="-Xlint:deprecation"/>
147 <compilerarg value="-Xlint:unchecked"/>
148 </javac>
149 </target>
150
151 <target name="test" depends="test-compile">
152 <junit printsummary="yes">
153 <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
154 <classpath>
155 <path refid="test.classpath"/>
156 <pathelement path="${test.dir}/${build.dir}"/>
157 <pathelement path="${test.dir}/config"/>
158 </classpath>
159 <formatter type="plain"/>
160 <batchtest fork="no" todir="${test.dir}/report">
161 <fileset dir="${test.dir}/unit" includes="**/*.java"/>
162 </batchtest>
163 </junit>
164 </target>
165
166</project>
Note: See TracBrowser for help on using the repository browser.