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