Author: sflanigan
Date: 2008-11-16 23:10:06 -0500 (Sun, 16 Nov 2008)
New Revision: 11834
Modified:
trunk/i18n/build.xml
trunk/i18n/pom.xml
Log:
Changed prop2pot task to use filename mappers; added P2 metadata generation step.
Modified: trunk/i18n/build.xml
===================================================================
--- trunk/i18n/build.xml 2008-11-16 22:24:49 UTC (rev 11833)
+++ trunk/i18n/build.xml 2008-11-17 04:10:06 UTC (rev 11834)
@@ -2,8 +2,7 @@
<project name="org.jboss.tools.translations" default="debug"
basedir="." xmlns:artifact="urn:maven-artifact-ant">
- <path id="jbtdir" path="..">
- </path>
+ <path id="jbtdir" path=".." />
<property name="jbt.srcdir" value="${toString:jbtdir}" />
<property file="i18n.properties" />
@@ -54,6 +53,10 @@
<!-- xpath task -->
<taskdef resource="net/uworks/andariel/andariel.properties"
classpathref="dependency.classpath" />
+
+ <taskdef name="groovy"
+ classname="org.codehaus.groovy.ant.Groovy"
+ classpathref="dependency.classpath"/>
<!-- ant-gettext tasks -->
<taskdef name="prop2pot"
classname="org.fedorahosted.tennera.antgettext.Prop2PotTask"
classpathref="dependency.classpath" />
@@ -86,31 +89,59 @@
<delete dir="${zipdir}" />
<delete dir="${target.dir}" includes="*.tmp" />
</target>
-
- <target name="prop2pot" description="Extract translation templates
(POT) from the JBoss Tools English properties files" depends="init">
- <delete dir="${potdir}" />
+
+<!-- This is fairly neat, but doesn't preserve the plugin ID...
+ <target name="__prop2pot" depends="init"
+ description="Extract translation templates (POT) from the JBoss Tools English
properties files">
<mkdir dir="${potdir}" />
<for param="srcdir">
<path>
- <!-- paths under jbt.srcdir look like: ${module}/plugins/${plugin}/{src,main,...}
-->
+ paths under jbt.srcdir look like: ${module}/plugins/${plugin}/{src,main,...}
<dirset dir="${jbt.srcdir}" includes="*/plugins/*/*"
excludes="${srcexcludes}" />
</path>
<sequential>
- <!-- work out srcdir's path relative to the jbosstools source tree
- -->
- <propertyregex override="true" property="relativesrcdir"
- input="@{srcdir}" regexp="^${jbt.srcdir}${file.separator}(.*)"
select="\1" />
- <checkprop propname="relativesrcdir"/>
- <propertyregex override="true" property="plugin"
- input="@{srcdir}"
- regexp="^${jbt.srcdir}${file.separator}[^/\\]+${file.separator}plugins${file.separator}([^/\\]+)${file.separator}.*"
- select="\1" />
- <checkprop propname="plugin"/>
- <echo level="verbose" message="extracting strings from @{srcdir}
-> ${potdir}/${relativesrcdir}"/>
- <prop2pot srcDir="@{srcdir}"
dstDir="${potdir}/${relativesrcdir}" />
+ <echo level="verbose" message="Extracting strings from
@{srcdir}"/>
+ <prop2pot srcDir="@{srcdir}" dstDir="${potdir}">
+ <packagemapper from="*.properties" to="*.pot" />
+ </prop2pot>
</sequential>
</for>
</target>
+-->
+
+ <target name="prop2pot" depends="init"
+ description="Extract translation templates (POT) from the JBoss Tools English
properties files">
+ <mkdir dir="${potdir}" />
+ <!-- paths under jbt.srcdir look like: ${module}/plugins/${plugin}/{src,main,...}
-->
+ <prop2pot srcDir="${jbt.srcdir}" dstDir="${potdir}"
includes="*/plugins/*/src/**/*.properties">
+ <chainedmapper>
+ <!-- rename -> "pluginID dash pathRelativeToSrc" -->
+ <regexpmapper from="^.*/plugins/(.*)/src/(.*)" to="\1-\2"
/>
+ <!-- rename org/jboss/ide/*.properties -> org.jboss.ide.*.pot -->
+ <packagemapper from="*.properties" to="*.pot" />
+ <!-- rename -> pluginID/org.jboss.ide.*.pot -->
+ <!--<regexpmapper from="([^-]+)-(.*)"
to="\1/\2"/>-->
+
+ <!-- Silly idea: Replace plugin id in package names with ~
+ <scriptmapper language="groovy"
classpathref="dependency.classpath">
+ //self.addMappedName source.toUpperCase()
+ def m = source =~ /^([^-]+)-(.*)$$/
+ if (m.matches())
+ {
+ def plugin = m[0][1]
+ def resource = m[0][2]
+ def regex2 = plugin+"(.*)"
+ def m2 = resource =~ regex2
+ if(m2.matches())
+ self.addMappedName plugin+"-~"+m2[0][1]
+ else
+ self.addMappedName plugin+"-"+resource
+ }
+ </scriptmapper>
+ -->
+ </chainedmapper>
+ </prop2pot>
+ </target>
<!-- autogenerated "translations" -->
<target name="en" depends="init" description="Generate
English PO files from POT files">
@@ -160,18 +191,18 @@
</macrodef>
<!-- = = = = = = = = = = = = = = = = =
- macrodef: processplugins
+ macrodef: processlocaleplugins
= = = = = = = = = = = = = = = = = -->
- <macrodef name="processplugins">
+ <macrodef name="processlocaleplugins">
<attribute name="rootdir" />
<attribute name="task" />
<sequential>
<for param="plugindir">
<path>
- <dirset dir="@{rootdir}" includes="*/*/plugins/*">
- </dirset>
+ <dirset dir="@{rootdir}" includes="*/*/plugins/*" />
</path>
<sequential>
+ <!-- FIXME -->
<propertyregex override="true" property="locale"
input="@{plugindir}"
regexp="^(a){rootdir}${file.separator}([^/\\]+)${file.separator}.*"
@@ -190,6 +221,7 @@
<propertycopy override="true" property="localename"
from="NAME_${locale}"/>
<echo level="verbose" message="@{plugindir} contains ${locale}
props for plugin ${plugin} in module ${module}"/>
<antcall target="@{task}">
+ <param name="plugin" value="@{plugin}"/>
<param name="plugindir" value="@{plugindir}"/>
</antcall>
</sequential>
@@ -201,11 +233,11 @@
generating manifests -->
<target name="manifests" depends="init"
description="Generate fragment plugin manifests for langpack plugins">
<delete dir="${propdir}"
includes="*/*/plugins/*/META-INF/MANIFEST.MF"/>
- <processplugins rootdir="${propdir}" task="manifest" />
+ <processlocaleplugins rootdir="${propdir}" task="manifest"
/>
</target>
- <!-- Generates the manifest for one plugin. Called by processplugins. -->
+ <!-- Generates the manifest for one plugin. Called by processlocaleplugins. -->
<target name="manifest">
<!-- NB don't depend on initTaskDefs here, or ant loads the
classes over and over until it exhausts memory -->
@@ -230,10 +262,10 @@
<target name="fragments" depends="init"
description="Generate fragment plugin jars to contain translations" >
<delete dir="${jardir}" />
<mkdir dir="${jardir}/plugins" />
- <processplugins rootdir="${propdir}" task="fragment" />
+ <processlocaleplugins rootdir="${propdir}" task="fragment"
/>
</target>
- <!-- Jars up one fragment plugin. Called by processplugins. -->
+ <!-- Jars up one fragment plugin. Called by processlocaleplugins. -->
<target name="fragment">
<!-- NB don't depend on initTaskDefs here, or ant loads the
classes over and over until it exhausts memory -->
@@ -288,6 +320,7 @@
<fileset dir="${jbt.srcdir}"
includes="*/features/*/feature.xml"/>
</path>
<sequential>
+ <!-- FIXME -->
<propertyregex override="true" property="module"
input="@{featurexml}"
regexp="^${jbt.srcdir}${file.separator}([^/\\]+).*"
@@ -395,6 +428,38 @@
</copy>
</target>
+ <target name="p2">
+ <!-- Generate P2 metadata so that update manager won't take forever.
+
http://wiki.eclipse.org/Equinox_p2_Metadata_Generator
/home/sflaniga/apps/eclipse-ganymede/eclipse/eclipse
+ -->
+
+ <exec executable="eclipse">
+ <arg value="-application" />
+ <arg value="org.eclipse.equinox.p2.metadata.generator.EclipseGenerator"
/>
+ <arg value="-updateSite" />
+ <arg value="${jardir}" />
+ <arg value="-site" />
+ <arg value="file://${jardir}/site.xml" />
+ <arg value="-metadataRepository" />
+ <arg value="file://${jardir}" />
+ <arg value="-metadataRepositoryName" />
+ <arg value="JBoss Tools Localization Update Site" />
+ <arg value="-artifactRepository" />
+ <arg value="file://${jardir}" />
+ <arg value="-artifactRepositoryName" />
+ <arg value="JBoss Tools Localization Artifacts" />
+ <arg value="-compress" />
+ <arg value="-append" />
+ <arg value="-reusePack200Files" />
+ <arg value="-noDefaultIUs" />
+ <arg value="--launcher.suppressErrors" />
+ <arg value="-nosplash" />
+ <arg value="-consoleLog" />
+ <arg value="-vmargs" />
+ <arg value="-Xmx256m" />
+ </exec>
+ </target>
+
<target name="zips" depends="init" description="Generate zip
files containing langpacks, one zip per locale">
<delete dir="${zipdir}" />
<mkdir dir="${zipdir}" />
@@ -412,7 +477,7 @@
</for>
</target>
- <target name="all" depends="clean, prop2pot, en, qps, en_AA, po2prop,
manifests, fragments, features, zips"
+ <target name="all" depends="clean, prop2pot, en, qps, en_AA, po2prop,
manifests, fragments, features, p2, zips"
description="Runs all targets in an appropriate order"/>
Modified: trunk/i18n/pom.xml
===================================================================
--- trunk/i18n/pom.xml 2008-11-16 22:24:49 UTC (rev 11833)
+++ trunk/i18n/pom.xml 2008-11-17 04:10:06 UTC (rev 11834)
@@ -27,7 +27,7 @@
<dependency>
<groupId>org.fedorahosted.tennera</groupId>
<artifactId>ant-gettext</artifactId>
- <version>0.1</version>
+ <version>0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
@@ -40,5 +40,10 @@
<artifactId>andariel</artifactId>
<version>1.2.3</version>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.5.6</version>
+ </dependency>
</dependencies>
</project>