source: josm/trunk/build.xml @ 2358

Last change on this file since 2358 was 2358, checked in by Gubaer, 14 years ago

fixed #3305: Version is UNKNOWN
fixed #3429: created_by=* includes the wrong language when uploading from a new layer

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