[Yanel-commits] rev 47050 - public/yanel/trunk/src/build

michi at wyona.com michi at wyona.com
Thu Jan 14 12:04:47 CET 2010


Author: michi
Date: 2010-01-14 12:04:46 +0100 (Thu, 14 Jan 2010)
New Revision: 47050

Modified:
   public/yanel/trunk/src/build/yanel2realms.xsl
Log:
check if config/src ends with .xml

Modified: public/yanel/trunk/src/build/yanel2realms.xsl
===================================================================
--- public/yanel/trunk/src/build/yanel2realms.xsl	2010-01-14 10:33:34 UTC (rev 47049)
+++ public/yanel/trunk/src/build/yanel2realms.xsl	2010-01-14 11:04:46 UTC (rev 47050)
@@ -23,35 +23,23 @@
   </target>
 
   <target name="build-realms" description="Build realms" depends="init">
+
 <xsl:for-each select="/yanel:realms/yanel:realm">
+    <xsl:variable name="realmPath"><xsl:call-template name="get-realm-path"><xsl:with-param name="path"><xsl:value-of select="yanel:config/@src"/></xsl:with-param></xsl:call-template></xsl:variable>
+
     <condition property="ant-file-of-realm-with-id-{@id}-exists">
-      <available file="{yanel:config/@src}/build.xml"/>
+      <available file="{$realmPath}/build.xml"/>
     </condition>
     <antcall target="build-realm-with-id-{@id}"/>
-
-<!--
-      <xsl:choose>
-        <xsl:when test="starts-with(yanel:config/@src, '/') or string-length(substring-before(yanel:config/@src, ':/'))='1'">
-    <ant inheritAll="false" antfile="{yanel:config/@src}/build.xml" target="compile">
-      <property name="yanel.source.version" value="{$yanel.source.version}"/>
-      <property name="maven.url" value="{$maven.url}"/>
-    </ant>
-        </xsl:when>
-        <xsl:otherwise>
-    <ant inheritAll="false" antfile="${{build.dir}}/{yanel:config/@src}/build.xml" target="compile">
-      <property name="yanel.source.version" value="{$yanel.source.version}"/>
-      <property name="maven.url" value="{$maven.url}"/>
-    </ant>
-        </xsl:otherwise>
-      </xsl:choose>
--->
 </xsl:for-each>
   </target>
 
 <xsl:for-each select="/yanel:realms/yanel:realm">
+    <xsl:variable name="realmPath"><xsl:call-template name="get-realm-path"><xsl:with-param name="path"><xsl:value-of select="yanel:config/@src"/></xsl:with-param></xsl:call-template></xsl:variable>
+
   <target name="build-realm-with-id-{@id}" if="ant-file-of-realm-with-id-{@id}-exists">
     <echo>Build realm with id "<xsl:value-of select="@id"/>"</echo>
-    <ant inheritAll="false" antfile="{yanel:config/@src}/build.xml" target="compile">
+    <ant inheritAll="false" antfile="{$realmPath}/build.xml" target="compile">
       <property name="yanel.source.version" value="{$yanel.source.version}"/>
       <property name="yanel.source.home" value="{$yanel.source.home}"/>
       <property name="maven.url" value="{$maven.url}"/>
@@ -61,49 +49,61 @@
 
   <target name="deploy-realms" description="Deploy libs of realms" depends="init">
 <xsl:for-each select="/yanel:realms/yanel:realm">
+    <xsl:variable name="realmPath"><xsl:call-template name="get-realm-path"><xsl:with-param name="path"><xsl:value-of select="yanel:config/@src"/></xsl:with-param></xsl:call-template></xsl:variable>
+
     <condition property="lib-dir-of-realm-with-id-{@id}-exists">
-      <available file="{yanel:config/@src}/build/lib" type="dir"/>
+      <available file="{$realmPath}/build/lib" type="dir"/>
     </condition>
     <antcall target="deploy-realm-with-id-{@id}"/>
 </xsl:for-each>
   </target>
 
 <xsl:for-each select="/yanel:realms/yanel:realm">
