1 | <?xml version="1.0" encoding="utf-8"?> |
---|
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/DevelopersGuide/CreateBuild |
---|
9 | ** |
---|
10 | --> |
---|
11 | <project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if"> |
---|
12 | <target name="init-properties"> |
---|
13 | <!-- Load properties in a target and not at top level, so this build file can be |
---|
14 | imported from an IDE ant file (Netbeans) without messing up IDE properties. |
---|
15 | When imported from another file, ${basedir} will point to the parent directory |
---|
16 | of the importing ant file. Use ${base.dir} instead, which is always the parent |
---|
17 | directory of this file. --> |
---|
18 | <dirname property="base.dir" file="${ant.file.josm}"/> |
---|
19 | <property name="test.dir" location="${base.dir}/test"/> |
---|
20 | <property name="src.dir" location="${base.dir}/src"/> |
---|
21 | <property name="build.dir" location="${base.dir}/build"/> |
---|
22 | <property name="dist.dir" location="${base.dir}/dist"/> |
---|
23 | <property name="javacc.home" location="${base.dir}/tools"/> |
---|
24 | <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/> |
---|
25 | <property name="proj-build.dir" location="${base.dir}/build2"/> |
---|
26 | <property name="checkstyle-build.dir" location="${base.dir}/build2"/> |
---|
27 | <property name="epsg.output" location="${base.dir}/data/projection/custom-epsg"/> |
---|
28 | <property name="groovy.jar" location="${base.dir}/tools/groovy-all.jar"/> |
---|
29 | <property name="error_prone_ant.jar" location="${base.dir}/tools/error_prone_ant.jar"/> |
---|
30 | <property name="dist.jar" location="${dist.dir}/josm-custom.jar"/> |
---|
31 | <property name="dist-optimized.jar" location="${dist.dir}/josm-custom-optimized.jar"/> |
---|
32 | <property name="javac.compiler" value="com.google.errorprone.ErrorProneAntCompilerAdapter" /> |
---|
33 | <property name="java.lang.version" value="1.8" /> |
---|
34 | <!-- build parameter: compression level (ant -Dclevel=N) |
---|
35 | N ranges from 0 (no compression) to 9 (maximum compression) |
---|
36 | default: 9 --> |
---|
37 | <condition property="clevel" value="${clevel}" else="9"> |
---|
38 | <isset property="clevel"/> |
---|
39 | </condition> |
---|
40 | <!-- For Java9-specific stuff --> |
---|
41 | <condition property="isJava9"> |
---|
42 | <matches string="${ant.java.version}" pattern="(1.)?9" /> |
---|
43 | </condition> |
---|
44 | <path id="test.classpath"> |
---|
45 | <fileset dir="${test.dir}/lib"> |
---|
46 | <include name="**/*.jar"/> |
---|
47 | </fileset> |
---|
48 | <pathelement path="${dist.jar}"/> |
---|
49 | <pathelement path="${groovy.jar}"/> |
---|
50 | <pathelement path="tools/spotbugs/spotbugs-annotations.jar"/> |
---|
51 | </path> |
---|
52 | <path id="pmd.classpath"> |
---|
53 | <fileset dir="${base.dir}/tools/pmd/"> |
---|
54 | <include name="*.jar"/> |
---|
55 | </fileset> |
---|
56 | </path> |
---|
57 | </target> |
---|
58 | |
---|
59 | <!-- |
---|
60 | ** Used by Eclipse ant builder for updating |
---|
61 | ** the REVISION file used by JOSM |
---|
62 | --> |
---|
63 | <target name="create-revision-eclipse"> |
---|
64 | <property name="revision.dir" value="bin"/> |
---|
65 | <antcall target="create-revision"/> |
---|
66 | </target> |
---|
67 | <!-- |
---|
68 | ** Initializes the REVISION.XML file from SVN information |
---|
69 | --> |
---|
70 | <target name="init-svn-revision-xml" depends="init-properties"> |
---|
71 | <exec append="false" output="${base.dir}/REVISION.XML" executable="svn" dir="${base.dir}" failifexecutionfails="false" resultproperty="svn.info.result"> |
---|
72 | <env key="LANG" value="C"/> |
---|
73 | <arg value="info"/> |
---|
74 | <arg value="--xml"/> |
---|
75 | <arg value="."/> |
---|
76 | </exec> |
---|
77 | <condition property="svn.info.success"> |
---|
78 | <equals arg1="${svn.info.result}" arg2="0" /> |
---|
79 | </condition> |
---|
80 | </target> |
---|
81 | <!-- |
---|
82 | ** Initializes the REVISION.XML file from git information |
---|
83 | --> |
---|
84 | <target name="init-git-revision-xml" unless="svn.info.success" depends="init-properties"> |
---|
85 | <exec append="false" output="${base.dir}/REVISION.XML" executable="git" dir="${base.dir}" failifexecutionfails="false"> |
---|
86 | <arg value="log"/> |
---|
87 | <arg value="-1"/> |
---|
88 | <arg value="--grep=git-svn-id"/> |
---|
89 | <!-- |
---|
90 | %B: raw body (unwrapped subject and body) |
---|
91 | %n: new line |
---|
92 | %ai: author date, ISO 8601 format |
---|
93 | --> |
---|
94 | <arg value="--pretty=format:%B%n%ai"/> |
---|
95 | <arg value="HEAD"/> |
---|
96 | </exec> |
---|
97 | <replaceregexp file="${base.dir}/REVISION.XML" flags="s" |
---|
98 | match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$" |
---|
99 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/> |
---|
100 | </target> |
---|
101 | <!-- |
---|
102 | ** Creates the REVISION file to be included in the distribution |
---|
103 | --> |
---|
104 | <target name="create-revision" depends="init-properties,init-svn-revision-xml,init-git-revision-xml"> |
---|
105 | <property name="revision.dir" value="${build.dir}"/> |
---|
106 | <xmlproperty file="${base.dir}/REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/> |
---|
107 | <delete file="${base.dir}/REVISION.XML"/> |
---|
108 | <tstamp> |
---|
109 | <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/> |
---|
110 | </tstamp> |
---|
111 | <property name="version.entry.commit.revision" value="UNKNOWN"/> |
---|
112 | <property name="version.entry.commit.date" value="UNKNOWN"/> |
---|
113 | <mkdir dir="${revision.dir}"/> |
---|
114 | <!-- add Build-Name: ... when making special builds, e.g. DEBIAN --> |
---|
115 | <echo file="${revision.dir}/REVISION"> |
---|
116 | # automatically generated by JOSM build.xml - do not edit |
---|
117 | Revision: ${version.entry.commit.revision} |
---|
118 | Is-Local-Build: true |
---|
119 | Build-Date: ${build.tstamp} |
---|
120 | </echo> |
---|
121 | </target> |
---|
122 | <!-- |
---|
123 | ** Check internal XML files against their XSD |
---|
124 | --> |
---|
125 | <target name="check-schemas" unless="check-schemas.notRequired" depends="init-properties"> |
---|
126 | <schemavalidate file="data/defaultpresets.xml" > |
---|
127 | <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="data/tagging-preset.xsd" /> |
---|
128 | </schemavalidate> |
---|
129 | </target> |
---|
130 | <!-- |
---|
131 | ** Main target that builds JOSM and checks XML against schemas |
---|
132 | --> |
---|
133 | <target name="dist" depends="compile,create-revision,check-schemas,epsg"> |
---|
134 | <echo>Revision ${version.entry.commit.revision}</echo> |
---|
135 | <copy file="CONTRIBUTION" todir="${build.dir}"/> |
---|
136 | <copy file="README" todir="${build.dir}"/> |
---|
137 | <copy file="LICENSE" todir="${build.dir}"/> |
---|
138 | <!-- create josm-custom.jar --> |
---|
139 | <delete file="${dist.jar}"/> |
---|
140 | <jar destfile="${dist.jar}" basedir="${build.dir}" level="${clevel}"> |
---|
141 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar --> |
---|
142 | <manifest> |
---|
143 | <attribute name="Main-class" value="org.openstreetmap.josm.gui.MainApplication"/> |
---|
144 | <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/> |
---|
145 | <attribute name="Main-Date" value="${version.entry.commit.date}"/> |
---|
146 | <attribute name="Permissions" value="all-permissions"/> |
---|
147 | <attribute name="Codebase" value="josm.openstreetmap.de"/> |
---|
148 | <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/> |
---|
149 | <!-- Java 9 stuff. Entries are safely ignored by Java 8 --> |
---|
150 | <attribute name="Add-Exports" value="java.base/sun.security.util java.base/sun.security.x509 java.desktop/com.apple.eawt java.desktop/com.sun.imageio.spi javafx.graphics/com.sun.javafx.application jdk.deploy/com.sun.deploy.config" /> |
---|
151 | <attribute name="Add-Opens" value="java.base/java.lang java.base/jdk.internal.loader java.desktop/javax.imageio.spi java.desktop/javax.swing.text.html java.prefs/java.util.prefs" /> |
---|
152 | </manifest> |
---|
153 | <zipfileset dir="images" prefix="images"/> |
---|
154 | <zipfileset dir="data" prefix="data"/> |
---|
155 | <zipfileset dir="styles" prefix="styles"/> |
---|
156 | <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/> |
---|
157 | </jar> |
---|
158 | </target> |
---|
159 | <!-- Mac OS X target --> |
---|
160 | <target name="mac" depends="init-properties"> |
---|
161 | <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle --> |
---|
162 | <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/> |
---|
163 | <!-- create MacOS X application bundle --> |
---|
164 | <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm" |
---|
165 | mainclassname="org.openstreetmap.josm.gui.MainApplication" |
---|
166 | copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later" |
---|
167 | applicationCategory="public.app-category.utilities" |
---|
168 | shortversion="${version.entry.commit.revision} SVN" |
---|
169 | version="${version.entry.commit.revision} SVN" |
---|
170 | icon="macosx/JOSM.app/Contents/Resources/JOSM.icns" |
---|
171 | highResolutionCapable="true"> |
---|
172 | |
---|
173 | <arch name="x86_64"/> |
---|
174 | <arch name="i386"/> |
---|
175 | |
---|
176 | <classpath file="${bundle.jar}"/> |
---|
177 | |
---|
178 | <option value="-Xmx1024m"/> |
---|
179 | |
---|
180 | <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/> |
---|
181 | <option value="-Xdock:name=JOSM"/> |
---|
182 | |
---|
183 | <!-- OSX specific options, optional --> |
---|
184 | <option value="-Dapple.laf.useScreenMenuBar=true"/> |
---|
185 | <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/> |
---|
186 | <option value="-Dcom.apple.macos.useScreenMenuBar=true"/> |
---|
187 | <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/> |
---|
188 | <option value="-Dcom.apple.smallTabs=true"/> |
---|
189 | </bundleapp> |
---|
190 | |
---|
191 | <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually --> |
---|
192 | <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/> |
---|
193 | |
---|
194 | <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false"> |
---|
195 | <!-- remove empty CFBundleDocumentTypes definition --> |
---|
196 | <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/> |
---|
197 | <!-- insert our own keys --> |
---|
198 | <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" /> |
---|
199 | </xmltask> |
---|
200 | |
---|
201 | <!-- create ZIP file with MacOS X application bundle --> |
---|
202 | <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true"> |
---|
203 | <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/> |
---|
204 | <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" /> |
---|
205 | </zip> |
---|
206 | </target> |
---|
207 | <target name="distmac" depends="dist"> |
---|
208 | <antcall target="mac"> |
---|
209 | <param name="bundle.outdir" value="${dist.dir}"/> |
---|
210 | <param name="bundle.jar" value="${dist.jar}"/> |
---|
211 | </antcall> |
---|
212 | </target> |
---|
213 | <!-- Windows target --> |
---|
214 | <target name="distwin" depends="dist"> |
---|
215 | <exec dir="windows" executable="./josm-setup-unix.sh"> |
---|
216 | <arg value="${version.entry.commit.revision}"/> |
---|
217 | <arg value="${dist.jar}"/> |
---|
218 | </exec> |
---|
219 | </target> |
---|
220 | <target name="javacc" depends="init" unless="javacc.notRequired"> |
---|
221 | <mkdir dir="${mapcss.dir}/parsergen"/> |
---|
222 | <java classname="javacc" fork="true" failonerror="true"> |
---|
223 | <classpath path="${javacc.home}/javacc.jar"/> |
---|
224 | <arg value="-DEBUG_PARSER=false"/> |
---|
225 | <arg value="-DEBUG_TOKEN_MANAGER=false"/> |
---|
226 | <arg value="-JDK_VERSION=${java.lang.version}"/> |
---|
227 | <arg value="-GRAMMAR_ENCODING=UTF-8"/> |
---|
228 | <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/> |
---|
229 | <arg value="${mapcss.dir}/MapCSSParser.jj"/> |
---|
230 | </java> |
---|
231 | </target> |
---|
232 | <target name="compile-cots" depends="init"> |
---|
233 | <!-- COTS --> |
---|
234 | <javac srcdir="${src.dir}" includes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**" nowarn="on" encoding="iso-8859-1" |
---|
235 | destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeAntRuntime="false" createMissingPackageInfoClass="false"> |
---|
236 | <!-- get rid of "internal proprietary API" warning --> |
---|
237 | <compilerarg value="-XDignore.symbol.file"/> |
---|
238 | <exclude name="org/apache/commons/compress/PasswordRequiredException.java"/> |
---|
239 | <exclude name="org/apache/commons/compress/archivers/**"/> |
---|
240 | <exclude name="org/apache/commons/compress/changes/**"/> |
---|
241 | <exclude name="org/apache/commons/compress/compressors/bzip2/BZip2Utils.java"/> |
---|
242 | <exclude name="org/apache/commons/compress/compressors/brotli/**"/> |
---|
243 | <exclude name="org/apache/commons/compress/compressors/lzma/**"/> |
---|
244 | <exclude name="org/apache/commons/compress/compressors/xz/**"/> |
---|
245 | <exclude name="org/apache/commons/compress/compressors/CompressorStreamFactory.java"/> |
---|
246 | <exclude name="org/apache/commons/compress/compressors/CompressorStreamProvider.java"/> |
---|
247 | <exclude name="org/apache/commons/compress/compressors/CompressorException.java"/> |
---|
248 | <exclude name="org/apache/commons/compress/compressors/FileNameUtil.java"/> |
---|
249 | <exclude name="org/apache/commons/compress/compressors/deflate/**"/> |
---|
250 | <exclude name="org/apache/commons/compress/compressors/gzip/**"/> |
---|
251 | <exclude name="org/apache/commons/compress/compressors/lz4/**"/> |
---|
252 | <exclude name="org/apache/commons/compress/compressors/lz77support/**"/> |
---|
253 | <exclude name="org/apache/commons/compress/compressors/pack200/**"/> |
---|
254 | <exclude name="org/apache/commons/compress/compressors/snappy/**"/> |
---|
255 | <exclude name="org/apache/commons/compress/compressors/z/**"/> |
---|
256 | <exclude name="org/apache/commons/compress/parallel/**"/> |
---|
257 | <exclude name="org/apache/commons/compress/utils/ArchiveUtils.java"/> |
---|
258 | <exclude name="org/apache/commons/jcs/JCS.java"/> |
---|
259 | <exclude name="org/apache/commons/jcs/access/GroupCacheAccess.java"/> |
---|
260 | <exclude name="org/apache/commons/jcs/access/PartitionedCacheAccess.java"/> |
---|
261 | <exclude name="org/apache/commons/jcs/access/behavior/IGroupCacheAccess.java"/> |
---|
262 | <exclude name="org/apache/commons/jcs/access/exception/InvalidGroupException.java"/> |
---|
263 | <exclude name="org/apache/commons/jcs/admin/servlet/**"/> |
---|
264 | <exclude name="org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCacheMonitor.java"/> |
---|
265 | <exclude name="org/apache/commons/jcs/auxiliary/disk/jdbc/**"/> |
---|
266 | <exclude name="org/apache/commons/jcs/auxiliary/lateral/**"/> |
---|
267 | <exclude name="org/apache/commons/jcs/auxiliary/remote/**"/> |
---|
268 | <exclude name="org/apache/commons/jcs/engine/CacheAdaptor.java"/> |
---|
269 | <exclude name="org/apache/commons/jcs/engine/CacheGroup.java"/> |
---|
270 | <exclude name="org/apache/commons/jcs/engine/CacheWatchRepairable.java"/> |
---|
271 | <exclude name="org/apache/commons/jcs/engine/Zombie*.java"/> |
---|
272 | <exclude name="org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java"/> |
---|
273 | <exclude name="org/apache/commons/jcs/utils/access/**"/> |
---|
274 | <exclude name="org/apache/commons/jcs/utils/discovery/**"/> |
---|
275 | <exclude name="org/apache/commons/jcs/utils/net/**"/> |
---|
276 | <exclude name="org/apache/commons/jcs/utils/props/**"/> |
---|
277 | <exclude name="org/apache/commons/jcs/utils/servlet/**"/> |
---|
278 | <exclude name="org/apache/commons/logging/impl/AvalonLogger.java"/> |
---|
279 | <exclude name="org/apache/commons/logging/impl/Jdk13LumberjackLogger.java"/> |
---|
280 | <exclude name="org/apache/commons/logging/impl/Log4JLogger.java"/> |
---|
281 | <exclude name="org/apache/commons/logging/impl/LogKitLogger.java"/> |
---|
282 | <exclude name="org/apache/commons/logging/impl/ServletContextCleaner.java"/> |
---|
283 | </javac> |
---|
284 | </target> |
---|
285 | <target name="compile-jmapviewer" depends="init"> |
---|
286 | <!-- JMapViewer --> |
---|
287 | <javac compiler="${javac.compiler}" sourcepath="" srcdir="${src.dir}" |
---|
288 | excludes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/gui/jmapviewer/JMapViewerTree.java,org/openstreetmap/gui/jmapviewer/checkBoxTree/**,org/openstreetmap/josm/**,gnu/**" |
---|
289 | destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8"> |
---|
290 | <compilerclasspath> |
---|
291 | <pathelement location="${error_prone_ant.jar}"/> |
---|
292 | </compilerclasspath> |
---|
293 | <compilerarg value="-Xlint:cast"/> |
---|
294 | <compilerarg value="-Xlint:deprecation"/> |
---|
295 | <compilerarg value="-Xlint:dep-ann"/> |
---|
296 | <compilerarg value="-Xlint:divzero"/> |
---|
297 | <compilerarg value="-Xlint:empty"/> |
---|
298 | <compilerarg value="-Xlint:finally"/> |
---|
299 | <compilerarg value="-Xlint:overrides"/> |
---|
300 | <!--<compilerarg value="-Xlint:rawtypes"/>--> |
---|
301 | <compilerarg value="-Xlint:static"/> |
---|
302 | <compilerarg value="-Xlint:try"/> |
---|
303 | <compilerarg value="-Xlint:unchecked"/> |
---|
304 | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 --> |
---|
305 | <compilerarg value="-XDignore.symbol.file"/> |
---|
306 | <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/> |
---|
307 | <compilerarg line="-Xmaxwarns 1000"/> |
---|
308 | <exclude name="org/openstreetmap/josm/io/audio/JavaFxMediaPlayer.java" if:set="noJavaFX"/> |
---|
309 | </javac> |
---|
310 | </target> |
---|
311 | <target name="compile" depends="init,javacc,compile-cots,compile-jmapviewer"> |
---|
312 | <!-- JOSM --> |
---|
313 | <javac compiler="${javac.compiler}" sourcepath="" srcdir="${src.dir}" |
---|
314 | excludes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/**" |
---|
315 | destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8"> |
---|
316 | <compilerclasspath> |
---|
317 | <pathelement location="${error_prone_ant.jar}"/> |
---|
318 | </compilerclasspath> |
---|
319 | <compilerarg value="-Xlint:cast"/> |
---|
320 | <compilerarg value="-Xlint:deprecation"/> |
---|
321 | <compilerarg value="-Xlint:dep-ann"/> |
---|
322 | <compilerarg value="-Xlint:divzero"/> |
---|
323 | <compilerarg value="-Xlint:empty"/> |
---|
324 | <compilerarg value="-Xlint:finally"/> |
---|
325 | <compilerarg value="-Xlint:overrides"/> |
---|
326 | <!--<compilerarg value="-Xlint:rawtypes"/>--> |
---|
327 | <compilerarg value="-Xlint:static"/> |
---|
328 | <compilerarg value="-Xlint:try"/> |
---|
329 | <compilerarg value="-Xlint:unchecked"/> |
---|
330 | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 --> |
---|
331 | <compilerarg value="-XDignore.symbol.file"/> |
---|
332 | <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/> |
---|
333 | <compilerarg value="-Xep:ImmutableEnumChecker:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/> |
---|
334 | <compilerarg value="-Xep:FutureReturnValueIgnored:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/> |
---|
335 | <compilerarg value="-Xep:FloatingPointLiteralPrecision:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/> |
---|
336 | <compilerarg value="-Xep:ShortCircuitBoolean:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/> |
---|
337 | <compilerarg value="-Xep:LiteralClassName:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/> |
---|
338 | <compilerarg line="-Xmaxwarns 1000"/> |
---|
339 | </javac> |
---|
340 | |
---|
341 | <copy todir="build" failonerror="no" includeemptydirs="no"> |
---|
342 | <fileset dir="resources"/> |
---|
343 | </copy> |
---|
344 | </target> |
---|
345 | <target name="init" depends="init-properties"> |
---|
346 | <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" > |
---|
347 | <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/> |
---|
348 | </uptodate> |
---|
349 | <mkdir dir="${build.dir}"/> |
---|
350 | <mkdir dir="${dist.dir}"/> |
---|
351 | </target> |
---|
352 | <target name="javadoc" depends="init-properties"> |
---|
353 | <javadoc destdir="javadoc" |
---|
354 | sourcepath="${src.dir}" |
---|
355 | encoding="UTF-8" |
---|
356 | packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*" |
---|
357 | excludepackagenames="org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.*" |
---|
358 | windowtitle="JOSM" |
---|
359 | use="true" |
---|
360 | private="true" |
---|
361 | linksource="true" |
---|
362 | author="false"> |
---|
363 | <link href="http://docs.oracle.com/javase/8/docs/api"/> |
---|
364 | <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle> |
---|
365 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom> |
---|
366 | <arg value="--add-exports" if:set="isJava9" /> |
---|
367 | <arg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" /> |
---|
368 | <arg value="--add-exports" if:set="isJava9" /> |
---|
369 | <arg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" /> |
---|
370 | <arg value="--add-exports" if:set="isJava9" /> |
---|
371 | <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" /> |
---|
372 | </javadoc> |
---|
373 | </target> |
---|
374 | <target name="clean" depends="init-properties"> |
---|
375 | <delete dir="${build.dir}"/> |
---|
376 | <delete dir="${proj-build.dir}"/> |
---|
377 | <delete dir="${checkstyle-build.dir}"/> |
---|
378 | <delete dir="${dist.dir}"/> |
---|
379 | <delete dir="${mapcss.dir}/parsergen"/> |
---|
380 | <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/> |
---|
381 | <delete dir="${src.dir}/org/openstreetmap/josm/data/imagery/types"/> |
---|
382 | <delete file="${epsg.output}"/> |
---|
383 | </target> |
---|
384 | <macrodef name="init-test-preferences"> |
---|
385 | <attribute name="testfamily"/> |
---|
386 | <sequential> |
---|
387 | <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/> |
---|
388 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/> |
---|
389 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/> |
---|
390 | </sequential> |
---|
391 | </macrodef> |
---|
392 | <target name="test-init" depends="init-properties"> |
---|
393 | <mkdir dir="${test.dir}/build"/> |
---|
394 | <mkdir dir="${test.dir}/build/unit"/> |
---|
395 | <mkdir dir="${test.dir}/build/functional"/> |
---|
396 | <mkdir dir="${test.dir}/build/performance"/> |
---|
397 | <mkdir dir="${test.dir}/report"/> |
---|
398 | <init-test-preferences testfamily="unit"/> |
---|
399 | <init-test-preferences testfamily="functional"/> |
---|
400 | <init-test-preferences testfamily="performance"/> |
---|
401 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" /> |
---|
402 | </target> |
---|
403 | <target name="test-clean" depends="init-properties"> |
---|
404 | <delete dir="${test.dir}/build"/> |
---|
405 | <delete dir="${test.dir}/report"/> |
---|
406 | <delete file="${test.dir}/jacoco.exec" /> |
---|
407 | <delete file="${test.dir}/jacocoIT.exec" /> |
---|
408 | <delete file="${test.dir}/config/unit-josm.home" failonerror="false"/> |
---|
409 | <delete file="${test.dir}/config/functional-josm.home" failonerror="false"/> |
---|
410 | <delete file="${test.dir}/config/performance-josm.home" failonerror="false"/> |
---|
411 | </target> |
---|
412 | <macrodef name="call-groovyc"> |
---|
413 | <attribute name="testfamily"/> |
---|
414 | <element name="cp-elements"/> |
---|
415 | <sequential> |
---|
416 | <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8"> |
---|
417 | <classpath> |
---|
418 | <cp-elements/> |
---|
419 | </classpath> |
---|
420 | <javac target="${java.lang.version}" source="${java.lang.version}" debug="on" encoding="UTF-8"> |
---|
421 | <compilerarg value="-Xlint:all"/> |
---|
422 | <compilerarg value="-Xlint:-serial"/> |
---|
423 | </javac> |
---|
424 | </groovyc> |
---|
425 | </sequential> |
---|
426 | </macrodef> |
---|
427 | <target name="test-compile" depends="test-init,dist"> |
---|
428 | <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="${groovy.jar}"/> |
---|
429 | <call-groovyc testfamily="unit"> |
---|
430 | <cp-elements> |
---|
431 | <path refid="test.classpath"/> |
---|
432 | </cp-elements> |
---|
433 | </call-groovyc> |
---|
434 | <call-groovyc testfamily="functional"> |
---|
435 | <cp-elements> |
---|
436 | <path refid="test.classpath"/> |
---|
437 | <pathelement path="${test.dir}/build/unit"/> |
---|
438 | </cp-elements> |
---|
439 | </call-groovyc> |
---|
440 | <call-groovyc testfamily="performance"> |
---|
441 | <cp-elements> |
---|
442 | <path refid="test.classpath"/> |
---|
443 | <pathelement path="${test.dir}/build/unit"/> |
---|
444 | </cp-elements> |
---|
445 | </call-groovyc> |
---|
446 | </target> |
---|
447 | <macrodef name="call-junit"> |
---|
448 | <attribute name="testfamily"/> |
---|
449 | <attribute name="testITsuffix" default=""/> |
---|
450 | <attribute name="coverage" default="true"/> |
---|
451 | <sequential> |
---|
452 | <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/> |
---|
453 | <jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="org.openstreetmap.josm.*"> |
---|
454 | <junit printsummary="yes" fork="true" forkmode="once"> |
---|
455 | <jvmarg value="-Dfile.encoding=UTF-8"/> |
---|
456 | <jvmarg value="--add-modules" if:set="isJava9" /> |
---|
457 | <jvmarg value="java.se.ee" if:set="isJava9" /> |
---|
458 | <jvmarg value="--add-exports" if:set="isJava9" /> |
---|
459 | <jvmarg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" /> |
---|
460 | <jvmarg value="--add-exports" if:set="isJava9" /> |
---|
461 | <jvmarg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" /> |
---|
462 | <jvmarg value="--add-exports" if:set="isJava9" /> |
---|
463 | <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" /> |
---|
464 | <jvmarg value="--add-exports" if:set="isJava9" /> |
---|
465 | <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" /> |
---|
466 | <jvmarg value="--add-opens" if:set="isJava9" /> |
---|
467 | <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" /> |
---|
468 | <jvmarg value="--add-opens" if:set="isJava9" /> |
---|
469 | <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" /> |
---|
470 | <jvmarg value="--add-opens" if:set="isJava9" /> |
---|
471 | <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" /> |
---|
472 | <jvmarg value="--add-opens" if:set="isJava9" /> |
---|
473 | <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" /> |
---|
474 | <jvmarg value="--add-opens" if:set="isJava9" /> |
---|
475 | <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" /> |
---|
476 | <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/> |
---|
477 | <sysproperty key="josm.test.data" value="${test.dir}/data"/> |
---|
478 | <sysproperty key="java.awt.headless" value="true"/> |
---|
479 | <sysproperty key="glass.platform" value="Monocle"/> |
---|
480 | <sysproperty key="monocle.platform" value="Headless"/> |
---|
481 | <sysproperty key="prism.order" value="sw"/> |
---|
482 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/> |
---|
483 | <classpath> |
---|
484 | <path refid="test.classpath"/> |
---|
485 | <pathelement path="${test.dir}/build/unit"/> |
---|
486 | <pathelement path="${test.dir}/build/@{testfamily}"/> |
---|
487 | <pathelement path="${test.dir}/config"/> |
---|
488 | </classpath> |
---|
489 | <formatter type="plain"/> |
---|
490 | <formatter type="xml"/> |
---|
491 | <batchtest fork="yes" todir="${test.dir}/report"> |
---|
492 | <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test@{testITsuffix}.class"/> |
---|
493 | </batchtest> |
---|
494 | </junit> |
---|
495 | </jacoco:coverage> |
---|
496 | </sequential> |
---|
497 | </macrodef> |
---|
498 | <target name="test" depends="test-compile" unless="test.notRequired" |
---|
499 | description="Run unit and functional tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password"> |
---|
500 | <call-junit testfamily="unit"/> |
---|
501 | <call-junit testfamily="functional"/> |
---|
502 | </target> |
---|
503 | <target name="test-it" depends="test-compile" unless="test-it.notRequired" |
---|
504 | description="Run integration tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password"> |
---|
505 | <call-junit testfamily="unit" testITsuffix="IT"/> |
---|
506 | <call-junit testfamily="functional" testITsuffix="IT"/> |
---|
507 | </target> |
---|
508 | <target name="test-perf" depends="test-compile" unless="test-perf.notRequired" |
---|
509 | description="Run performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password"> |
---|
510 | <call-junit testfamily="performance" coverage="false"/> |
---|
511 | </target> |
---|
512 | <target name="test-html" depends="test, test-it, test-perf" description="Generate HTML test reports"> |
---|
513 | <!-- May require additional ant dependencies like ant-trax package --> |
---|
514 | <junitreport todir="${test.dir}/report"> |
---|
515 | <fileset dir="${test.dir}/report"> |
---|
516 | <include name="TEST-*.xml"/> |
---|
517 | </fileset> |
---|
518 | <report todir="${test.dir}/report/html"/> |
---|
519 | </junitreport> |
---|
520 | <jacoco:report> |
---|
521 | <executiondata> |
---|
522 | <fileset dir="${test.dir}" includes="*.exec"/> |
---|
523 | </executiondata> |
---|
524 | <structure name="JOSM Test Coverage"> |
---|
525 | <classfiles> |
---|
526 | <fileset dir="${build.dir}" includes="org/openstreetmap/"/> |
---|
527 | </classfiles> |
---|
528 | <sourcefiles encoding="UTF-8"> |
---|
529 | <fileset dir="${src.dir}" includes="org/openstreetmap/"/> |
---|
530 | </sourcefiles> |
---|
531 | </structure> |
---|
532 | <html destdir="${test.dir}/report/jacoco"/> |
---|
533 | </jacoco:report> |
---|
534 | </target> |
---|
535 | <!-- Proguard does not support Java 9 : http://sourceforge.net/p/proguard/bugs/551/ --> |
---|
536 | <target name="dist-optimized" depends="dist" unless="isJava9"> |
---|
537 | <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/> |
---|
538 | <proguard> |
---|
539 | -injars ${dist.jar} |
---|
540 | -outjars ${dist-optimized.jar} |
---|
541 | |
---|
542 | -libraryjars ${java.home}/lib/rt.jar |
---|
543 | -libraryjars ${java.home}/lib/jce.jar |
---|
544 | -libraryjars ${java.home}/lib/ext/jfxrt.jar |
---|
545 | |
---|
546 | -dontoptimize |
---|
547 | -dontobfuscate |
---|
548 | |
---|
549 | # These options probably are not necessary (and make processing a bit slower) |
---|
550 | -dontskipnonpubliclibraryclasses |
---|
551 | -dontskipnonpubliclibraryclassmembers |
---|
552 | |
---|
553 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication { |
---|
554 | public static void main(java.lang.String[]); |
---|
555 | } |
---|
556 | |
---|
557 | -keep class * extends org.openstreetmap.josm.io.FileImporter |
---|
558 | -keep class * extends org.openstreetmap.josm.io.FileExporter |
---|
559 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never |
---|
560 | -keep class org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$PseudoClasses { |
---|
561 | static boolean *(org.openstreetmap.josm.gui.mappaint.Environment); |
---|
562 | } |
---|
563 | -keep class org.apache.commons.logging.impl.* |
---|
564 | |
---|
565 | -keepclassmembers enum * { |
---|
566 | public static **[] values(); |
---|
567 | public static ** valueOf(java.lang.String); |
---|
568 | } |
---|
569 | |
---|
570 | # Keep unused public classes and methods (needed for plugins) |
---|
571 | -keep public class * { |
---|
572 | public protected *; |
---|
573 | } |
---|
574 | |
---|
575 | # Keep serialization code |
---|
576 | -keepclassmembers class * implements java.io.Serializable { |
---|
577 | static final long serialVersionUID; |
---|
578 | private static final java.io.ObjectStreamField[] serialPersistentFields; |
---|
579 | private void writeObject(java.io.ObjectOutputStream); |
---|
580 | private void readObject(java.io.ObjectInputStream); |
---|
581 | java.lang.Object writeReplace(); |
---|
582 | java.lang.Object readResolve(); |
---|
583 | } |
---|
584 | |
---|
585 | # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'. |
---|
586 | # This note should not be a problem as we don't use obfuscation |
---|
587 | -dontnote |
---|
588 | </proguard> |
---|
589 | </target> |
---|
590 | <!-- Proguard does not support Java 9 : http://sourceforge.net/p/proguard/bugs/551/ --> |
---|
591 | <target name="dist-optimized-report" depends="dist-optimized" unless="isJava9"> |
---|
592 | <!-- generate difference report between optimized jar and normal one --> |
---|
593 | <exec executable="perl" dir="${basedir}"> |
---|
594 | <arg value="tools/japicc/japi-compliance-checker.pl"/> |
---|
595 | <arg value="--lib=JOSM"/> |
---|
596 | <arg value="--keep-internal"/> |
---|
597 | <arg value="--v1=${version.entry.commit.revision}"/> |
---|
598 | <arg value="--v2=${version.entry.commit.revision}-optimized"/> |
---|
599 | <arg value="--report-path=${dist.dir}/compat_report.html"/> |
---|
600 | <arg value="${dist.jar}"/> |
---|
601 | <arg value="${dist-optimized.jar}"/> |
---|
602 | </exec> |
---|
603 | </target> |
---|
604 | <target name="check-plugins" depends="dist-optimized" description="Check of plugins binary compatibility"> |
---|
605 | <local name="dir"/> |
---|
606 | <local name="plugins"/> |
---|
607 | <property name="dir" value="plugin-check"/> |
---|
608 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer"> |
---|
609 | <classpath path="tools/animal-sniffer-ant-tasks.jar"/> |
---|
610 | </typedef> |
---|
611 | <mkdir dir="${dir}"/> |
---|
612 | <!-- List of deprecated plugins --> |
---|
613 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java"> |
---|
614 | <filterchain> |
---|
615 | <linecontains> |
---|
616 | <contains value="new DeprecatedPlugin("/> |
---|
617 | </linecontains> |
---|
618 | <tokenfilter> |
---|
619 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/> |
---|
620 | </tokenfilter> |
---|
621 | <striplinebreaks/> |
---|
622 | <tokenfilter> |
---|
623 | <replaceregex pattern="\|$" replace="" flags="gi"/> |
---|
624 | </tokenfilter> |
---|
625 | </filterchain> |
---|
626 | </loadfile> |
---|
627 | <!-- Download list of plugins --> |
---|
628 | <loadresource property="plugins"> |
---|
629 | <url url="https://josm.openstreetmap.de/plugin"/> |
---|
630 | <filterchain> |
---|
631 | <linecontainsregexp negate="true"> |
---|
632 | <regexp pattern="^\t.*"/> |
---|
633 | </linecontainsregexp> |
---|
634 | <linecontainsregexp negate="true"> |
---|
635 | <regexp pattern="${deprecated-plugins}"/> |
---|
636 | </linecontainsregexp> |
---|
637 | <tokenfilter> |
---|
638 | <replaceregex pattern="^.*;" replace="" flags="gi"/> |
---|
639 | </tokenfilter> |
---|
640 | </filterchain> |
---|
641 | </loadresource> |
---|
642 | <!-- Delete files that are not in plugin list (like old plugins) --> |
---|
643 | <loadresource property="file-list"> |
---|
644 | <propertyresource name="plugins"/> |
---|
645 | <filterchain> |
---|
646 | <tokenfilter> |
---|
647 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/> |
---|
648 | </tokenfilter> |
---|
649 | <striplinebreaks/> |
---|
650 | <tokenfilter> |
---|
651 | <replaceregex pattern="\|$" replace="" flags="gi"/> |
---|
652 | </tokenfilter> |
---|
653 | </filterchain> |
---|
654 | </loadresource> |
---|
655 | <delete> |
---|
656 | <restrict> |
---|
657 | <fileset dir="${dir}"/> |
---|
658 | <not> |
---|
659 | <name regex="${file-list}"/> |
---|
660 | </not> |
---|
661 | </restrict> |
---|
662 | </delete> |
---|
663 | <!-- Download plugins --> |
---|
664 | <copy todir="${dir}" flatten="true"> |
---|
665 | <resourcelist> |
---|
666 | <string value="${plugins}"/> |
---|
667 | </resourcelist> |
---|
668 | </copy> |
---|
669 | <!-- Check plugins --> |
---|
670 | <as:build-signatures destfile="${dir}/api.sig"> |
---|
671 | <path> |
---|
672 | <fileset file="${dist-optimized.jar}"/> |
---|
673 | <fileset file="${java.home}/lib/rt.jar"/> |
---|
674 | <fileset file="${java.home}/lib/jce.jar"/> |
---|
675 | <fileset file="${java.home}/lib/ext/jfxrt.jar"/> |
---|
676 | </path> |
---|
677 | </as:build-signatures> |
---|
678 | <as:check-signature signature="${dir}/api.sig" failonerror="false"> |
---|
679 | <ignore classname="au.*"/> |
---|
680 | <ignore classname="com.*"/> |
---|
681 | <ignore classname="de.*"/> |
---|
682 | <ignore classname="edu.*"/> |
---|
683 | <ignore classname="groovy.*"/> |
---|
684 | <ignore classname="it.*"/> |
---|
685 | <ignore classname="javax.*"/> |
---|
686 | <ignore classname="jogamp.*"/> |
---|
687 | <ignore classname="junit.*"/> |
---|
688 | <ignore classname="kdu_jni.*"/> |
---|
689 | <ignore classname="net.*"/> |
---|
690 | <ignore classname="netscape.*"/> |
---|
691 | <ignore classname="nu.*"/> |
---|
692 | <ignore classname="oracle.*"/> |
---|
693 | <ignore classname="org.apache.*"/> |
---|
694 | <ignore classname="org.bouncycastle.*"/> |
---|
695 | <ignore classname="org.codehaus.*"/> |
---|
696 | <ignore classname="org.dom4j.*"/> |
---|
697 | <ignore classname="org.eclipse.*"/> |
---|
698 | <ignore classname="org.ejml.*"/> |
---|
699 | <ignore classname="org.gdal.*"/> |
---|
700 | <ignore classname="org.hibernate.*"/> |
---|
701 | <ignore classname="org.hsqldb.*"/> |
---|
702 | <ignore classname="org.ibex.*"/> |
---|
703 | <ignore classname="org.iso_relax.*"/> |
---|
704 | <ignore classname="org.jaitools.*"/> |
---|
705 | <ignore classname="org.jaxen.*"/> |
---|
706 | <ignore classname="org.jboss.*"/> |
---|
707 | <ignore classname="org.jdom2.*"/> |
---|
708 | <ignore classname="org.jfree.*"/> |
---|
709 | <ignore classname="org.jgraph.*"/> |
---|
710 | <ignore classname="org.joda.*"/> |
---|
711 | <ignore classname="org.junit.*"/> |
---|
712 | <ignore classname="org.jvnet.*"/> |
---|
713 | <ignore classname="org.kxml2.*"/> |
---|
714 | <ignore classname="org.objectweb.*"/> |
---|
715 | <ignore classname="org.osgi.*"/> |
---|
716 | <ignore classname="org.postgresql.*"/> |
---|
717 | <ignore classname="org.python.*"/> |
---|
718 | <ignore classname="org.seasar.*"/> |
---|
719 | <ignore classname="org.slf4j.*"/> |
---|
720 | <ignore classname="org.springframework.*"/> |
---|
721 | <ignore classname="org.testng.*"/> |
---|
722 | <ignore classname="org.zeromq.*"/> |
---|
723 | <!-- plugins used by another ones --> |
---|
724 | <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/> |
---|
725 | <ignore classname="org.openstreetmap.josm.plugins.jna.*"/> |
---|
726 | <ignore classname="org.openstreetmap.josm.plugins.jts.*"/> |
---|
727 | <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/> |
---|
728 | <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/> |
---|
729 | <path path="${dir}"/> |
---|
730 | </as:check-signature> |
---|
731 | </target> |
---|
732 | |
---|
733 | <macrodef name="_taginfo"> |
---|
734 | <attribute name="type"/> |
---|
735 | <attribute name="output"/> |
---|
736 | <sequential> |
---|
737 | <echo message="Generating Taginfo for type @{type} to @{output}"/> |
---|
738 | <groovy src="${taginfoextract}" classpath="${dist.jar}:tools/spotbugs/spotbugs-annotations.jar"> |
---|
739 | <arg value="-t"/> |
---|
740 | <arg value="@{type}"/> |
---|
741 | <arg value="--noexit"/> |
---|
742 | <arg value="--svnweb"/> |
---|
743 | <arg value="--imgurlprefix"/> |
---|
744 | <arg value="${imgurlprefix}"/> |
---|
745 | <arg value="-o"/> |
---|
746 | <arg value="@{output}"/> |
---|
747 | </groovy> |
---|
748 | </sequential> |
---|
749 | </macrodef> |
---|
750 | |
---|
751 | <target name="taginfo" depends="dist"> |
---|
752 | <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};tools/commons-cli-1.3.1.jar"/> |
---|
753 | <property name="taginfoextract" value="scripts/TagInfoExtract.groovy"/> |
---|
754 | <property name="imgurlprefix" value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/> |
---|
755 | <_taginfo type="mappaint" output="taginfo_style.json"/> |
---|
756 | <_taginfo type="presets" output="taginfo_presets.json"/> |
---|
757 | <_taginfo type="external_presets" output="taginfo_external_presets.json"/> |
---|
758 | </target> |
---|
759 | |
---|
760 | <target name="imageryindex" depends="init-properties"> |
---|
761 | <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};tools/commons-cli-1.3.1.jar"/> |
---|
762 | <echo message="Checking editor imagery difference"/> |
---|
763 | <groovy src="scripts/SyncEditorLayerIndex.groovy" classpath="${dist.jar}"> |
---|
764 | <arg value="-noeli"/> |
---|
765 | <arg value="-p"/> |
---|
766 | <arg value="imagery_eliout.imagery.xml"/> |
---|
767 | <arg value="-q"/> |
---|
768 | <arg value="imagery_josmout.imagery.xml"/> |
---|
769 | </groovy> |
---|
770 | </target> |
---|
771 | |
---|
772 | <target name="imageryindexdownload"> |
---|
773 | <exec append="false" executable="wget" failifexecutionfails="true"> |
---|
774 | <arg value="https://josm.openstreetmap.de/maps"/> |
---|
775 | <arg value="-O"/> |
---|
776 | <arg value="imagery_josm.imagery.xml"/> |
---|
777 | <arg value="--unlink"/> |
---|
778 | </exec> |
---|
779 | <exec append="false" executable="wget" failifexecutionfails="true"> |
---|
780 | <arg value="https://josm.openstreetmap.de/wiki/ImageryCompareIgnores?format=txt"/> |
---|
781 | <arg value="-O"/> |
---|
782 | <arg value="imagery_josm.ignores.txt"/> |
---|
783 | <arg value="--unlink"/> |
---|
784 | </exec> |
---|
785 | <exec append="false" executable="wget" failifexecutionfails="true"> |
---|
786 | <arg value="https://raw.githubusercontent.com/osmlab/editor-layer-index/gh-pages/imagery.geojson"/> |
---|
787 | <arg value="-O"/> |
---|
788 | <arg value="imagery_eli.geojson"/> |
---|
789 | <arg value="--unlink"/> |
---|
790 | </exec> |
---|
791 | <antcall target="imageryindex"/> |
---|
792 | </target> |
---|
793 | |
---|
794 | <target name="checkstyle-compile" depends="init-properties"> |
---|
795 | <mkdir dir="${checkstyle-build.dir}"/> |
---|
796 | <javac sourcepath="" srcdir="${base.dir}/tools/checkstyle/src" failonerror="true" |
---|
797 | destdir="${checkstyle-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" |
---|
798 | includeantruntime="false" createMissingPackageInfoClass="false" |
---|
799 | encoding="UTF-8" classpath="tools/checkstyle/checkstyle-all.jar"> |
---|
800 | </javac> |
---|
801 | </target> |
---|
802 | <target name="checkstyle" depends="checkstyle-compile"> |
---|
803 | <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" |
---|
804 | classpath="tools/checkstyle/checkstyle-all.jar:${checkstyle-build.dir}"/> |
---|
805 | <checkstyle config="tools/checkstyle/josm_checks.xml"> |
---|
806 | <fileset dir="${base.dir}/src/org/openstreetmap/josm" includes="**/*.java" |
---|
807 | excludes="gui/mappaint/mapcss/parsergen/*.java"/> |
---|
808 | <fileset dir="${base.dir}/test" includes="**/*.java"/> |
---|
809 | <formatter type="plain"/> |
---|
810 | <formatter type="xml" toFile="checkstyle-josm.xml"/> |
---|
811 | </checkstyle> |
---|
812 | </target> |
---|
813 | |
---|
814 | <target name="spotbugs" depends="dist"> |
---|
815 | <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/spotbugs/spotbugs-ant.jar"/> |
---|
816 | <path id="spotbugs-classpath"> |
---|
817 | <fileset dir="${base.dir}/tools/spotbugs/"> |
---|
818 | <include name="*.jar"/> |
---|
819 | </fileset> |
---|
820 | </path> |
---|
821 | <property name="spotbugs-classpath" refid="spotbugs-classpath"/> |
---|
822 | <spotbugs output="xml" |
---|
823 | outputFile="spotbugs-josm.xml" |
---|
824 | classpath="${spotbugs-classpath}" |
---|
825 | pluginList="" |
---|
826 | excludeFilter="tools/spotbugs/josm-filter.xml" |
---|
827 | effort="max" |
---|
828 | reportLevel="low" |
---|
829 | > |
---|
830 | <sourcePath path="${base.dir}/src" /> |
---|
831 | <class location="${dist.jar}" /> |
---|
832 | </spotbugs> |
---|
833 | </target> |
---|
834 | |
---|
835 | <target name="pmd" depends="init-properties"> |
---|
836 | <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpath="${toString:pmd.classpath}"/> |
---|
837 | <pmd shortFilenames="true" encoding="UTF-8"> |
---|
838 | <sourceLanguage name="java" version="${java.lang.version}" /> |
---|
839 | <ruleset>${base.dir}/tools/pmd/josm-ruleset.xml</ruleset> |
---|
840 | <formatter type="text" toConsole="true" /> |
---|
841 | <formatter type="xml" toFile="pmd-josm.xml"> |
---|
842 | <param name="encoding" value="UTF-8" /> |
---|
843 | </formatter> |
---|
844 | <fileset dir="${src.dir}"> |
---|
845 | <include name="org/openstreetmap/josm/**/*.java"/> |
---|
846 | <exclude name="org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/*.java" /> |
---|
847 | </fileset> |
---|
848 | </pmd> |
---|
849 | </target> |
---|
850 | |
---|
851 | <target name="run" depends="dist"> |
---|
852 | <java jar="${dist.jar}" fork="true"> |
---|
853 | <arg value="--set=expert=true"/> |
---|
854 | <arg value="--set=remotecontrol.enabled=true"/> |
---|
855 | <arg value="--set=debug.edt-checker.enable=false"/> |
---|
856 | <jvmarg value="-Djosm.home=/tmp/.josm/"/> |
---|
857 | </java> |
---|
858 | </target> |
---|
859 | <!-- |
---|
860 | ** Compile build script for generating projection list. |
---|
861 | --> |
---|
862 | <target name="epsg-compile" depends="init-properties"> |
---|
863 | <property name="proj-classpath" location="${build.dir}"/> |
---|
864 | <mkdir dir="${proj-build.dir}"/> |
---|
865 | <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" |
---|
866 | destdir="${proj-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" |
---|
867 | includeantruntime="false" createMissingPackageInfoClass="false" |
---|
868 | encoding="UTF-8" classpath="${proj-classpath}"> |
---|
869 | </javac> |
---|
870 | </target> |
---|
871 | <!-- |
---|
872 | ** generate projection list. |
---|
873 | --> |
---|
874 | <target name="epsg" depends="epsg-compile"> |
---|
875 | <touch file="${epsg.output}"/> |
---|
876 | <java classname="BuildProjectionDefinitions" failonerror="true" fork="true"> |
---|
877 | <sysproperty key="java.awt.headless" value="true"/> |
---|
878 | <classpath> |
---|
879 | <pathelement path="${base.dir}"/> |
---|
880 | <pathelement path="${proj-classpath}"/> |
---|
881 | <pathelement path="${proj-build.dir}"/> |
---|
882 | </classpath> |
---|
883 | <arg value="${base.dir}"/> |
---|
884 | </java> |
---|
885 | </target> |
---|
886 | </project> |
---|