source: subversion/applications/viewer/jmapviewer/build.xml @ 34943

Last change on this file since 34943 was 34764, checked in by donvip, 10 months ago

fix javadoc

File size: 8.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<project default="all" name="jmapviewer" xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if" xmlns:unless="ant:unless">
3
4    <property name="java.lang.version" value="1.8" />
5    <dirname property="base.dir" file="${ant.file.jmapviewer}"/>
6    <property name="tools.dir" location="${base.dir}/tools"/>
7    <property name="jacoco.includes" value="org.openstreetmap.gui.jmapviewer.*" />
8    <property name="jacoco.inclbootstrapclasses" value="false" />
9    <property name="jacoco.inclnolocationclasses" value="false" />
10    <!-- For Java specific stuff by version -->
11    <condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" /></condition>
12    <condition property="isJava10"><matches string="${ant.java.version}" pattern="1[0-9]" /></condition>
13    <condition property="isJava11"><matches string="${ant.java.version}" pattern="1[1-9]" /></condition>
14    <condition property="isJava12"><matches string="${ant.java.version}" pattern="1[2-9]" /></condition>
15    <condition property="isJava13"><matches string="${ant.java.version}" pattern="1[3-9]" /></condition>
16    <!-- Disable jacoco on Java 13+, see https://github.com/jacoco/jacoco/pull/738 -->
17    <condition property="coverageByDefault">
18        <not>
19            <isset property="isJava13"/>
20        </not>
21    </condition>
22    <path id="test.classpath">
23        <fileset dir="${tools.dir}/testlib">
24            <include name="**/*.jar"/>
25        </fileset>
26        <pathelement location="bin"/>
27    </path>
28
29    <target name="all" depends="clean,build,test,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
30
31    <target name="clean">
32        <mkdir dir="bin" />
33        <mkdir dir="bintest" />
34        <mkdir dir="javadoc" />
35        <mkdir dir="report" />
36        <delete>
37            <fileset dir="bin">
38                <include name="**" />
39            </fileset>
40            <fileset dir="bintest">
41                <include name="**" />
42            </fileset>
43            <fileset dir="javadoc">
44                <include name="**" />
45            </fileset>
46            <fileset dir="report">
47                <include name="**" />
48            </fileset>
49            <fileset dir="." includes="*.jar,*.exec"/>
50        </delete>
51    </target>
52
53    <target name="build" depends="clean">
54        <javac srcdir="src" destdir="bin" source="${java.lang.version}" target="${java.lang.version}" debug="true" includeantruntime="false" encoding="UTF-8">
55            <include name="org/openstreetmap/gui/jmapviewer/**" />
56        </javac>
57
58        <copy todir="bin">
59            <fileset dir="src">
60                <include name="**/*.png" />
61            </fileset>
62        </copy>
63    </target>
64
65    <target name="svn_info" description="Get SVN info for use in JAR/ZIP filenames.">
66        <!-- Get the svn ReleaseVersion property -->
67        <exec executable="svn" outputproperty="svnReleaseVersion">
68            <arg line="propget ReleaseVersion" />
69            <env key="LANG" value="en_US"/>
70        </exec>
71    </target>
72   
73    <target name="pack" depends="build">
74        <!-- Create the JAR file containing the compiled class files -->
75        <jar destfile="JMapViewer.jar" filesetmanifest="mergewithoutmain">
76            <fileset dir="bin" includes="**/jmapviewer/**" />
77        </jar>
78        <!-- Create the JAR file containing the source java files -->
79        <jar destfile="JMapViewer_src.jar" filesetmanifest="mergewithoutmain">
80            <fileset dir="src" includes="**/jmapviewer/**" />
81        </jar>
82    </target>
83   
84    <!-- if you want to build outside of svn, use "ant clean build [pack]" -->
85   
86    <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.">
87        <jar destfile="JMapViewer_Demo.jar" filesetmanifest="mergewithoutmain">
88            <manifest>
89                <attribute name="Main-Class" value="org.openstreetmap.gui.jmapviewer.Demo" />
90                <attribute name="Class-Path" value="JMapViewer.jar" />
91            </manifest>
92        </jar>
93    </target>
94
95    <target name="create_release_zip" description="Create a release zip file containing the binary and source jar files as well as the demo starter">
96        <zip basedir="." destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}.zip">
97            <include name="JMapViewer*.jar" />
98            <include name="Readme.txt" />
99            <include name="Gpl.txt" />
100        </zip>
101        <delete>
102            <fileset dir="." includes="JMapViewer*.jar"/>
103        </delete> 
104    </target>
105   
106    <target name="create_source_release_zip" description="Create a release zip file containing the source files">
107        <zip destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}-Source.zip">
108            <zipfileset file="Readme.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
109            <zipfileset file="build.xml" prefix="jmapviewer-${svnReleaseVersion}"/>
110            <zipfileset file="Gpl.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
111            <zipfileset dir="src" includes="**/jmapviewer/**" prefix="jmapviewer-${svnReleaseVersion}/src"/>
112        </zip>
113    </target>
114
115    <target name="checkstyle">
116        <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" 
117            classpath="tools/checkstyle/checkstyle-all.jar"/>
118        <checkstyle config="tools/checkstyle/jmapviewer_checks.xml">
119            <fileset dir="${basedir}/src" includes="**/*.java" />
120            <formatter type="xml" toFile="checkstyle-jmapviewer.xml"/>
121        </checkstyle>
122    </target>
123
124    <target name="spotbugs" depends="pack">
125        <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" 
126            classpath="tools/spotbugs/spotbugs-ant.jar"/>
127        <path id="spotbugs-classpath">
128            <fileset dir="tools/spotbugs/">
129                <include name="*.jar"/>
130            </fileset>
131        </path>
132        <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
133        <spotbugs output="xml"
134                outputFile="spotbugs-jmapviewer.xml"
135                classpath="${spotbugs-classpath}"
136                effort="max"
137                >
138            <sourcePath path="${basedir}/src" />
139            <class location="JMapViewer.jar" />
140        </spotbugs>
141    </target>
142
143    <target name="javadoc">
144        <javadoc destdir="javadoc" 
145                sourcepath="src"
146                encoding="UTF-8"   
147                packagenames="org.openstreetmap.gui.jmapviewer.*"
148                windowtitle="JMapViewer"
149                use="true"
150                private="true"
151                linksource="true"
152                author="false">
153            <link href="https://docs.oracle.com/javase/8/docs/api"/>
154            <doctitle><![CDATA[<h2>JMapViewer - Javadoc</h2>]]></doctitle>
155            <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JMapViewer</a>]]></bottom>
156            <arg value="-html5" if:set="isJava9" />
157        </javadoc>
158    </target>
159
160    <target name="test" depends="clean, build">
161        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
162        <javac srcdir="test" destdir="bintest"
163            target="${java.lang.version}" source="${java.lang.version}" debug="on"
164            includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
165            <compilerarg value="-Xlint:all"/>
166            <compilerarg value="-Xlint:-serial"/>
167            <classpath>
168                <path refid="test.classpath"/>
169            </classpath>
170        </javac>
171        <jacoco:coverage enabled="@{coverage}" includes="${jacoco.includes}"
172            inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
173            <junit printsummary="yes" fork="true" forkmode="once">
174                <jvmarg value="-Dfile.encoding=UTF-8"/>
175                <classpath>
176                    <path refid="test.classpath"/>
177                    <pathelement location="bintest"/>
178                </classpath>
179                <formatter type="plain"/>
180                <formatter type="xml"/>
181                <batchtest fork="yes" todir="report">
182                    <fileset dir="bintest" includes="**/*Test.class"/>
183                </batchtest>
184            </junit>
185        </jacoco:coverage>
186    </target>
187
188</project>
Note: See TracBrowser for help on using the repository browser.