+    <xsl:variable name="realmPath"><xsl:call-template name="get-realm-path"><xsl:with-param name="path"><xsl:value-of select="yanel:config/@src"/></xsl:with-param></xsl:call-template></xsl:variable>
+
   <target name="deploy-realm-with-id-{@id}" description="Deploy libs of realm {@id}" depends="init" if="lib-dir-of-realm-with-id-{@id}-exists">
     <copy todir="${{build.dir}}/webapps/{$servlet.context.prefix}/WEB-INF/lib">
-      <fileset dir="{yanel:config/@src}/build/lib"/>
+      <fileset dir="{$realmPath}/build/lib"/>
     </copy>
   </target>
 </xsl:for-each>
 
   <target name="clean-realms" description="Clean realms" depends="init">
 <xsl:for-each select="/yanel:realms/yanel:realm">
+    <xsl:variable name="realmPath"><xsl:call-template name="get-realm-path"><xsl:with-param name="path"><xsl:value-of select="yanel:config/@src"/></xsl:with-param></xsl:call-template></xsl:variable>
+
     <condition property="build-dir-of-realm-with-id-{@id}-exists">
-      <available file="{yanel:config/@src}/build" type="dir"/>
+      <available file="{$realmPath}/build" type="dir"/>
     </condition>
     <antcall target="clean-realm-with-id-{@id}"/>
 </xsl:for-each>
   </target>
 
 <xsl:for-each select="/yanel:realms/yanel:realm">
+    <xsl:variable name="realmPath"><xsl:call-template name="get-realm-path"><xsl:with-param name="path"><xsl:value-of select="yanel:config/@src"/></xsl:with-param></xsl:call-template></xsl:variable>
+
   <target name="clean-realm-with-id-{@id}" description="Clean realm {@id}" depends="init" if="build-dir-of-realm-with-id-{@id}-exists">
-    <delete dir="{yanel:config/@src}/build"/>
+    <delete dir="{$realmPath}/build"/>
   </target>
 </xsl:for-each>
 
 <xsl:comment>Copy dependencies of realms</xsl:comment>
   <target name="copy-dependencies" description="Copy dependencies of realms" depends="init">
 <xsl:for-each select="/yanel:realms/yanel:realm">
+    <xsl:variable name="realmPath"><xsl:call-template name="get-realm-path"><xsl:with-param name="path"><xsl:value-of select="yanel:config/@src"/></xsl:with-param></xsl:call-template></xsl:variable>
+
     <condition property="build-dir-of-realm-with-id-{@id}-exists">
-      <available file="{yanel:config/@src}/build" type="dir"/>
+      <available file="{$realmPath}/build" type="dir"/>
     </condition>
     <antcall target="copy-dependencies-of-realm-with-id-{@id}"/>
 </xsl:for-each>
   </target>
 
 <xsl:for-each select="/yanel:realms/yanel:realm">
+    <xsl:variable name="realmPath"><xsl:call-template name="get-realm-path"><xsl:with-param name="path"><xsl:value-of select="yanel:config/@src"/></xsl:with-param></xsl:call-template></xsl:variable>
+
 <target name="copy-dependencies-of-realm-with-id-{@id}" description="Copy dependencies of realm {@id}" depends="init" if="build-dir-of-realm-with-id-{@id}-exists">
-    <ant inheritAll="false" antfile="{yanel:config/@src}/build.xml" target="copy-dependencies">
+    <ant inheritAll="false" antfile="{$realmPath}/build.xml" target="copy-dependencies">
       <property name="build.dir" value="${{build.dir}}"/>
       <property name="servlet.context.prefix" value="{$servlet.context.prefix}"/>
       <property name="yanel.source.version" value="{$yanel.source.version}"/>
@@ -112,9 +112,10 @@
     </ant>
 </target>
 </xsl:for-each>
-
 </project>
-
 </xsl:template>
 
+<!-- INFO: Check if src ends-with xml -->
+<xsl:template name="get-realm-path"><xsl:param name="path"/><xsl:choose><xsl:when test="substring($path, string-length($path) - 2) = 'xml'">TODO-SUBSTRING-BEFORE-LAST-INDEX</xsl:when><xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise></xsl:choose></xsl:template>
+
 </xsl:stylesheet>



More information about the Yanel-commits mailing list