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