source: subversion/applications/editors/josm/plugins/ext_tools/build.xml @ 30294

Last change on this file since 30294 was 30034, checked in by donvip, 6 years ago

[josm_plugins] update to [josm6340]

  • Property svn:mime-type set to text/xml
File size: 9.2 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<project name="ext_tools" default="dist" basedir=".">
3    <!-- enter the SVN commit message -->
4    <property name="commit.message" value="ExtTools: help shortcut paser, rebuild"/>
5    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
6    <property name="plugin.main.version" value="6340"/>
7    <!--
8      ************************************************
9      ** should not be necessary to change the following properties
10     -->
11    <property name="josm" location="../../core/dist/josm-custom.jar"/>
12    <property name="plugin.build.dir" value="build"/>
13    <property name="plugin.src.dir" value="src"/>
14    <!-- this is the directory where the plugin jar is copied to -->
15    <property name="plugin.dist.dir" value="../../dist"/>
16    <property name="ant.build.javac.target" value="1.6"/>
17    <property name="plugin.dist.dir" value="../../dist"/>
18    <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
19    <!--
20    **********************************************************
21    ** init - initializes the build
22    **********************************************************
23    -->
24    <target name="init">
25        <mkdir dir="${plugin.build.dir}"/>
26    </target>
27    <!--
28    **********************************************************
29    ** compile - complies the source tree
30    **********************************************************
31    -->
32    <target name="compile" depends="init">
33        <echo message="compiling sources for  ${plugin.jar} ... "/>
34        <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
35            <compilerarg value="-Xlint:deprecation"/>
36            <compilerarg value="-Xlint:unchecked"/>
37        </javac>
38    </target>
39    <!--
40    **********************************************************
41    ** dist - creates the plugin jar
42    **********************************************************
43    -->
44    <target name="dist" depends="compile,revision">
45        <echo message="creating ${ant.project.name}.jar ... "/>
46        <copy todir="${plugin.build.dir}/resources">
47            <fileset dir="resources"/>
48        </copy>
49        <copy todir="${plugin.build.dir}/images">
50            <fileset dir="images"/>
51        </copy>
52        <copy todir="${plugin.build.dir}/data">
53            <fileset dir="data"/>
54        </copy>
55        <copy todir="${plugin.build.dir}">
56            <fileset dir=".">
57                <include name="README"/>
58                <include name="LICENSE"/>
59            </fileset>
60        </copy>
61        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
62            <!--
63        ************************************************
64        ** configure these properties. Most of them will be copied to the plugins
65        ** manifest file. Property values will also show up in the list available
66        ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
67        **
68        ************************************************
69    -->
70            <manifest>
71                <attribute name="Author" value="Upliner"/>
72                <attribute name="Plugin-Class" value="ext_tools.ExtToolsPlugin"/>
73                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
74                <attribute name="Plugin-Description" value="Use external scripts in JOSM"/>
75                <attribute name="Plugin-Icon" value="images/ext.png"/>
76                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/ExtTools"/>
77                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
78                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
79            </manifest>
80        </jar>
81    </target>
82    <!--
83    **********************************************************
84    ** revision - extracts the current revision number for the
85    **    file build.number and stores it in the XML property
86    **    version.*
87    **********************************************************
88    -->
89    <target name="revision">
90        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
91            <env key="LANG" value="C"/>
92            <arg value="info"/>
93            <arg value="--xml"/>
94            <arg value="."/>
95        </exec>
96        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
97        <delete file="REVISION"/>
98    </target>
99    <!--
100    **********************************************************
101    ** clean - clean up the build environment
102    **********************************************************
103    -->
104    <target name="clean">
105        <delete dir="${plugin.build.dir}"/>
106        <delete file="${plugin.jar}"/>
107    </target>
108    <!--
109    **********************************************************
110    ** install - install the plugin in your local JOSM installation
111    **********************************************************
112    -->
113    <target name="install" depends="dist">
114        <property environment="env"/>
115        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
116            <and>
117                <os family="windows"/>
118            </and>
119        </condition>
120        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
121    </target>
122    <!--
123    ************************** Publishing the plugin ***********************************
124    -->
125    <!--
126        ** extracts the JOSM release for the JOSM version in ../core and saves it in the
127        ** property ${coreversion.info.entry.revision}
128        **
129        -->
130    <target name="core-info">
131        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
132            <env key="LANG" value="C"/>
133            <arg value="info"/>
134            <arg value="--xml"/>
135            <arg value="../../core"/>
136        </exec>
137        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
138        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
139        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
140        <delete file="core.info.xml"/>
141    </target>
142    <!--
143        ** commits the source tree for this plugin
144        -->
145    <target name="commit-current">
146        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
147        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
148            <env key="LANG" value="C"/>
149            <arg value="commit"/>
150            <arg value="-m '${commit.message}'"/>
151            <arg value="."/>
152        </exec>
153    </target>
154    <!--
155        ** updates (svn up) the source tree for this plugin
156        -->
157    <target name="update-current">
158        <echo>Updating plugin source ...</echo>
159        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
160            <env key="LANG" value="C"/>
161            <arg value="up"/>
162            <arg value="."/>
163        </exec>
164        <echo>Updating ${plugin.jar} ...</echo>
165        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
166            <env key="LANG" value="C"/>
167            <arg value="up"/>
168            <arg value="../dist/${plugin.jar}"/>
169        </exec>
170    </target>
171    <!--
172        ** commits the plugin.jar
173        -->
174    <target name="commit-dist">
175        <echo>
176    ***** Properties of published ${plugin.jar} *****
177    Commit message    : '${commit.message}'
178    Plugin-Mainversion: ${plugin.main.version}
179    JOSM build version: ${coreversion.info.entry.revision}
180    Plugin-Version    : ${version.entry.commit.revision}
181    ***** / Properties of published ${plugin.jar} *****
182
183    Now commiting ${plugin.jar} ...
184    </echo>
185        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
186            <env key="LANG" value="C"/>
187            <arg value="-m '${commit.message}'"/>
188            <arg value="commit"/>
189            <arg value="${plugin.jar}"/>
190        </exec>
191    </target>
192    <!-- ** make sure svn is present as a command line tool ** -->
193    <target name="ensure-svn-present">
194        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
195            <env key="LANG" value="C"/>
196            <arg value="--version"/>
197        </exec>
198        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
199            <!-- return code not set at all? Most likely svn isn't installed -->
200            <condition>
201                <not>
202                    <isset property="svn.exit.code"/>
203                </not>
204            </condition>
205        </fail>
206        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
207            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
208            <condition>
209                <isfailure code="${svn.exit.code}"/>
210            </condition>
211        </fail>
212    </target>
213    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
214    </target>
215</project>
Note: See TracBrowser for help on using the repository browser.