source: josm/trunk/build.xml@ 2456

Last change on this file since 2456 was 2453, checked in by jttt, 15 years ago

Applied #3899 - patch by jpstotz - Automated creation of REVISION file in Eclipse

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