[jbosstools-commits] JBoss Tools SVN: r13029 - trunk/i18n.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jan 14 01:30:45 EST 2009


Author: sflanigan
Date: 2009-01-14 01:30:44 -0500 (Wed, 14 Jan 2009)
New Revision: 13029

Added:
   trunk/i18n/build.number
   trunk/i18n/content.xsl
Modified:
   trunk/i18n/build.xml
   trunk/i18n/feature.xsl
   trunk/i18n/i18n.properties
   trunk/i18n/pom.xml
   trunk/i18n/prop2potincludes.txt
Log:
POT timestamp header is now copied from filesystem modtime of original properties file.
Added buildnumber to langpack versions.
P2 metadata is modified by xsl to relax dependencies.


Added: trunk/i18n/build.number
===================================================================
--- trunk/i18n/build.number	                        (rev 0)
+++ trunk/i18n/build.number	2009-01-14 06:30:44 UTC (rev 13029)
@@ -0,0 +1,3 @@
+#Build Number for ANT. Do not edit!
+#Wed Jan 14 14:51:01 EST 2009
+build.number=33

Modified: trunk/i18n/build.xml
===================================================================
--- trunk/i18n/build.xml	2009-01-14 06:28:46 UTC (rev 13028)
+++ trunk/i18n/build.xml	2009-01-14 06:30:44 UTC (rev 13029)
@@ -30,7 +30,7 @@
 
 	<!-- Define the Ant-Contrib and Tennera Ant Gettext tasks, using Maven 
 	to resolve dependencies: -->
-	<target name="initTaskDefs" depends="-get-maven-artifact-ant">
+	<target name="-initTaskDefs" depends="-get-maven-artifact-ant">
 		<path id="maven-ant-tasks.classpath" path="${maven-artifact-ant.bootstrap.jar}" />
 		<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />
 
@@ -55,16 +55,17 @@
 		<taskdef name="pot2en" classname="org.fedorahosted.tennera.antgettext.Pot2EnTask" classpathref="dependency.classpath" />
 		<taskdef name="po2prop" classname="org.fedorahosted.tennera.antgettext.Po2PropTask" classpathref="dependency.classpath" />
 		<taskdef name="xpath2pot" classname="org.fedorahosted.tennera.antgettext.XPath2PotTask" classpathref="dependency.classpath" />
+		<taskdef name="verifyprop" classname="org.fedorahosted.tennera.antgettext.VerifyPropTask" classpathref="dependency.classpath" />
 		<typedef name="unbundlemapper" 
 			classname="org.fedorahosted.tennera.antgettext.UnBundleNameMapper" 
 			classpathref="dependency.classpath" /> 
 	</target>
 
 
-	<target name="init" depends="-checkver,initTaskDefs">
+	<target name="-init" depends="-checkver,-initTaskDefs">
 	</target>
 
-	<target name="debug" depends="init">
+	<target name="debug" depends="-init" description="Outputs some debugging information">
 		<echo message="jbt.srcdir=${jbt.srcdir}"/>
 		<!-- get the source compile classpath in a printable form -->
 		<pathconvert pathsep="${line.separator}|   |__ " property="echo.dependency.classpath" refid="dependency.classpath">
@@ -93,7 +94,7 @@
 		<delete dir="${target.dir}" includes="*.tmp" />
 	</target>
 		
-	<target name="prop2pot" depends="init"
+	<target name="prop2pot" depends="-init"
 		description="Extract translation templates (POT) from the JBoss Tools English properties files">
 		<!-- 
 			Paths under jbt.srcdir look like: ${module}/plugins/${plugin}/{src,src/main,jbosscore,...}
@@ -114,7 +115,7 @@
 				jbosscore
 				jbossui
 				resources
-				template-src (but *not* templates)
+				[removed] template-src (but *not* templates)
 				NB Maven conventions would also require:
 				src/main/resources
 			-->			
@@ -137,23 +138,23 @@
 	</target>
 
 	<!-- autogenerated "translations" -->
