[2369] | 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 | -->
|
---|
[1751] | 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"/>
|
---|
[2618] | 16 | <!-- build parameter: compression level (ant -Dclevel=N)
|
---|
[2507] | 17 | N ranges from 0 (no compression) to 9 (maximum compression)
|
---|
| 18 | default: 9 -->
|
---|
[2618] | 19 | <condition property="clevel" value="${clevel}" else="9">
|
---|
| 20 | <isset property="clevel" />
|
---|
| 21 | </condition>
|
---|
[1751] | 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>
|
---|
[2453] | 29 |
|
---|
[2618] | 30 |
|
---|
[2358] | 31 | <!--
|
---|
[2453] | 32 | ** Used by Eclipse ant builder for updating
|
---|
| 33 | ** the REVISION file used by JOSM
|
---|
[2618] | 34 | -->
|
---|
[2453] | 35 | <target name="create-revision-eclipse">
|
---|
| 36 | <property name="revision.dir" value="bin"/>
|
---|
| 37 | <antcall target="create-revision" />
|
---|
| 38 | </target>
|
---|
| 39 |
|
---|
| 40 | <!--
|
---|
[2358] | 41 | ** Creates the REVISION file to be included in the distribution
|
---|
[2618] | 42 | -->
|
---|
[2358] | 43 | <target name="create-revision">
|
---|
[2453] | 44 | <property name="revision.dir" value="${build.dir}"/>
|
---|
| 45 | <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false">
|
---|
[2618] | 46 | <env key="LANG" value="C"/>
|
---|
| 47 | <arg value="info"/>
|
---|
| 48 | <arg value="--xml"/>
|
---|
| 49 | <arg value="."/>
|
---|
[2453] | 50 | </exec>
|
---|
| 51 | <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 52 | <delete file="REVISION.XML" />
|
---|
[2358] | 53 | <tstamp>
|
---|
[2618] | 54 | <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
|
---|
[2360] | 55 | </tstamp>
|
---|
[1751] | 56 |
|
---|
[2360] | 57 | <property name="version.entry.commit.revision" value="UNKNOWN"/>
|
---|
[2453] | 58 | <mkdir dir="${revision.dir}" />
|
---|
| 59 | <echo file="${revision.dir}/REVISION">
|
---|
[2360] | 60 | # automatically generated by JOSM build.xml - do not edit
|
---|
[2358] | 61 | Revision: ${version.entry.commit.revision}
|
---|
| 62 | Is-Local-Build: true
|
---|
| 63 | Build-Date: ${build.tstamp}
|
---|
[2618] | 64 | </echo>
|
---|
[2358] | 65 | </target>
|
---|
[1751] | 66 |
|
---|
[2618] | 67 |
|
---|
[2358] | 68 | <target name="dist" depends="compile,create-revision">
|
---|
| 69 |
|
---|
[1751] | 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"/>
|
---|
[2618] | 80 | <echo>Revision ${version.entry.commit.revision}</echo>
|
---|
[1751] | 81 | <copy file="CONTRIBUTION" todir="build"/>
|
---|
| 82 | <copy file="README" todir="build"/>
|
---|
| 83 | <copy file="LICENSE" todir="build"/>
|
---|
| 84 |
|
---|
[2618] | 85 | <!-- styles -->
|
---|
[1751] | 86 | <copy file="styles/standard/elemstyles.xml" todir="build/styles/standard"/>
|
---|
| 87 |
|
---|
| 88 | <!-- create josm-custom.jar -->
|
---|
| 89 | <delete file="dist/josm-custom.jar"/>
|
---|
[2397] | 90 | <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
|
---|
[2618] | 91 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
|
---|
[1751] | 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="presets" prefix="presets" />
|
---|
| 98 | <zipfileset dir="images" prefix="images" />
|
---|
[2507] | 99 | <zipfileset dir="data" prefix="data" />
|
---|
[1751] | 100 | <zipfileset src="lib/josm-translation.jar" />
|
---|
| 101 |
|
---|
| 102 | <!-- All jar files necessary to run only JOSM (no tests) -->
|
---|
| 103 | <zipfileset src="lib/gettext-commons-0.9.6.jar" />
|
---|
| 104 | <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar" />
|
---|
| 105 | </jar>
|
---|
| 106 | </target>
|
---|
| 107 |
|
---|
| 108 | <target name="distmac" depends="dist">
|
---|
| 109 | <!-- modify MacOS X Info.plist file to hold the SVN version number -->
|
---|
| 110 | <copy file="macosx/JOSM.app/Contents/Info.plist" todir="build"/>
|
---|
| 111 | <replace file="build/Info.plist" token="@SVNVersion@" value="${version.entry.commit.revision}"/>
|
---|
| 112 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
| 113 | <zip destfile="dist/josm-custom-macosx.zip" update="true">
|
---|
| 114 | <zipfileset dir="build" includes="CONTRIBUTION README LICENSE"/>
|
---|
| 115 | <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"/>
|
---|
| 116 | <zipfileset dir="build" includes="Info.plist" prefix="JOSM.app/Contents"/>
|
---|
| 117 | <zipfileset dir="dist" includes="josm-custom.jar" prefix="JOSM.app/Contents/Resources/Java"/>
|
---|
| 118 | <zipfileset dir="macosx" includes="JOSM.app/Contents/MacOS/JOSM" filemode="755"/>
|
---|
| 119 | </zip>
|
---|
| 120 | </target>
|
---|
| 121 |
|
---|
| 122 | <target name="compile" depends="init">
|
---|
| 123 | <javac srcdir="src" classpathref="classpath" destdir="build"
|
---|
| 124 | target="1.5" source="1.5" debug="on" encoding="UTF-8">
|
---|
| 125 | <compilerarg value="-Xlint:deprecation"/>
|
---|
[1941] | 126 | <compilerarg value="-Xlint:unchecked"/>
|
---|
[1751] | 127 | </javac>
|
---|
| 128 | </target>
|
---|
| 129 |
|
---|
| 130 | <target name="init">
|
---|
| 131 | <mkdir dir="build" />
|
---|
| 132 | <mkdir dir="dist" />
|
---|
| 133 | </target>
|
---|
| 134 |
|
---|
| 135 | <target name="clean">
|
---|
| 136 | <delete dir="build" />
|
---|
| 137 | <delete dir="dist" />
|
---|
| 138 | </target>
|
---|
| 139 |
|
---|
| 140 | <path id="test.classpath">
|
---|
| 141 | <fileset dir="${test.dir}/lib">
|
---|
| 142 | <include name="**/*.jar"/>
|
---|
| 143 | </fileset>
|
---|
| 144 | <fileset dir="lib">
|
---|
| 145 | <include name="**/*.jar"/>
|
---|
| 146 | </fileset>
|
---|
| 147 | </path>
|
---|
| 148 |
|
---|
| 149 | <target name="test-init">
|
---|
| 150 | <mkdir dir="${test.dir}/${build.dir}" />
|
---|
| 151 | <mkdir dir="${test.dir}/report" />
|
---|
| 152 | </target>
|
---|
| 153 |
|
---|
| 154 | <target name="test-clean">
|
---|
| 155 | <delete dir="${test.dir}/${build.dir}"/>
|
---|
| 156 | <delete dir="${test.dir}/report"/>
|
---|
| 157 | </target>
|
---|
| 158 |
|
---|
| 159 | <target name="test-compile" depends="test-init">
|
---|
| 160 | <javac srcdir="${src.dir}:${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
|
---|
| 161 | target="1.5" source="1.5" debug="on" encoding="UTF-8">
|
---|
| 162 | <compilerarg value="-Xlint:deprecation"/>
|
---|
[1941] | 163 | <compilerarg value="-Xlint:unchecked"/>
|
---|
[1751] | 164 | </javac>
|
---|
[2618] | 165 | <javac srcdir="${src.dir}:${test.dir}/functional" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
|
---|
| 166 | target="1.5" source="1.5" debug="on" encoding="UTF-8">
|
---|
| 167 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 168 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 169 | </javac>
|
---|
[1751] | 170 | </target>
|
---|
| 171 |
|
---|
[2618] | 172 | <target name="test" depends="test-compile">
|
---|
| 173 | <junit printsummary="yes">
|
---|
| 174 | <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
|
---|
| 175 | <classpath>
|
---|
| 176 | <path refid="test.classpath"/>
|
---|
| 177 | <pathelement path="${test.dir}/${build.dir}"/>
|
---|
| 178 | <pathelement path="${test.dir}/config"/>
|
---|
| 179 | </classpath>
|
---|
| 180 | <formatter type="plain"/>
|
---|
| 181 | <batchtest fork="no" todir="${test.dir}/report">
|
---|
| 182 | <fileset dir="${test.dir}/unit" includes="**/*.java"/>
|
---|
| 183 | </batchtest>
|
---|
| 184 | </junit>
|
---|
| 185 | </target>
|
---|
[1751] | 186 |
|
---|
| 187 | </project>
|
---|