source: osm/applications/viewer/jmapviewer/build.xml@ 34124

Last change on this file since 34124 was 34124, checked in by donvip, 7 years ago

Generate HTML5 javadoc for Java >= 9

File size: 5.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<project default="all" name="jmapviewer" xmlns:if="ant:if" xmlns:unless="ant:unless">
3
4 <property name="java.lang.version" value="1.8" />
5 <!-- For Java9-specific stuff -->
6 <condition property="isJava9">
7 <matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" />
8 </condition>
9
10 <target name="all" depends="clean,build,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
11
12 <target name="clean">
13 <mkdir dir="bin" />
14 <delete>
15 <fileset dir="bin">
16 <include name="**" />
17 </fileset>
18 <fileset dir="." includes="*.jar"/>
19 </delete>
20 </target>
21
22 <target name="build">
23 <javac srcdir="src" destdir="bin" source="${java.lang.version}" target="${java.lang.version}" debug="true" includeantruntime="false" encoding="UTF-8">
24 <include name="org/openstreetmap/gui/jmapviewer/**" />
25 </javac>
26
27 <copy todir="bin">
28 <fileset dir="src">
29 <include name="**/*.png" />
30 </fileset>
31 </copy>
32 </target>
33
34 <target name="svn_info" description="Get SVN info for use in JAR/ZIP filenames.">
35 <!-- Get the svn ReleaseVersion property -->
36 <exec executable="svn" outputproperty="svnReleaseVersion">
37 <arg line="propget ReleaseVersion" />
38 <env key="LANG" value="en_US"/>
39 </exec>
40 </target>
41
42 <target name="pack" depends="build">
43 <!-- Create the JAR file containing the compiled class files -->
44 <jar destfile="JMapViewer.jar" filesetmanifest="mergewithoutmain">
45 <fileset dir="bin" includes="**/jmapviewer/**" />
46 </jar>
47 <!-- Create the JAR file containing the source java files -->
48 <jar destfile="JMapViewer_src.jar" filesetmanifest="mergewithoutmain">
49 <fileset dir="src" includes="**/jmapviewer/**" />
50 </jar>
51 </target>
52
53 <!-- if you want to build outside of svn, use "ant clean build [pack]" -->
54
55 <target name="create_run_jar" description="Create a JAR file that can be used to execute the JMapViewer demo app. Requires JMapViewer.jar to be present.">
56 <jar destfile="JMapViewer_Demo.jar" filesetmanifest="mergewithoutmain">
57 <manifest>
58 <attribute name="Main-Class" value="org.openstreetmap.gui.jmapviewer.Demo" />
59 <attribute name="Class-Path" value="JMapViewer.jar" />
60 </manifest>
61 </jar>
62 </target>
63
64 <target name="create_release_zip" description="Create a release zip file containing the binary and source jar files as well as the demo starter">
65 <zip basedir="." destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}.zip">
66 <include name="JMapViewer*.jar" />
67 <include name="Readme.txt" />
68 <include name="Gpl.txt" />
69 </zip>
70 <delete>
71 <fileset dir="." includes="JMapViewer*.jar"/>
72 </delete>
73 </target>
74
75 <target name="create_source_release_zip" description="Create a release zip file containing the source files">
76 <zip destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}-Source.zip">
77 <zipfileset file="Readme.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
78 <zipfileset file="build.xml" prefix="jmapviewer-${svnReleaseVersion}"/>
79 <zipfileset file="Gpl.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
80 <zipfileset dir="src" includes="**/jmapviewer/**" prefix="jmapviewer-${svnReleaseVersion}/src"/>
81 </zip>
82 </target>
83
84 <target name="checkstyle">
85 <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
86 classpath="tools/checkstyle/checkstyle-all.jar"/>
87 <checkstyle config="tools/checkstyle/jmapviewer_checks.xml">
88 <fileset dir="${basedir}/src" includes="**/*.java" />
89 <formatter type="xml" toFile="checkstyle-jmapviewer.xml"/>
90 </checkstyle>
91 </target>
92
93 <target name="spotbugs" depends="pack">
94 <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
95 classpath="tools/spotbugs/spotbugs-ant.jar"/>
96 <path id="spotbugs-classpath">
97 <fileset dir="tools/spotbugs/">
98 <include name="*.jar"/>
99 </fileset>
100 </path>
101 <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
102 <spotbugs output="xml"
103 outputFile="spotbugs-jmapviewer.xml"
104 classpath="${spotbugs-classpath}"
105 effort="max"
106 >
107 <sourcePath path="${basedir}/src" />
108 <class location="JMapViewer.jar" />
109 </spotbugs>
110 </target>
111
112 <target name="javadoc">
113 <javadoc destdir="javadoc"
114 sourcepath="src"
115 encoding="UTF-8"
116 packagenames="org.openstreetmap.gui.jmapviewer.*"
117 windowtitle="JMapViewer"
118 use="true"
119 private="true"
120 linksource="true"
121 author="false">
122 <link href="http://docs.oracle.com/javase/8/docs/api"/>
123 <doctitle><![CDATA[<h2>JMapViewer - Javadoc</h2>]]></doctitle>
124 <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JMapViewer</a>]]></bottom>
125 <arg value="-html5" if:set="isJava9" />
126 </javadoc>
127 </target>
128
129</project>
Note: See TracBrowser for help on using the repository browser.