source: josm/trunk/build.xml@ 2368

Last change on this file since 2368 was 2368, checked in by framm, 16 years ago

compress resulting jar file maximally

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