source: subversion/applications/editors/josm/plugins/routes/build.xml @ 32306

Last change on this file since 32306 was 32306, checked in by donvip, 3 years ago

rework/simplify plugins build.xml file - automatically run unit tests of all plugins, without having to maintain list manually

  • Property svn:mime-type set to text/xml
File size: 7.2 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<project name="routes" default="dist" basedir=".">
3    <property name="commit.message" value="Changed the constructor signature of the plugin main class"/>
4    <property name="plugin.main.version" value="8811"/>
5    <property name="josm" location="../../core/dist/josm-custom.jar"/>
6    <property name="plugin.dist.dir" value="../../dist"/>
7    <property name="plugin.build.dir" value="build"/>
8    <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
9    <property name="ant.build.javac.target" value="1.7"/>
10    <target name="init">
11        <mkdir dir="${plugin.build.dir}"/>
12    </target>
13    <target name="compile" depends="init">
14        <echo message="creating ${plugin.jar}"/>
15        <javac srcdir="src" debug="true" destdir="${plugin.build.dir}" includeantruntime="false">
16            <compilerarg value="-Xlint:deprecation"/>
17            <compilerarg value="-Xlint:unchecked"/>
18            <classpath>
19                <pathelement location="${josm}"/>
20                <fileset dir="lib">
21                    <include name="**/*.jar"/>
22                </fileset>
23            </classpath>
24        </javac>
25        <copy file="src/org/openstreetmap/josm/plugins/routes/xml/routes.xml" todir="${plugin.build.dir}/org/openstreetmap/josm/plugins/routes/xml"/>
26        <copy file="src/org/openstreetmap/josm/plugins/routes/xml/routes.xsd" todir="${plugin.build.dir}/org/openstreetmap/josm/plugins/routes/xml"/>
27    </target>
28    <target name="dist" depends="compile,revision">
29        <copy todir="${plugin.build.dir}/data">
30            <fileset dir="data"/>
31        </copy>
32        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}" manifestencoding="UTF-8">
33            <manifest>
34                <attribute name="Author" value="Jiri Klement"/>
35                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.routes.RoutesPlugin"/>
36                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
37                <attribute name="Plugin-Description" value="Renders routes (bus, hiking trails, bicycle routes, ..). Route types must be defined in routes.xml file in plugin directory"/>
38                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
39                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
40            </manifest>
41        </jar>
42    </target>
43    <target name="test"/>
44    <target name="revision">
45        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
46            <env key="LANG" value="C"/>
47            <arg value="info"/>
48            <arg value="--xml"/>
49            <arg value="."/>
50        </exec>
51        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
52        <delete file="REVISION"/>
53    </target>
54    <target name="clean">
55        <delete dir="${plugin.build.dir}"/>
56        <delete file="${plugin.jar}"/>
57    </target>
58    <target name="install" depends="dist">
59        <property environment="env"/>
60        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
61            <and>
62                <os family="windows"/>
63            </and>
64        </condition>
65        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
66    </target>
67    <!--
68         ************************** Publishing the plugin ***********************************
69        -->
70    <!--
71        ** extracts the JOSM release for the JOSM version in ../core and saves it in the
72        ** property ${coreversion.info.entry.revision}
73        **
74        -->
75    <target name="core-info">
76        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
77            <env key="LANG" value="C"/>
78            <arg value="info"/>
79            <arg value="--xml"/>
80            <arg value="../../core"/>
81        </exec>
82        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
83        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
84        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
85        <delete file="core.info.xml"/>
86    </target>
87    <!--
88        ** commits the source tree for this plugin
89        -->
90    <target name="commit-current">
91        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
92        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
93            <env key="LANG" value="C"/>
94            <arg value="commit"/>
95            <arg value="-m '${commit.message}'"/>
96            <arg value="."/>
97        </exec>
98    </target>
99    <!--
100        ** updates (svn up) the source tree for this plugin
101        -->
102    <target name="update-current">
103        <echo>Updating plugin source ...</echo>
104        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
105            <env key="LANG" value="C"/>
106            <arg value="up"/>
107            <arg value="."/>
108        </exec>
109        <echo>Updating ${plugin.jar} ...</echo>
110        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
111            <env key="LANG" value="C"/>
112            <arg value="up"/>
113            <arg value="../dist/${plugin.jar}"/>
114        </exec>
115    </target>
116    <!--
117        ** commits the plugin.jar
118        -->
119    <target name="commit-dist">
120        <echo>
121    ***** Properties of published ${plugin.jar} *****
122    Commit message    : '${commit.message}'
123    Plugin-Mainversion: ${plugin.main.version}
124    JOSM build version: ${coreversion.info.entry.revision}
125    Plugin-Version    : ${version.entry.commit.revision}
126    ***** / Properties of published ${plugin.jar} *****
127
128    Now commiting ${plugin.jar} ...
129    </echo>
130        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
131            <env key="LANG" value="C"/>
132            <arg value="-m '${commit.message}'"/>
133            <arg value="commit"/>
134            <arg value="${plugin.jar}"/>
135        </exec>
136    </target>
137    <!-- ** make sure svn is present as a command line tool ** -->
138    <target name="ensure-svn-present">
139        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
140            <env key="LANG" value="C"/>
141            <arg value="--version"/>
142        </exec>
143        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
144            <!-- return code not set at all? Most likely svn isn't installed -->
145            <condition>
146                <not>
147                    <isset property="svn.exit.code"/>
148                </not>
149            </condition>
150        </fail>
151        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
152            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
153            <condition>
154                <isfailure code="${svn.exit.code}"/>
155            </condition>
156        </fail>
157    </target>
158    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
159    </target>
160</project>
Note: See TracBrowser for help on using the repository browser.