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 | <!-- 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>
|
---|
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>
|
---|
29 |
|
---|
30 |
|
---|
31 | <!--
|
---|
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 | <!--
|
---|
41 | ** Creates the REVISION file to be included in the distribution
|
---|
42 | -->
|
---|
43 | <target name="create-revision">
|
---|
44 | <property name="revision.dir" value="${build.dir}"/>
|
---|
45 | <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false">
|
---|
46 | <env key="LANG" value="C"/>
|
---|
47 | <arg value="info"/>
|
---|
48 | <arg value="--xml"/>
|
---|
49 | <arg value="."/>
|
---|
50 | </exec>
|
---|
51 | <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
52 | <delete file="REVISION.XML" />
|
---|
53 | <tstamp>
|
---|
54 | <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
|
---|
55 | </tstamp>
|
---|
56 |
|
---|
57 | <property name="version.entry.commit.revision" value="UNKNOWN"/>
|
---|
58 | <mkdir dir="${revision.dir}" />
|
---|
59 | <echo file="${revision.dir}/REVISION">
|
---|
60 | # automatically generated by JOSM build.xml - do not edit
|
---|
61 | Revision: ${version.entry.commit.revision}
|
---|
62 | Is-Local-Build: true
|
---|
63 | Build-Date: ${build.tstamp}
|
---|
64 | </echo>
|
---|
65 | </target>
|
---|
66 |
|
---|
67 |
|
---|
68 | <target name="dist" depends="compile,create-revision">
|
---|
69 |
|
---|
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"/>
|
---|
80 | <echo>Revision ${version.entry.commit.revision}</echo>
|
---|
81 | <copy file="CONTRIBUTION" todir="build"/>
|
---|
82 | <copy file="README" todir="build"/>
|
---|
83 | <copy file="LICENSE" todir="build"/>
|
---|
84 |
|
---|
85 | <!-- styles -->
|
---|
86 | <copy file="styles/standard/elemstyles.xml" todir="build/data"/>
|
---|
87 |
|
---|
88 | <!-- create josm-custom.jar -->
|
---|
89 | <delete file="dist/josm-custom.jar"/>
|
---|
90 | <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
|
---|
91 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
|
---|
92 | <manifest>
|
---|
93 | <attribute name="Main-class" value="JOSM" />
|
---|
94 | <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
|
---|
95 | <attribute name="Main-Date" value="${version.entry.commit.date}"/>
|
---|
96 | </manifest>
|
---|
97 | <zipfileset dir="images" prefix="images" />
|
---|
98 | <zipfileset dir="data" prefix="data" />
|
---|
99 |
|
---|
100 | <!-- All jar files necessary to run only JOSM (no tests) -->
|
---|
101 | <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar" />
|
---|
102 | <zipfileset src="lib/signpost-core-1.1.jar" />
|
---|
103 | </jar>
|
---|
104 | </target>
|
---|
105 |
|
---|
106 | <target name="distmac" depends="dist">
|
---|
107 | <!-- modify MacOS X Info.plist file to hold the SVN version number -->
|
---|
108 | <copy file="macosx/JOSM.app/Contents/Info.plist" todir="build"/>
|
---|
109 | <replace file="build/Info.plist" token="@SVNVersion@" value="${version.entry.commit.revision}"/>
|
---|
110 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
111 | <zip destfile="dist/josm-custom-macosx.zip" update="true">
|
---|
112 | <zipfileset dir="build" includes="CONTRIBUTION README LICENSE"/>
|
---|
113 | <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"/>
|
---|
114 | <zipfileset dir="build" includes="Info.plist" prefix="JOSM.app/Contents"/>
|
---|
115 | <zipfileset dir="dist" includes="josm-custom.jar" prefix="JOSM.app/Contents/Resources/Java"/>
|
---|
116 | <zipfileset dir="macosx" includes="JOSM.app/Contents/MacOS/JOSM" filemode="755"/>
|
---|
117 | </zip>
|
---|
118 | </target>
|
---|
119 |
|
---|
120 | <target name="compile" depends="init">
|
---|
121 | <javac srcdir="src" classpathref="classpath" destdir="build"
|
---|
122 | target="1.5" source="1.5" debug="on" encoding="UTF-8">
|
---|
123 | <compilerarg value="-Xlint:deprecation"/>
|
---|
124 | <compilerarg value="-Xlint:unchecked"/>
|
---|
125 | </javac>
|
---|
126 | </target>
|
---|
127 |
|
---|
128 | <target name="init">
|
---|
129 | <mkdir dir="build" />
|
---|
130 | <mkdir dir="dist" />
|
---|
131 | </target>
|
---|
132 |
|
---|
133 | <target name="clean">
|
---|
134 | <delete dir="build" />
|
---|
135 | <delete dir="dist" />
|
---|
136 | </target>
|
---|
137 |
|
---|
138 | <path id="test.classpath">
|
---|
139 | <fileset dir="${test.dir}/lib">
|
---|
140 | <include name="**/*.jar"/>
|
---|
141 | </fileset>
|
---|
142 | <fileset dir="lib">
|
---|
143 | <include name="**/*.jar"/>
|
---|
144 | </fileset>
|
---|
145 | </path>
|
---|
146 |
|
---|
147 | <target name="test-init">
|
---|
148 | <mkdir dir="${test.dir}/${build.dir}" />
|
---|
149 | <mkdir dir="${test.dir}/report" />
|
---|
150 | </target>
|
---|
151 |
|
---|
152 | <target name="test-clean">
|
---|
153 | <delete dir="${test.dir}/${build.dir}"/>
|
---|
154 | <delete dir="${test.dir}/report"/>
|
---|
155 | </target>
|
---|
156 |
|
---|
157 | <target name="test-compile" depends="test-init">
|
---|
158 | <javac srcdir="${src.dir}:${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
|
---|
159 | target="1.5" source="1.5" debug="on" encoding="UTF-8">
|
---|
160 | <compilerarg value="-Xlint:deprecation"/>
|
---|
161 | <compilerarg value="-Xlint:unchecked"/>
|
---|
162 | </javac>
|
---|
163 | <javac srcdir="${src.dir}:${test.dir}/functional" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
|
---|
164 | target="1.5" source="1.5" debug="on" encoding="UTF-8">
|
---|
165 | <compilerarg value="-Xlint:deprecation"/>
|
---|
166 | <compilerarg value="-Xlint:unchecked"/>
|
---|
167 | </javac>
|
---|
168 | </target>
|
---|
169 |
|
---|
170 | <target name="test" depends="test-compile">
|
---|
171 | <junit printsummary="yes">
|
---|
172 | <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
|
---|
173 | <classpath>
|
---|
174 | <path refid="test.classpath"/>
|
---|
175 | <pathelement path="${test.dir}/${build.dir}"/>
|
---|
176 | <pathelement path="${test.dir}/config"/>
|
---|
177 | </classpath>
|
---|
178 | <formatter type="plain"/>
|
---|
179 | <formatter type="xml"/>
|
---|
180 | <batchtest fork="yes" todir="${test.dir}/report">
|
---|
181 | <fileset dir="${test.dir}/unit" includes="**/*.java"/>
|
---|
182 | </batchtest>
|
---|
183 | </junit>
|
---|
184 | </target>
|
---|
185 |
|
---|
186 | <target name="dist-optimized" depends="dist">
|
---|
187 | <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar" />
|
---|
188 | <proguard>
|
---|
189 | -injars dist/josm-custom.jar
|
---|
190 | -outjars dist/josm-custom-optimized.jar
|
---|
191 |
|
---|
192 | -libraryjars ${java.home}/lib/rt.jar
|
---|
193 | -libraryjars ${java.home}/lib/jce.jar
|
---|
194 |
|
---|
195 | -dontoptimize
|
---|
196 | -dontobfuscate
|
---|
197 |
|
---|
198 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
199 | public static void main(java.lang.String[]);
|
---|
200 | }
|
---|
201 |
|
---|
202 | -keep class JOSM
|
---|
203 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
204 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
205 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
206 |
|
---|
207 | -keepclassmembers enum * {
|
---|
208 | public static **[] values();
|
---|
209 | public static ** valueOf(java.lang.String);
|
---|
210 | }
|
---|
211 |
|
---|
212 | -keepclassmembers class * {
|
---|
213 | public protected *;
|
---|
214 | }
|
---|
215 | </proguard>
|
---|
216 | </target>
|
---|
217 |
|
---|
218 | </project>
|
---|