source: osm/applications/editors/josm/plugins/build-common.xml@ 27906

Last change on this file since 27906 was 26341, checked in by bastik, 13 years ago

move common plugin build targets to a single template file; fix i18n for native-password-manager plugin; fix authors

File size: 7.2 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3** Template for the build targets common to all plugins
4** ====================================================
5**
6** To override a property, add it to the plugin build.xml _before_
7** this template has been imported.
8** To override a target, add it _after_ this template has been imported.
9**
10** Paths are relative to the build.xml that imports this template.
11**
12-->
13<project name="plugin_common" basedir=".">
14
15 <property name="josm" location="../../core/dist/josm-custom.jar"/>
16 <property name="plugin.build.dir" value="build"/>
17 <property name="plugin.src.dir" value="src"/>
18 <property name="plugin.lib.dir" value="lib"/>
19 <!-- this is the directory where the plugin jar is copied to -->
20 <property name="plugin.dist.dir" value="../../dist"/>
21 <property name="ant.build.javac.target" value="1.5"/>
22 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
23
24 <!--
25 **********************************************************
26 ** init - initializes the build
27 **********************************************************
28 -->
29 <target name="init">
30 <mkdir dir="${plugin.build.dir}"/>
31 </target>
32 <!--
33 **********************************************************
34 ** compile - complies the source tree
35 **********************************************************
36 -->
37 <target name="compile" depends="init">
38 <echo message="compiling sources for ${plugin.jar} ... "/>
39 <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
40 <compilerarg value="-Xlint:deprecation"/>
41 <compilerarg value="-Xlint:unchecked"/>
42 </javac>
43 </target>
44 <!--
45 **********************************************************
46 ** revision - extracts the current revision number for the
47 ** file build.number and stores it in the XML property
48 ** version.*
49 **********************************************************
50 -->
51 <target name="revision">
52 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
53 <env key="LANG" value="C"/>
54 <arg value="info"/>
55 <arg value="--xml"/>
56 <arg value="."/>
57 </exec>
58 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
59 <delete file="REVISION"/>
60 </target>
61 <!--
62 **********************************************************
63 ** clean - clean up the build environment
64 **********************************************************
65 -->
66 <target name="clean">
67 <delete dir="${plugin.build.dir}"/>
68 <delete file="${plugin.jar}"/>
69 </target>
70 <!--
71 **********************************************************
72 ** install - install the plugin in your local JOSM installation
73 **********************************************************
74 -->
75 <target name="install" depends="dist">
76 <property environment="env"/>
77 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
78 <and>
79 <os family="windows"/>
80 </and>
81 </condition>
82 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
83 </target>
84 <!--
85 ************************** Publishing the plugin ***********************************
86 -->
87 <!--
88 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
89 ** property ${coreversion.info.entry.revision}
90 **
91 -->
92 <target name="core-info">
93 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
94 <env key="LANG" value="C"/>
95 <arg value="info"/>
96 <arg value="--xml"/>
97 <arg value="../../core"/>
98 </exec>
99 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
100 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
101 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
102 <delete file="core.info.xml"/>
103 </target>
104 <!--
105 ** commits the source tree for this plugin
106 -->
107 <target name="commit-current">
108 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
109 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
110 <env key="LANG" value="C"/>
111 <arg value="commit"/>
112 <arg value="-m '${commit.message}'"/>
113 <arg value="."/>
114 </exec>
115 </target>
116 <!--
117 ** updates (svn up) the source tree for this plugin
118 -->
119 <target name="update-current">
120 <echo>Updating plugin source ...</echo>
121 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
122 <env key="LANG" value="C"/>
123 <arg value="up"/>
124 <arg value="."/>
125 </exec>
126 <echo>Updating ${plugin.jar} ...</echo>
127 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
128 <env key="LANG" value="C"/>
129 <arg value="up"/>
130 <arg value="../dist/${plugin.jar}"/>
131 </exec>
132 </target>
133 <!--
134 ** commits the plugin.jar
135 -->
136 <target name="commit-dist">
137 <echo>
138 ***** Properties of published ${plugin.jar} *****
139 Commit message : '${commit.message}'
140 Plugin-Mainversion: ${plugin.main.version}
141 JOSM build version: ${coreversion.info.entry.revision}
142 Plugin-Version : ${version.entry.commit.revision}
143 ***** / Properties of published ${plugin.jar} *****
144
145 Now commiting ${plugin.jar} ...
146 </echo>
147 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
148 <env key="LANG" value="C"/>
149 <arg value="-m '${commit.message}'"/>
150 <arg value="commit"/>
151 <arg value="${plugin.jar}"/>
152 </exec>
153 </target>
154 <!-- ** make sure svn is present as a command line tool ** -->
155 <target name="ensure-svn-present">
156 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
157 <env key="LANG" value="C"/>
158 <arg value="--version"/>
159 </exec>
160 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
161 <!-- return code not set at all? Most likely svn isn't installed -->
162 <condition>
163 <not>
164 <isset property="svn.exit.code"/>
165 </not>
166 </condition>
167 </fail>
168 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
169 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
170 <condition>
171 <isfailure code="${svn.exit.code}"/>
172 </condition>
173 </fail>
174 </target>
175 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
176 </target>
177</project>
178
Note: See TracBrowser for help on using the repository browser.