-	<target name="en" depends="init" description="Generate English PO files from POT files">
+	<target name="en" depends="-init" description="Generate English PO files from POT files">
 		<pot2en srcDir="po" dstDir="target/po" locale="en" />
 	</target>
-	<target name="qps" depends="init" description="Generate Pseudo-translation PO files for qps locale from POT files">
+	<target name="qps" depends="-init" description="Generate Pseudo-translation PO files for qps locale from POT files">
 		<pot2en srcDir="po" dstDir="target/po" locale="qps" pseudo="true" />
 	</target>
 
-	<target name="en_AA" depends="init" description="Generate Pseudo-translation PO files for en_AA locale from POT files">
+	<target name="en_AA" depends="-init" description="Generate Pseudo-translation PO files for en_AA locale from POT files">
 		<pot2en srcDir="po" dstDir="target/po" locale="en_AA" pseudo="true" />
 	</target>
 
-	<target name="msgmerge">
+	<target name="msgmerge" description="Merges updated English text from pot files to po files">
 		<apply executable="msgmerge" failonerror="true" failifexecutionfails="true" dest="po">
 			<arg value="--quiet"/>
 			<arg value="--update"/>
+			<srcfile />
 			<targetfile />
-			<srcfile />
 			
 			<fileset dir="po" includes="**/*.po" />
 <!-- Only for testing:
@@ -165,7 +166,22 @@
 		</apply>
 	</target>
 	
-	<target name="po2prop" depends="init" description="Generate Java properties files from translated PO files">
+	<target name="msgcmp" description="Checks po files against their pot files (eg for missing messages)">
+		<apply executable="msgcmp" failonerror="true" failifexecutionfails="true" dest="po">
+			<srcfile />
+			<targetfile />
+			
+			<fileset dir="po" includes="**/*.po" />
+<!-- Only for testing:
+-->
+			<fileset dir="target/po" includes="**/*.po" />
+			<!-- Turns module/org.jboss.package-org.jboss.Messages/*.po into 
+				 module/org.jboss.package-org.jboss.Messages/org.jboss.Messages.pot -->
+			<mapper type="regexp" from="^(.*[/\\][^-]+-([^/\\]+))[/\\][^/\\]+[.]po$$" to="\1/\2.pot" />
+		</apply>
+	</target>
+	
+	<target name="po2prop" depends="-init" description="Generate Java properties files from translated PO files">
 		<delete dir="${propdir}" />
 		<mkdir dir="${propdir}" />
 		<po2prop srcDir="po" dstDir="${propdir}" failonnull="true">
@@ -222,9 +238,15 @@
       </sequential>
     </macrodef>
 	
+	<target name="-buildnum" description="updates the build number" unless="build.number">
+		<buildnumber file="build.number"/>
+	</target>
+	
+	<target name="metadata" depends="-init,-buildnum" description="Generate fragment/feature manifests and jars for langpack plugins, and site.xml">
+		<property name="PLUGIN_VERSION" value="${BASE_VERSION}.${build.number}"/>
+		<property name="FEATURE_VERSION" value="${PLUGIN_VERSION}"/>
 	<!-- Processes the generated props directory, one plugin at a time, 
 		 generating manifests and jars -->
-	<target name="plugins" depends="init" description="Generate fragment manifests and jars for langpack plugins">
 		<delete dir="${jardir}/plugins" />
 		<mkdir dir="${jardir}/plugins" />
 		<!-- for each plugin directory -->
@@ -257,38 +279,8 @@
 				<foreachlocale task="-plugin"/>
 			</sequential>
 		</for>
-	</target>
-	
-	<target name="-plugin" >
-		<!-- Jars up one fragment plugin.   -->
-		<jar 
-			destfile="${jardir}/plugins/${plugin}.nl-${locale}_${PLUGIN_VERSION}.jar" 
-			filesonly="true"
-			update="false" 
-			whenmanifestonly="create"
-			duplicate="fail">
-			<fileset dir="${plugindir}" includes="**/*_${locale}.properties" erroronmissingdir="false"/>
-			<manifest>
-				<attribute name="Manifest-Version" 
-					value="1.0"/>
-				<attribute name="Created-By" 
-					value="JBoss Tools i18n (build.xml)"/>
-				<attribute name="Bundle-Name" 
-					value="${plugin} ${localename} NLS Support"/>
-				<attribute name="Bundle-SymbolicName" 
-					value="${plugin}.nl-${locale} ;singleton=true"/>
-				<attribute name="Bundle-Version" 
-					value="${PLUGIN_VERSION}"/>
-				<attribute name="Bundle-Vendor" 
-					value="${PLUGIN_VENDOR}"/>
-				<attribute name="Fragment-Host" 
-					value="${plugin}"/>
-			</manifest>
-		</jar>
-	</target>
 
