Ticket #8645: excludeTransifexPlugins2.patch

File excludeTransifexPlugins2.patch, 4.6 KB (added by floscher, 22 months ago)

Improved version of the previous patch, the <if></if> was surrounding too much of the plugintrans target.

  • i18n/build.xml

    diff --git a/i18n/build.xml b/i18n/build.xml
    index 7def4d5fc..2fcd8c710 100644
    a b  
    4444        </exec>
    4545        <copy file="specialmessages.java" todir="${i18n.build.dir}"/>
    4646    </target>
    47     <target name="po/josm.pot" description="Extracts message keys from the source code" depends="trans_.java,init">
     47<!-- 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}" -->
     48    <target name="filterpluginsources" depends="init">
     49        <delete file="${po.build.dir}/pluginSrc.txt"/>
     50        <foreach param="path" target="filterpluginsource">
     51            <path>
     52                <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
     53            </path>
     54        </foreach>
     55    </target>
     56<!-- Helper task for `filterpluginsources`: Appends an include pattern to the file `build/pluginSrc.txt` if there is no file `.tx/config` for a plugin -->
     57    <target name="filterpluginsource">
     58      <if>
     59          <not>
     60              <available file="${path}/.tx/config" type="file" />
     61          </not>
     62          <then>
     63              <basename file="${path}" property="dir"/>
     64              <echo file="${po.build.dir}/pluginSrc.txt" append="true" message="${dir}/**/*.java&#xa;"></echo>
     65          </then>
     66      </if>
     67    </target>
     68    <target name="po/josm.pot" description="Extracts message keys from the source code" depends="trans_.java,init,filterpluginsources">
    4869        <gettext-extract keysFile="josm.raw.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
    4970            <!-- core.port -->
    5071            <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
     
    5778            <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
    5879            <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> disable for now -->
    5980            <!-- plugins.pot -->
    60             <fileset dir="${plugin.dir}" includes="**/*.java"/>
     81            <fileset dir="${plugin.dir}" includesfile="${po.build.dir}/pluginSrc.txt"/>
    6182            <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
    6283            <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
    6384        </gettext-extract>
     
    93114    </target>
    94115    <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,po/data.pot,init">
    95116        <gettext-extract keysFile="plugins.raw.pot" poDirectory="${i18n.build.dir}" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
    96             <fileset dir="${plugin.dir}" includes="**/*.java"/>
     117            <fileset dir="${plugin.dir}" includesfile="${po.build.dir}/pluginSrc.txt"/>
    97118            <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
    98119            <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
    99120        </gettext-extract>
     
    138159            <arg line="i18n.pl --potfile=po/data.pot --basedir=${i18n_data.install.dir}/ po/*.po"/>
    139160        </exec>
    140161    </target>
     162<!-- 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. -->
    141163    <target name="plugintrans">
    142164        <basename file="${path}" property="dir"/>
    143165        <mkdir dir="${po.build.dir}/plugin_${dir}"/>
     
    150172            <fileset dir="${i18n.build.dir}" includes="trans_${dir}.java"/> <!-- include plugin specific translation -->
    151173        </gettext-extract>
    152174        <if>
    153             <available file="${po.build.dir}/plugin_${dir}/josm.pot"/>
     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>
    154179            <then>
    155180                <exec executable="perl" failonerror="true">
    156181                    <arg line="i18n.pl --potfile=${po.build.dir}/plugin_${dir}/josm.pot --basedir=${plugin.dir}/${dir}/data/ po/*.po"/>
     
    181206        <exec executable="perl" failonerror="true">
    182207            <arg line="launchpad.pl bzronly"/>
    183208        </exec>
    184         <antcall target="build"/>       
     209        <antcall target="build"/>
    185210    </target>
    186211    <target name="updatecore">
    187212        <exec executable="perl" failonerror="true">
    188213            <arg line="launchpad.pl bzronly"/>
    189214        </exec>
    190         <antcall target="buildcore"/>       
     215        <antcall target="buildcore"/>
    191216    </target>
    192217</project>