source: subversion/applications/editors/josm/plugins/graphview/build.xml @ 30145

Last change on this file since 30145 was 29854, checked in by donvip, 6 years ago

[josm_plugins] fix #8987 - bump min JOSM version of nearly all plugins to r6162 + code update/cleanup, fix warnings

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