-	<target name="features" depends="init" 
-		description="Generate langpack feature manifests (one per locale) for each JBT feature, and corresponding site.xml">
+		<!-- Generate langpack feature manifests (one per locale) for each JBT feature -->
 		<delete dir="${propdir}/features" />
 		<mkdir dir="${propdir}/features" />
 		<delete dir="${jardir}/features" />
@@ -324,6 +316,8 @@
 			</sequential>
 		</for>
 
+		<!-- Generate site.xml -->
+
 		<foreachlocale task="-categorydef"/>
 		
 		<!-- Shouldn't need this, just being safe: -->
@@ -342,6 +336,38 @@
 		</copy>
 	</target>
 	
+	<target name="-plugin" >
+		<!-- Jars up one fragment plugin.   -->
+		<jar 
+			destfile="${jardir}/plugins/${plugin}.nl-${locale}_${PLUGIN_VERSION}.jar" 
+			filesonly="true"
+			update="false" 
+			whenmanifestonly="skip"
+			duplicate="fail">
+			<fileset dir="${plugindir}" includes="**/*_${locale}.properties" erroronmissingdir="false"/>
+			<manifest>
+				<attribute name="Manifest-Version" 
+					value="1.0"/>
+				<attribute name="Created-By" 
+					value="JBoss Tools i18n (build.xml)"/>
+				<attribute name="Bundle-Name" 
+					value="${plugin} ${localename} NLS Support"/>
+				<attribute name="Bundle-SymbolicName" 
+					value="${plugin}.nl-${locale} ;singleton=true"/>
+				<attribute name="Bundle-Version" 
+					value="${PLUGIN_VERSION}"/>
+				<attribute name="Bundle-Vendor" 
+					value="${PLUGIN_VENDOR}"/>
+				<attribute name="Fragment-Host" 
+					value="${plugin}"/>
+<!--
+				<attribute name="Require-Bundle" 
+					value="${plugin};resolution:=optional"/>
+-->
+			</manifest>
+		</jar>
+	</target>
+	
 	<!-- Create feature jar including manifest.  Also create a <feature> for site.xml -->
 	<target name="-feature">
 		<!-- create langpack <feature> to go into site.xml -->
@@ -352,6 +378,13 @@
 				version="${FEATURE_VERSION}">
 				<category name="${locale}"/>
 			</feature>]]></echo>
+<!--
+		<echo append="true" file="${temp.file.metafeature}"><![CDATA[
+			   <includes
+			         id="${feature}.nl-${locale}"
+			         version="${FEATURE_VERSION}"
+			         optional="true"/>]]></echo>
+-->
 		<!-- Process feature.xml with <xslt> -->		
 		<xslt 
 			style="feature.xsl"
@@ -372,8 +405,8 @@
 		<jar destfile="${jardir}/features/${feature}.nl-${locale}_${PLUGIN_VERSION}.jar" 
 			basedir="${propdir}/features/${feature}.nl-${locale}_${PLUGIN_VERSION}" />
 		<!-- might want to keep around for debugging: 
+		<delete dir="${propdir}/features/${feature}.nl-${locale}_${PLUGIN_VERSION}" />
 		-->
-		<delete dir="${propdir}/features/${feature}.nl-${locale}_${PLUGIN_VERSION}" />
 	</target>
 	
 	<!-- Create a <category-def> for ${locale} to go into site.xml -->
