source: josm/trunk/build.xml @ 2360

Last change on this file since 2360 was 2360, checked in by stoecker, 14 years ago

fix defaults when svn is missing, disable usertools

File size: 5.6 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">
65                        <manifest>
66                                <attribute name="Main-class" value="JOSM" />
67                                <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
68                                <attribute name="Main-Date" value="${version.entry.commit.date}"/>
69                        </manifest>
70                        <zipfileset dir="presets" prefix="presets" />
71                        <zipfileset dir="images" prefix="images" />
72                        <zipfileset src="lib/josm-translation.jar" />
73
74                        <!-- All jar files necessary to run only JOSM (no tests) -->
75                        <zipfileset src="lib/gettext-commons-0.9.6.jar" />
76                        <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar" />
77                </jar>
78        </target>
79
80        <target name="distmac" depends="dist">
81                <!-- modify MacOS X Info.plist file to hold the SVN version number -->
82                <copy file="macosx/JOSM.app/Contents/Info.plist" todir="build"/>
83                <replace file="build/Info.plist" token="@SVNVersion@" value="${version.entry.commit.revision}"/>
84                <!-- create ZIP file with MacOS X application bundle -->
85                <zip destfile="dist/josm-custom-macosx.zip" update="true">
86                        <zipfileset dir="build" includes="CONTRIBUTION README LICENSE"/>
87                        <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"/>
88                        <zipfileset dir="build" includes="Info.plist" prefix="JOSM.app/Contents"/>
89                        <zipfileset dir="dist" includes="josm-custom.jar" prefix="JOSM.app/Contents/Resources/Java"/>
90                        <zipfileset dir="macosx" includes="JOSM.app/Contents/MacOS/JOSM" filemode="755"/>
91                </zip>
92        </target>
93
94        <target name="compile" depends="init">
95                <javac srcdir="src" classpathref="classpath" destdir="build"
96                                target="1.5" source="1.5" debug="on" encoding="UTF-8">
97                        <compilerarg value="-Xlint:deprecation"/>
98                        <compilerarg value="-Xlint:unchecked"/>
99                </javac>
100        </target>
101
102        <target name="init">
103                <mkdir dir="build" />
104                <mkdir dir="dist" />
105        </target>
106
107        <target name="clean">
108                <delete dir="build" />
109                <delete dir="dist" />
110        </target>
111
112        <path id="test.classpath">
113                <fileset dir="${test.dir}/lib">
114                        <include name="**/*.jar"/>
115                </fileset>
116                <fileset dir="lib">
117                        <include name="**/*.jar"/>
118                </fileset>
119        </path>
120
121        <target name="test-init">
122                <mkdir dir="${test.dir}/${build.dir}" />
123                <mkdir dir="${test.dir}/report" />
124        </target>
125
126        <target name="test-clean">
127                <delete dir="${test.dir}/${build.dir}"/>
128                <delete dir="${test.dir}/report"/>
129        </target>
130
131        <target name="test-compile" depends="test-init">
132                <javac srcdir="${src.dir}:${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
133                                target="1.5" source="1.5" debug="on" encoding="UTF-8">
134                        <compilerarg value="-Xlint:deprecation"/>
135                        <compilerarg value="-Xlint:unchecked"/>
136                </javac>
137        </target>
138
139    <target name="test" depends="test-compile">
140        <junit printsummary="yes">
141                <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
142            <classpath>
143                <path refid="test.classpath"/>
144                <pathelement path="${test.dir}/${build.dir}"/>
145                <pathelement path="${test.dir}/config"/>
146            </classpath>
147            <formatter type="plain"/>
148            <batchtest fork="no" todir="${test.dir}/report">
149                <fileset dir="${test.dir}/unit" includes="**/*.java"/>
150            </batchtest>
151        </junit>
152    </target>
153
154</project>
Note: See TracBrowser for help on using the repository browser.