source: osm/applications/editors/josm/i18n/build.xml@ 34809

Last change on this file since 34809 was 34697, checked in by simon04, 6 years ago

Revert "JOSM/i18n: merge pluginstrans w/ singleplugintrans"

https://josm.openstreetmap.de/ticket/8645#comment:133

File size: 12.6 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<project name="JOSM i18n" default="build" basedir=".">
3 <!-- compilation properties -->
4 <property name="josm.build.dir" value="../core"/>
5 <property name="josm.presets" value="${josm.build.dir}/data/defaultpresets.xml"/>
6 <property name="plugin.dir" value="../plugins"/>
7 <property name="maps.srcfile" value="https://josm.openstreetmap.de/maps"/>
8 <property name="wiki.srcfile" value="https://josm.openstreetmap.de/josmfile?mode=en"/>
9 <property name="surveyor.srcfile" value="${plugin.dir}/surveyor/resources/surveyor.xml"/>
10 <property name="tag2link.srcfile" value="${plugin.dir}/tag2link/resources/tag2link_sources.xml"/>
11 <property name="i18n.build.dir" value="build"/>
12 <property name="i18n.install.dir" value="${josm.build.dir}/data"/>
13 <property name="pluginlist.install.dir" value="${josm.build.dir}/data_nodist/trans"/>
14 <property name="po.build.dir" value="${i18n.build.dir}"/>
15 <property name="ant.build.javac.target" value="1.5"/>
16 <property name="gettext.keywords" value="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3"/>
17 <property name="gettexttasks.jar" value="lib/gettext-ant-tasks-0.9.7.jar"/>
18 <property name="antcontrib.jar" value="lib/ant-contrib-1.0b3.jar"/>
19 <property name="grand.jar" value="lib/grand-1.9.5.jar"/>
20 <target name="init" description="Loads the Ant gettext and contrib tasks">
21 <taskdef name="gettext-extract" classname="org.xnap.commons.ant.gettext.GettextExtractKeysTask" classpath="${gettexttasks.jar}"/>
22 <!-- for the <foreach> possibility -->
23 <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${antcontrib.jar}"/>
24 </target>
25 <target name="builddir">
26 <mkdir dir="${i18n.build.dir}"/>
27 </target>
28 <target name="trans_.java" depends="builddir">
29 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_presets.java">
30 <arg line="convpreset.pl ${josm.presets}"/>
31 </exec>
32 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_maps.java">
33 <arg line="convmaps.pl ${maps.srcfile}"/>
34 </exec>
35 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_surveyor.java">
36 <arg line="convsurveyor.pl ${surveyor.srcfile}"/>
37 </exec>
38 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_tag2link.java">
39 <arg line="convtag2link.pl ${tag2link.srcfile}"/>
40 </exec>
41 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_plugins.java">
42 <arg line="convplugins.pl ${plugin.dir}/*/build.xml"/>
43 </exec>
44 <exec executable="perl" failonerror="true">
45 <arg line="convwiki.pl ${wiki.srcfile} ${i18n.build.dir}/josmfiles ${i18n.build.dir}/josmfiles.zip"/>
46 </exec>
47 <copy file="specialmessages.java" todir="${i18n.build.dir}"/>
48 </target>
49 <!-- Create the file build/pluginSrc.txt, which contains a list of include patterns for all *.java files that should be translated relative to "${plugin.dir}" -->
50 <target name="filterpluginsources" depends="init">
51 <delete file="${po.build.dir}/pluginSrc.txt"/>
52 <foreach param="path" target="filterpluginsource">
53 <path>
54 <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
55 </path>
56 </foreach>
57 </target>
58 <!-- Helper task for `filterpluginsources`: Appends an include pattern to the file `build/pluginSrc.txt` if there is no file `.tx/config` for a plugin -->
59 <target name="filterpluginsource">
60 <if>
61 <not>
62 <available file="${path}/.tx/config" type="file" />
63 </not>
64 <then>
65 <basename file="${path}" property="dir"/>
66 <echo file="${po.build.dir}/pluginSrc.txt" append="true" message="${dir}/**/*.java&#xa;"></echo>
67 </then>
68 </if>
69 </target>
70 <target name="po/josm.pot" description="Extracts message keys from the source code" depends="trans_.java,init,filterpluginsources">
71 <gettext-extract keysFile="josm.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot">
72 <!-- core.pot -->
73 <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
74 <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
75 <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
76 <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
77 <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
78 <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
79 <!-- data.pot -->
80 <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
81 <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> disable for now -->
82 <!-- plugins.pot -->
83 <fileset dir="${plugin.dir}" includesfile="${po.build.dir}/pluginSrc.txt"/>
84 <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
85 <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
86 </gettext-extract>
87 </target>
88 <target name="po/core+maplist+presets.pot" depends="po/core.pot,po/maplist.pot,po/presets.pot">
89 <exec executable="msgcat" failonerror="true" output="po/core+maplist+presets.pot">
90 <arg line="po/core.pot po/maplist.pot po/presets.pot"/>
91 </exec>
92 </target>
93 <target name="po/core.pot" description="Extracts message keys from the JOSM core source code" depends="init">
94 <gettext-extract keysFile="core.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot">
95 <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
96 <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
97 <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
98 <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
99 </gettext-extract>
100 </target>
101 <target name="po/maplist.pot" description="Extracts message keys from plugin descriptions" depends="trans_.java,init">
102 <gettext-extract keysFile="maplist.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot">
103 <!-- maps should be translated server-side, but that requires language file loading support in trac python code -->
104 <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
105 </gettext-extract>
106 </target>
107 <target name="po/pluginlist.pot" description="Extracts message keys from plugin descriptions" depends="trans_.java,init">
108 <gettext-extract keysFile="pluginlist.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot">
109 <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
110 </gettext-extract>
111 </target>
112 <target name="po/presets.pot" description="Extracts message keys from presets (minus core)" depends="trans_.java,po/core.pot,init">
113 <gettext-extract keysFile="presets.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot --exclude-file=po/core.pot">
114 <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
115 </gettext-extract>
116 </target>
117 <target name="po/plugins.pot" description="Extracts message keys from the plugins source code (minus core)" depends="trans_.java,po/core.pot,po/presets.pot,init,filterpluginsources">
118 <gettext-extract keysFile="plugins.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot --exclude-file=po/core.pot --exclude-file=po/presets.pot">
119 <fileset dir="${plugin.dir}" includesfile="${po.build.dir}/pluginSrc.txt"/>
120 <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
121 <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
122 </gettext-extract>
123 </target>
124 <target name="build" depends="pot">
125 <antcall target="buildcore"/>
126 <antcall target="buildplugins"/>
127 </target>
128 <target name="buildplugins" depends="init">
129 <foreach param="path" target="plugintrans" parallel="true" maxThreads="8">
130 <path>
131 <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
132 </path>
133 </foreach>
134 </target>
135 <target name="singleplugintrans" depends="init">
136 <antcall target="plugintrans">
137 <param name="path" value="${plugin}"/>
138 </antcall>
139 </target>
140 <target name="buildcore">
141 <antcall target="coretrans"/>
142 <antcall target="pluginlisttrans"/>
143 </target>
144 <target name="coretrans" depends="po/core+maplist+presets.pot">
145 <exec executable="perl" failonerror="true">
146 <arg line="i18n.pl --potfile=po/core+maplist+presets.pot --basedir=${i18n.install.dir}/ po/*.po"/>
147 </exec>
148 </target>
149 <target name="pluginlisttrans" depends="po/pluginlist.pot">
150 <exec executable="perl" failonerror="true">
151 <arg line="i18n.pl --potfile=po/pluginlist.pot --basedir=${pluginlist.install.dir}/ po/*.po"/>
152 </exec>
153 </target>
154 <!-- If the file `josm.pot` is present and the plugin has a `data/` directory, update its *.po files based on the ones in the `po/` directory. -->
155 <!-- If the plugin has a Transifex config file `.tx/config`, skip this target altogether -->
156 <target name="plugintrans">
157 <basename file="${path}" property="dir"/>
158 <if>
159 <available file="${plugin.dir}/${dir}/.tx/config" type="file"/>
160 <then>
161 <echo message="Skip plugin ${dir}, because it is translated with Transifex!"/>
162 </then>
163 <else>
164 <echo message="Run plugintrans target for plugin ${dir}" level="info"/>
165 <mkdir dir="${po.build.dir}/plugin_${dir}"/>
166 <exec executable="perl" failonerror="true" output="${po.build.dir}/plugin_${dir}/trans_plugin.java">
167 <arg line="convplugins.pl ${plugin.dir}/${dir}/build.xml"/>
168 </exec>
169 <gettext-extract keysFile="josm.pot" poDirectory="${po.build.dir}/plugin_${dir}" keywords="${gettext.keywords}">
170 <fileset dir="${plugin.dir}/${dir}" includes="**/*.java"/>
171 <fileset dir="${po.build.dir}/plugin_${dir}" includes="trans_*.java"/>
172 <fileset dir="${i18n.build.dir}" includes="trans_${dir}.java"/> <!-- include plugin specific translation -->
173 </gettext-extract>
174 <if>
175 <and>
176 <available file="${po.build.dir}/plugin_${dir}/josm.pot" type="file"/>
177 <available file="${plugin.dir}/${dir}/data/" type="dir"/>
178 </and>
179 <then>
180 <exec executable="perl" failonerror="true">
181 <arg line="i18n.pl --potfile=${po.build.dir}/plugin_${dir}/josm.pot --basedir=${plugin.dir}/${dir}/data/ po/*.po"/>
182 </exec>
183 </then>
184 </if>
185 <delete dir="${po.build.dir}/plugin_${dir}"/>
186 </else>
187 </if>
188 </target>
189 <target name="clean">
190 <delete dir="${i18n.build.dir}"/>
191 <delete file="build.dot"/>
192 <delete file="build.png"/>
193 <delete>
194 <fileset dir="po" includes="*.*~" defaultexcludes="false"/>
195 <fileset dir="po" includes="*.po" defaultexcludes="false"/>
196 <fileset dir="po" includes="*.pot" defaultexcludes="false"/>
197 </delete>
198 </target>
199 <target name="test" depends="pot">
200 <mkdir dir="${i18n.build.dir}/test"/>
201 <exec executable="perl" failonerror="true">
202 <arg line="i18n.pl --potfile=po/josm.pot --basedir=${i18n.build.dir}/test/ po/*.po"/>
203 </exec>
204 </target>
205 <target name="pot" depends="po/josm.pot" />
206 <target name="update">
207 <exec executable="perl" failonerror="true">
208 <arg line="launchpad.pl bzronly"/>
209 </exec>
210 <antcall target="build"/>
211 </target>
212 <target name="updatecore">
213 <exec executable="perl" failonerror="true">
214 <arg line="launchpad.pl bzronly"/>
215 </exec>
216 <antcall target="buildcore"/>
217 </target>
218 <target name="ant-dependencies">
219 <typedef resource="net/ggtools/grand/antlib.xml" classpath="${grand.jar}"/>
220 <grand output="build.dot" outputconfigprefix="grand"/>
221 <exec executable="dot">
222 <arg line="-Tpng -o build.png build.dot"/>
223 </exec>
224 </target>
225</project>
Note: See TracBrowser for help on using the repository browser.