@@ -384,7 +417,27 @@
 		   		label="JBoss Tools Localization (${localename})"/>]]></echo>
 	</target>
 	
-	<target name="p2" description="Generate metadata for Eclipse 3.4's update manager (P2)" >
+	<!-- prototype: work in progress -->
+	<target name="-metafeature" description="Generates a feature which contains all langpack features for a locale">
+		<copy overwrite="true" 
+			todir="${propdir}/features/org.jboss.tools.nls-${locale}_${PLUGIN_VERSION}">
+			<fileset dir="metafeature" />
+			<filterchain>
+				<expandproperties/>
+			</filterchain>
+		</copy>
+		<jar destfile="${jardir}/features/org.jboss.tools.nls-${locale}_${PLUGIN_VERSION}.jar" 
+			basedir="${propdir}/features/org.jboss.tools.nls-${locale}_${PLUGIN_VERSION}" />
+		<!-- might want to keep around for debugging: 
+		<delete dir="${propdir}/features/org.jboss.tools.nls-${locale}_${PLUGIN_VERSION}" />
+		-->
+	</target>
+	
+	<target name="deletep2" description="Remove p2 metadata (revert to site.xml)">
+		<delete dir="${jardir}" includes="content.jar,content.xml,content_orig.xml,artifacts.jar,artifacts.xml"/>
+	</target>
+	
+	<target name="p2" depends="deletep2" description="Generate metadata for Eclipse 3.4's update manager (P2)" >
 		<!-- Generate P2 metadata so that update manager won't take forever.
 			http://wiki.eclipse.org/Equinox_p2_Metadata_Generator
 		 -->
@@ -404,8 +457,6 @@
 			<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" />
@@ -414,16 +465,57 @@
 			<arg value="-vmargs" />
 			<arg value="-Xmx256m" />
 		</exec>
+		<move file="${jardir}/content.xml" tofile="${jardir}/content_orig.xml" />
+		<!-- Process content.xml with <xslt> -->		
+		<xslt 
+			style="content.xsl"
+			in="${jardir}/content_orig.xml" 
+			out="${jardir}/content.xml" 
+		/>
+		<jar basedir="${jardir}" includes="content.xml" destfile="${jardir}/content.jar"/>
+		<jar basedir="${jardir}" includes="artifacts.xml" destfile="${jardir}/artifacts.jar"/>
+		<delete dir="${jardir}" includes="content.xml,content_orig.xml,artifacts.xml"/>
 	</target>
 	
-	<target name="po" depends="en, qps, en_AA"/>
+	<target name="check" depends="-init" description="Checks langpacks for completeness">
+		<foreachlocale task="-check"/>
+	</target>
 	
-	<target name="most" depends="clean, prop2pot, po, po2prop, plugins, features" 
+	<target name="-check" description="Check langpacks for completeness for one locale">
+		<verifyprop
+			dir1="${jbt.srcdir}"
+			dir2="target/prop"
+			failOnNull="true"
+			includesfile="prop2potincludes.txt"
+			keysOnly="true"
+		>
+			<chainedmapper>
+				<!-- from/to params are defined in i18n.properties -->
+				<regexpmapper 
+					handledirsep="true" 
+					from="${prop2pot_regex_from}" 
+					to="${verifyprop_regex_to}" />
+				<globmapper from="*.properties" to="*_${locale}.properties"/>
+			</chainedmapper>
+		</verifyprop>
+	</target>
+	
+	<target name="po" depends="en, qps, en_AA" description="Generates po files for all pseudolocales">
+		<!-- Instead of hard-coding locale ids, get them from i18n.properties and iterate -->
+	</target>
+	
+	<target name="most" depends="clean, prop2pot, po, po2prop, metadata" 
 		description="Generates langpacks and metadata" /> 
 
-	<target name="all" depends="clean, prop2pot, po, po2prop, plugins, features, p2" 
+	<target name="all" depends="clean, prop2pot, po, po2prop, metadata, p2" 
 		description="Runs all targets in an appropriate order"/>
 
