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

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

JOSM/i18n: rename "data" to "pluginlist"

see #josm8645

File size: 11.4 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 <target name="init" description="Loads the Ant gettext and contrib tasks">
20 <taskdef name="gettext-extract" classname="org.xnap.commons.ant.gettext.GettextExtractKeysTask" classpath="${gettexttasks.jar}"/>
21 <!-- for the <foreach> possibility -->
22 <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${antcontrib.jar}"/>
23 </target>
24 <target name="builddir">
25 <mkdir dir="${i18n.build.dir}"/>
26 </target>
27 <target name="trans_.java" depends="builddir">
28 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_presets.java">
29 <arg line="convpreset.pl ${josm.presets}"/>
30 </exec>
31 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_maps.java">
32 <arg line="convmaps.pl ${maps.srcfile}"/>
33 </exec>
34 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_surveyor.java">
35 <arg line="convsurveyor.pl ${surveyor.srcfile}"/>
36 </exec>
37 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_tag2link.java">
38 <arg line="convtag2link.pl ${tag2link.srcfile}"/>
39 </exec>
40 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_plugins.java">
41 <arg line="convplugins.pl ${plugin.dir}/*/build.xml"/>
42 </exec>
43 <exec executable="perl" failonerror="true">
44 <arg line="convwiki.pl ${wiki.srcfile} ${i18n.build.dir}/josmfiles ${i18n.build.dir}/josmfiles.zip"/>
45 </exec>
46 <copy file="specialmessages.java" todir="${i18n.build.dir}"/>
47 </target>
48 <!-- 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}" -->
49 <target name="filterpluginsources" depends="init">
50 <delete file="${po.build.dir}/pluginSrc.txt"/>
51 <foreach param="path" target="filterpluginsource">
52 <path>
53 <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
54 </path>
55 </foreach>
56 </target>
57 <!-- Helper task for `filterpluginsources`: Appends an include pattern to the file `build/pluginSrc.txt` if there is no file `.tx/config` for a plugin -->
58 <target name="filterpluginsource">
59 <if>
60 <not>
61 <available file="${path}/.tx/config" type="file" />
62 </not>
63 <then>
64 <basename file="${path}" property="dir"/>
65 <echo file="${po.build.dir}/pluginSrc.txt" append="true" message="${dir}/**/*.java&#xa;"></echo>
66 </then>
67 </if>
68 </target>
69 <target name="po/josm.pot" description="Extracts message keys from the source code" depends="trans_.java,init,filterpluginsources">
70 <gettext-extract keysFile="josm.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot">
71 <!-- core.pot -->
72 <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
73 <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
74 <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
75 <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
76 <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
77 <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
78 <!-- data.pot -->
79 <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
80 <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> disable for now -->
81 <!-- plugins.pot -->
82 <fileset dir="${plugin.dir}" includesfile="${po.build.dir}/pluginSrc.txt"/>
83 <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
84 <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
85 </gettext-extract>
86 </target>
87 <target name="po/core.pot" description="Extracts message keys from the JOSM core source code" depends="trans_.java,init">
88 <gettext-extract keysFile="core.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot">
89 <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
90 <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
91 <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
92 <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
93 <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
94 <!-- maps should be in data instead, but that requires language file loading support in trac python code -->
95 <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
96 </gettext-extract>
97 </target>
98 <target name="po/pluginlist.pot" description="Extracts message keys from plugin descriptions" depends="trans_.java,init">
99 <gettext-extract keysFile="pluginlist.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot">
100 <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
101 <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> -->
102 </gettext-extract>
103 </target>
104 <target name="po/plugins.pot" description="Extracts message keys from the plugins source code (minus core and data strings)" depends="trans_.java,po/core.pot,init">
105 <gettext-extract keysFile="plugins.pot" poDirectory="po" keywords="${gettext.keywords} --exclude-file=excludes.pot --exclude-file=po/core.pot">
106 <fileset dir="${plugin.dir}" includesfile="${po.build.dir}/pluginSrc.txt"/>
107 <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
108 <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
109 </gettext-extract>
110 </target>
111 <target name="build" depends="pot,allpot">
112 <antcall target="buildcore"/>
113 <antcall target="buildplugins"/>
114 </target>
115 <target name="buildplugins" depends="init">
116 <foreach param="path" target="plugintrans" parallel="true" maxThreads="8">
117 <path>
118 <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
119 </path>
120 </foreach>
121 </target>
122 <target name="singleplugintrans" depends="init">
123 <antcall target="plugintrans">
124 <param name="path" value="${plugin}"/>
125 </antcall>
126 </target>
127 <target name="buildcore">
128 <antcall target="coretrans"/>
129 <antcall target="pluginlisttrans"/>
130 </target>
131 <target name="coretrans" depends="po/core.pot">
132 <exec executable="perl" failonerror="true">
133 <arg line="i18n.pl --potfile=po/core.pot --basedir=${i18n.install.dir}/ po/*.po"/>
134 </exec>
135 </target>
136 <target name="pluginlisttrans" depends="po/pluginlist.pot">
137 <exec executable="perl" failonerror="true">
138 <arg line="i18n.pl --potfile=po/pluginlist.pot --basedir=${pluginlist.install.dir}/ po/*.po"/>
139 </exec>
140 </target>
141 <!-- 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. -->
142 <!-- If the plugin has a Transifex config file `.tx/config`, skip this target altogether -->
143 <target name="plugintrans">
144 <basename file="${path}" property="dir"/>
145 <if>
146 <available file="${plugin.dir}/${dir}/.tx/config" type="file"/>
147 <then>
148 <echo message="Skip plugin ${dir}, because it is translated with Transifex!"/>
149 </then>
150 <else>
151 <echo message="Run plugintrans target for plugin ${dir}" level="info"/>
152 <mkdir dir="${po.build.dir}/plugin_${dir}"/>
153 <exec executable="perl" failonerror="true" output="${po.build.dir}/plugin_${dir}/trans_plugin.java">
154 <arg line="convplugins.pl ${plugin.dir}/${dir}/build.xml"/>
155 </exec>
156 <gettext-extract keysFile="josm.pot" poDirectory="${po.build.dir}/plugin_${dir}" keywords="${gettext.keywords}">
157 <fileset dir="${plugin.dir}/${dir}" includes="**/*.java"/>
158 <fileset dir="${po.build.dir}/plugin_${dir}" includes="trans_*.java"/>
159 <fileset dir="${i18n.build.dir}" includes="trans_${dir}.java"/> <!-- include plugin specific translation -->
160 </gettext-extract>
161 <if>
162 <and>
163 <available file="${po.build.dir}/plugin_${dir}/josm.pot" type="file"/>
164 <available file="${plugin.dir}/${dir}/data/" type="dir"/>
165 </and>
166 <then>
167 <exec executable="perl" failonerror="true">
168 <arg line="i18n.pl --potfile=${po.build.dir}/plugin_${dir}/josm.pot --basedir=${plugin.dir}/${dir}/data/ po/*.po"/>
169 </exec>
170 </then>
171 </if>
172 <delete dir="${po.build.dir}/plugin_${dir}"/>
173 </else>
174 </if>
175 </target>
176 <target name="clean">
177 <delete dir="${i18n.build.dir}"/>
178 <delete file="po/josm.pot"/>
179 <delete>
180 <fileset dir="po" includes="*.*~" defaultexcludes="false"/>
181 </delete>
182 <delete>
183 <fileset dir="po" includes="*.po" defaultexcludes="false"/>
184 </delete>
185 </target>
186 <target name="test" depends="pot">
187 <mkdir dir="${i18n.build.dir}/test"/>
188 <exec executable="perl" failonerror="true">
189 <arg line="i18n.pl --potfile=po/josm.pot --basedir=${i18n.build.dir}/test/ po/*.po"/>
190 </exec>
191 </target>
192 <target name="pot" depends="po/josm.pot" />
193 <target name="allpot" depends="po/core.pot,po/pluginlist.pot,po/plugins.pot" />
194 <target name="update">
195 <exec executable="perl" failonerror="true">
196 <arg line="launchpad.pl bzronly"/>
197 </exec>
198 <antcall target="build"/>
199 </target>
200 <target name="updatecore">
201 <exec executable="perl" failonerror="true">
202 <arg line="launchpad.pl bzronly"/>
203 </exec>
204 <antcall target="buildcore"/>
205 </target>
206</project>
Note: See TracBrowser for help on using the repository browser.