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