+    <target name="reall" 
+        description="Runs all targets in an appropriate order, reusing previous buildnum">
+    	<loadproperties srcfile="build.number" />
+    	<antcall target="all" />
+    </target>
+
 	
 	<!-- Test for a class from Ant 1.7.1 (needed for the jar task's erroronmissingdir feature --> 
 	<available property="Ant-1.7.1-or-later"

Added: trunk/i18n/content.xsl
===================================================================
--- trunk/i18n/content.xsl	                        (rev 0)
+++ trunk/i18n/content.xsl	2009-01-14 06:30:44 UTC (rev 13029)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+	<xsl:output indent="yes" />
+	
+	<!-- Copy all elements with their attributes -->
+	<xsl:template match="@*|node()">
+  		<xsl:copy>
+    		<xsl:apply-templates select="@*|node()"/>
+  		</xsl:copy>
+	</xsl:template>
+
+	<!-- Copy <required> elements belonging to nl feature groups, adding "optional" attribute -->
+	<xsl:template match="unit[contains(@id,'.nl') and contains(@id,'.feature.group')]/requires/required[not(contains(@name,'.feature.jar'))]">
+		<xsl:copy>
+			<xsl:copy-of select="@*"/>
+			<xsl:attribute name="optional">true</xsl:attribute>
+			<xsl:apply-templates/>
+		</xsl:copy>
+	</xsl:template>
+
+	<!-- Copy <required> elements belonging to nl plugins, adding "greedy" attribute -->
+	<xsl:template match="unit[contains(@id,'.nl') and not(contains(@id,'.feature.group'))]/requires/required">
+		<xsl:copy>
+			<xsl:copy-of select="@*"/>
+			<xsl:attribute name="greedy">false</xsl:attribute>
+			<xsl:apply-templates/>
+		</xsl:copy>
+	</xsl:template>
+
+</xsl:stylesheet>

Modified: trunk/i18n/feature.xsl
===================================================================
--- trunk/i18n/feature.xsl	2009-01-14 06:28:46 UTC (rev 13028)
+++ trunk/i18n/feature.xsl	2009-01-14 06:30:44 UTC (rev 13029)
@@ -1,13 +1,17 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <xsl:stylesheet
   version="1.0"
+  xmlns:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:file="java.io.File"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
+	<xsl:output indent="yes" />
     <xsl:param name="feature">FEATURE</xsl:param>
     <xsl:param name="locale">LOCALE</xsl:param>
     <xsl:param name="localename">LOCALE_NAME</xsl:param>
     <xsl:param name="featureversion">FEATURE_VERSION</xsl:param>
     <xsl:param name="pluginversion">PLUGIN_VERSION</xsl:param>
+    <xsl:param name="jardir">target/jars/plugins</xsl:param>
 
 	<xsl:template match="/feature">
 		<feature provider-name="%providerName">
@@ -20,11 +24,18 @@
 			names (since they shouldn't be translated anyway) or use @id 
 			here, not @label.
 			 -->
-			<xsl:attribute name="label">JBoss Tools Language Pack for <xsl:value-of select="@label" /> in <xsl:value-of select="$localename" />
+			<xsl:attribute name="label">Language Pack for <xsl:value-of select="@label" /> in <xsl:value-of select="$localename" />
 			</xsl:attribute>
 			<xsl:attribute name="version">
 				<xsl:value-of select="$featureversion" />
 			</xsl:attribute>
+<!-- 
+			<xsl:if test="@plugin">
+				<xsl:attribute name="plugin">
+					<xsl:value-of select="@plugin" />
+				</xsl:attribute>
+			</xsl:if>
+ -->			
 			<copyright>
 				%copyright
 			</copyright>
@@ -430,27 +441,45 @@
 		HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 
 		END OF TERMS AND CONDITIONS
 			</license>
-			<description>JBoss Tools Language Pack for <xsl:value-of select="$feature" /> in <xsl:value-of select="$localename" /></description>
+			<description>Language Pack for <xsl:value-of select="$feature" /> in <xsl:value-of select="$localename" /></description>
 			<url>
 				<update label="JBossTools Update Site" url="http://download.jboss.org/jbosstools/updates/stable"/>
 				<discovery label="JBossTools Development Update Site" url="http://download.jboss.org/updates/development"/>
 			</url>
+<!-- 
 			<requires>
-				<import>
+				<import version="0.0.0" match="greaterOrEqual">
 					<xsl:attribute name="feature">
 						<xsl:value-of select="$feature" />
 					</xsl:attribute>
 				</import>
 			</requires>
+		   <includes search-location="self">
+				<xsl:attribute name="id">
+					<xsl:value-of select="$feature" />
+				</xsl:attribute>
+				<xsl:attribute name="version">
+					<xsl:value-of select="@version" />
+				</xsl:attribute>
+		   </includes>
+ -->
+			
 			<xsl:for-each select="plugin">
-				<plugin fragment="true" unpack="false">
-					<xsl:attribute name="id">
-						<xsl:value-of select="@id" />.nl-<xsl:value-of select="$locale" />
-					</xsl:attribute>
-					<xsl:attribute name="version">
-						<xsl:value-of select="$pluginversion" />
-					</xsl:attribute>
-				</plugin>
+<!-- 
+ 				<xsl:copy-of select="." />
+ -->
+ 				<xsl:variable name="jarname" 
+ 					select="concat($jardir,'/', @id, '.nl-', $locale, '_', $pluginversion, '.jar')" />
+				<xsl:if test="file:exists(file:new($jarname))">
+					<plugin fragment="true" unpack="false">
+						<xsl:attribute name="id">
+							<xsl:value-of select="@id" />.nl-<xsl:value-of select="$locale" />
+						</xsl:attribute>
+						<xsl:attribute name="version">
+							<xsl:value-of select="$pluginversion" />
+						</xsl:attribute>
+					</plugin>
+				</xsl:if>
 			</xsl:for-each>
 		</feature>
 	</xsl:template>

Modified: trunk/i18n/i18n.properties
===================================================================
--- trunk/i18n/i18n.properties	2009-01-14 06:28:46 UTC (rev 13028)
+++ trunk/i18n/i18n.properties	2009-01-14 06:30:44 UTC (rev 13029)
@@ -7,10 +7,9 @@
 
 prop2pot_regex_from=^([^/]+)/plugins/([^/]+)/(?:src/main/resources/|src/main/|[^/]+/|)(.*)[.]properties$$
 prop2pot_regex_to=\\1~\\2-\\3~\\3.pot
+verifyprop_regex_to=\\1/\\2/\\3.properties
 
-BUILD_NUMBER=0
-PLUGIN_VERSION=0.1.${BUILD_NUMBER}
-FEATURE_VERSION=${PLUGIN_VERSION}
+BASE_VERSION=0.1
 PLUGIN_VENDOR=JBoss
 
 NAME_en=English

Modified: trunk/i18n/pom.xml
===================================================================
--- trunk/i18n/pom.xml	2009-01-14 06:28:46 UTC (rev 13028)
+++ trunk/i18n/pom.xml	2009-01-14 06:30:44 UTC (rev 13029)
@@ -27,7 +27,7 @@
         <dependency>
             <groupId>org.fedorahosted.tennera</groupId>
             <artifactId>ant-gettext</artifactId>
-            <version>0.2-SNAPSHOT</version>
+            <version>0.4</version>
         </dependency>
         <dependency>
             <groupId>ant-contrib</groupId>

Modified: trunk/i18n/prop2potincludes.txt
===================================================================
--- trunk/i18n/prop2potincludes.txt	2009-01-14 06:28:46 UTC (rev 13028)
+++ trunk/i18n/prop2potincludes.txt	2009-01-14 06:30:44 UTC (rev 13029)
@@ -3,4 +3,3 @@
 */plugins/*/jbosscore/**/*.properties
 */plugins/*/jbossui/**/*.properties
 */plugins/*/resources/**/*.properties
-*/plugins/*/template-src/**/*.properties




More information about the jbosstools-commits mailing list