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

Last change on this file since 31768 was 31768, checked in by donvip, 4 years ago

[josm_plugins] see #josm12048 - always use UTF-8 for jar manifests

  • 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="revision">
44        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
45            <env key="LANG" value="C"/>
46            <arg value="info"/>
47            <arg value="--xml"/>
48            <arg value="."/>
49        </exec>
50        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
51        <delete file="REVISION"/>
52    </target>
53    <target name="clean">
54        <delete dir="${plugin.build.dir}"/>
55        <delete file="${plugin.jar}"/>
56    </target>
57    <target name="install" depends="dist">
58        <property environment="env"/>
59        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
60            <and>
61                <os family="windows"/>
62            </and>
63        </condition>
64        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
65    </target>
66    <!--
67         ************************** Publishing the plugin ***********************************
68        -->
69    <!--
70        ** extracts the JOSM release for the JOSM version in ../core and saves it in the
71        ** property ${coreversion.info.entry.revision}
72        **
73        -->
74    <target name="core-info">
75        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
76            <env key="LANG" value="C"/>
77            <arg value="info"/>
78            <arg value="--xml"/>
79            <arg value="../../core"/>
80        </exec>
81        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
82        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
83        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
84        <delete file="core.info.xml"/>
85    </target>
86    <!--
87        ** commits the source tree for this plugin
88        -->
89    <target name="commit-current">
90        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
91        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
92            <env key="LANG" value="C"/>
93            <arg value="commit"/>
94            <arg value="-m '${commit.message}'"/>
95            <arg value="."/>
96        </exec>
97    </target>
98    <!--
99        ** updates (svn up) the source tree for this plugin
100        -->
101    <target name="update-current">
102        <echo>Updating plugin source ...</echo>
103        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
104            <env key="LANG" value="C"/>
105            <arg value="up"/>
106            <arg value="."/>
107        </exec>
108        <echo>Updating ${plugin.jar} ...</echo>
109        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
110            <env key="LANG" value="C"/>
111            <arg value="up"/>
112            <arg value="../dist/${plugin.jar}"/>
113        </exec>
114    </target>
115    <!--
116        ** commits the plugin.jar
117        -->
118    <target name="commit-dist">
119        <echo>
120    ***** Properties of published ${plugin.jar} *****
121    Commit message    : '${commit.message}'
122    Plugin-Mainversion: ${plugin.main.version}
123    JOSM build version: ${coreversion.info.entry.revision}
124    Plugin-Version    : ${version.entry.commit.revision}
125    ***** / Properties of published ${plugin.jar} *****
126
127    Now commiting ${plugin.jar} ...
128    </echo>
129        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
130            <env key="LANG" value="C"/>
131            <arg value="-m '${commit.message}'"/>
132            <arg value="commit"/>
133            <arg value="${plugin.jar}"/>
134        </exec>
135    </target>
136    <!-- ** make sure svn is present as a command line tool ** -->
137    <target name="ensure-svn-present">
138        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
139            <env key="LANG" value="C"/>
140            <arg value="--version"/>
141        </exec>
142        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
143            <!-- return code not set at all? Most likely svn isn't installed -->
144            <condition>
145                <not>
146                    <isset property="svn.exit.code"/>
147                </not>
148            </condition>
149        </fail>
150        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
151            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
152            <condition>
153                <isfailure code="${svn.exit.code}"/>
154            </condition>
155        </fail>
156    </target>
157    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
158    </target>
159</project>
Note: See TracBrowser for help on using the repository browser.