ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | byline-commits List | September 2004 Index

<--  Date Index  --> <--  Thread Index  -->

r28 - tools/devel/trunk/xsl


Author: dgregoro
Date: 2004-09-23 19:35:53 +0200 (Thu, 23 Sep 2004)
New Revision: 28

Modified:
   tools/devel/trunk/xsl/build-template.xsl
   tools/devel/trunk/xsl/classpath-template.xsl
   tools/devel/trunk/xsl/combine.xsl
Log:
ALERT: significant changes to ccm-devel stylesheets

* ccm:requires is now a shortcut for ccm:buildRequires and
  ccm:runRequires.  So, any application listed in ccm:buildRequires or
  ccm:requires will be used for building (i.e. ant build). Also, any
  application listed in ccm:runRequires or ccm:requires will be used for
  running (e.g. ant runtests; ccm-start).

* The distinction between "external" dependencies (e.g. log4j) and
  "prebuilt" applications (e.g. ccm-core) has been removed.  Now, any
  dependency that is not satisfied by an application in the project is
  considered to be an external dependency.  For all external
  dependecies, the build system will include -pdl.jar, -sql.jar,
  and -system.jar files in addition to webapp directories where applicable.

* All external dependencies will result in a message during ccm-configure.
  This is to inform the user of the external dependencies of the project.
  Since ccm-configure does not check the filesystem for the presence of
  external dependencies, this task falls upon the developer.

* It is assumed that all external dependencies are provides by JARs
  named $name.jar or $name-$version.jar in /usr/share/java.  In the
  future, support should be added for specifying alternative locations
  and/or filenames for each dependency.



Modified: tools/devel/trunk/xsl/build-template.xsl
===================================================================
--- tools/devel/trunk/xsl/build-template.xsl    2004-09-23 15:52:10 UTC (rev 
27)
+++ tools/devel/trunk/xsl/build-template.xsl    2004-09-23 17:35:53 UTC (rev 
28)
@@ -12,6 +12,11 @@
     indent="yes"
     xalan:indent-amount="4"/>
 
+  <xsl:key name="key-rundependency" 
match="ccm:dependencies/ccm:requires/@name |
+                                           
ccm:dependencies/ccm:runRequires/@name" use="."/>
+  <xsl:key name="key-builddependency" 
match="ccm:dependencies/ccm:requires/@name |
+                                             
ccm:dependencies/ccm:buildRequires/@name" use="."/>
+
   <xsl:template match="ccm:project">
     <xsl:call-template name="CheckDependencies"/>
     <project name="CCM" default="usage" basedir=".">
@@ -152,15 +157,22 @@
   <xsl:template name="CheckDependencies">
     <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
       <xsl:variable name="appname" select="@name"/>
-      <xsl:variable name="appfullname" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application/@name"/>
-      <xsl:for-each 
select="/ccm:project/ccm:application[@name=$appfullname]/ccm:dependencies/ccm:requires">
+      <xsl:variable name="appfullname" 
select="/ccm:project/ccm:appxmls[@name=$appname]/ccm:application/@name"/>
+      <xsl:for-each 
select="/ccm:project/ccm:appxmls/ccm:application[@name=$appfullname]/ccm:dependencies/ccm:requires">
         <xsl:variable name="name" select="@name"/>
         <xsl:variable name="version" select="@version"/>
         <xsl:variable name="relation" select="@relation"/>
-        <xsl:if test="count(/ccm:project/ccm:prebuilt/ccm:application[@name 
= $name]) + count(/ccm:project/ccm:application[@name = $name]) &lt; 1">
-          <xsl:message terminate="yes"><xsl:value-of 
select="concat($appname,' depends on ',$name,'-',$version)"/></xsl:message>
+        <xsl:if test="count(/ccm:project/ccm:appxmls/ccm:application[@name = 
$name]) &lt; 1">
+          <xsl:choose>
+            <xsl:when test="$version">
+              <xsl:message terminate="no"><xsl:value-of 
select="concat($appname,' depends on ',$name,'-',$version)"/></xsl:message>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="no"><xsl:value-of 
select="concat($appname,' depends on ',$name)"/></xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
         </xsl:if>
-        <xsl:if test="count(/ccm:project/ccm:prebuilt/ccm:application[@name 
= $name]) + count(/ccm:project/ccm:application[@name = $name]) > 1">
+        <xsl:if test="count(/ccm:project/ccm:appxmls/ccm:application[@name = 
$name]) > 1">
           <xsl:message terminate="yes"><xsl:value-of 
select="concat('multiple applications provide ',$name)"/></xsl:message>
         </xsl:if>
       </xsl:for-each>
@@ -168,58 +180,45 @@
   </xsl:template>
 
   <xsl:template name="AppProperties">
-    <xsl:for-each select="/ccm:project/ccm:prebuilt/ccm:application">
-      <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="location" select="@location"/>
-      <xsl:variable name="version" select="@version"/>
-      <xsl:choose>
-        <xsl:when test="$location">
-          <property value="{$location}" name="apps.{$name}.location"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <property value="${{shared.lib.dist.dir}}" 
name="apps.{$name}.location"/>
-        </xsl:otherwise>
-      </xsl:choose>
-      <path id="{$name}.build.classpath">
-        <fileset dir="${{apps.{$name}.location}}/">
-          <include name="{$name}-{$version}/**"/>
-          <include name="{$name}-{$version}.jar"/>
-        </fileset>
-      </path>
-      <path id="{$name}.run.classpath">
-        <path refid="{$name}.build.classpath"/>
-      </path>
-      <path id="{$name}.tests.classpath">
-        <path refid="{$name}.build.classpath"/>
-        <fileset dir="${{apps.{$name}.location}}/">
-          <include name="{$name}-{$version}-tests.jar"/>
-        </fileset>
-      </path>
-    </xsl:for-each>
     <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
       <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="app" 
select="document(concat($name,'/application.xml'),/ccm:project)/ccm:application"/>
+      <xsl:variable name="app" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
       <xsl:variable name="appname" select="$app/@name"/>
       <xsl:variable name="appprettyname" select="$app/@prettyName"/>
       <xsl:variable name="appversion" select="$app/@version"/>
       <xsl:variable name="appwebapp" select="$app/@webapp"/>
-      <xsl:variable name="requires" 
select="/ccm:project/ccm:application[@name=$appname]/ccm:dependencies/ccm:requires"/>
-      <path id="apps.{$name}.pdl.path">
-        <pathelement location="{$name}/${{pdl.dir}}"/>
-        <path refid="apps.{$name}.pdl.path.internal"/>
-      </path>
-      <path id="apps.{$name}.pdl.path.internal">
-        <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
-          <xsl:variable name="name" select="@name"/>
-          <xsl:variable name="fullname" 
select="document(concat($name,'/application.xml'),/ccm:project)/ccm:application/@name"/>
-          <xsl:for-each 
select="/ccm:project/ccm:application[@name=$appname]/ccm:dependencies/ccm:requires">
-            <xsl:variable name="requiredname" select="@name"/>
-            <xsl:if test="$requiredname = $fullname">
-              <path refid="apps.{$name}.pdl.path"/>
-            </xsl:if>
+      <xsl:variable name="haspdldir" 
select="$app/ccm:directories/ccm:directory[@name='pdl'] or 
not($app/ccm:directories)"/>
+      <xsl:variable name="requires" 
select="$app/ccm:dependencies/ccm:requires"/>
+      <xsl:variable name="buildrequires" 
select="$app/ccm:dependencies/ccm:buildRequires"/>
+      <xsl:variable name="runrequires" 
select="$app/ccm:dependencies/ccm:runRequires"/>
+      <xsl:if test="$haspdldir">
+        <path id="apps.{$name}.pdl.path">
+          <pathelement location="{$name}/${{pdl.dir}}"/>
+          <path refid="apps.{$name}.pdl.path.internal"/>
+        </path>
+        <path id="apps.{$name}.pdl.path.internal">
+          <xsl:for-each select="$buildrequires | $requires | $runrequires">
+            <xsl:variable name="req_name" select="@name"/>
+            <xsl:variable name="req_version" select="@version"/>
+            <xsl:choose>
+              <xsl:when 
test="/ccm:project/ccm:appxmls/ccm:application[@name=$req_name]">
+                <xsl:variable name="dep_name" 
select="/ccm:project/ccm:appxmls[ccm:application/@name=$req_name]/@name"/>
+                <path refid="apps.{$dep_name}.pdl.path"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:choose>
+                  <xsl:when test="$req_version">
+                    <pathelement 
location="${{ccm.config.lib.dir}}/{$req_name}-{$req_version}-pdl.jar"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <pathelement 
location="${{ccm.config.lib.dir}}/{$req_name}-pdl.jar"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:otherwise>
+            </xsl:choose>
           </xsl:for-each>
-        </xsl:for-each>
-      </path>
+        </path>
+      </xsl:if>
       <property value="{$appname}" name="apps.{$name}.name"/>
       <property value="{$appprettyname}" name="apps.{$name}.prettyname"/>
       <property value="{$appversion}" name="apps.{$name}.version"/>
@@ -234,19 +233,29 @@
       <xsl:call-template name="AppPropertyClassPath">
         <xsl:with-param name="target" select="@name"/>
         <xsl:with-param name="type">run</xsl:with-param>
-        <xsl:with-param name="requires" select="$requires"/>
+        <xsl:with-param name="requires" select="$requires | $runrequires"/>
       </xsl:call-template>
       <xsl:call-template name="AppPropertyClassPath">
         <xsl:with-param name="target" select="@name"/>
         <xsl:with-param name="type">build</xsl:with-param>
-        <xsl:with-param name="requires" select="$requires"/>
+        <xsl:with-param name="requires" select="$requires | $buildrequires"/>
       </xsl:call-template>
       <xsl:call-template name="AppPropertyClassPath">
         <xsl:with-param name="target" select="@name"/>
         <xsl:with-param name="type">tests</xsl:with-param>
-        <xsl:with-param name="requires" select="$requires"/>
+        <xsl:with-param name="requires" select="$requires | $runrequires"/>
       </xsl:call-template>
     </xsl:for-each>
+    <path id="apps.pdl.path.all">
+      <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
+        <xsl:variable name="name" select="@name"/>
+        <xsl:variable name="app" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
+        <xsl:variable name="haspdldir" 
select="$app/ccm:directories/ccm:directory[@name='pdl'] or 
not($app/ccm:directories)"/>
+        <xsl:if test="$haspdldir">
+          <path refid="apps.{$name}.pdl.path"/>
+        </xsl:if>
+      </xsl:for-each>
+    </path>
     <xsl:call-template name="AppPropertyClassPath">
       <xsl:with-param name="target">server</xsl:with-param>
       <xsl:with-param name="type">build</xsl:with-param>
@@ -266,15 +275,35 @@
     <xsl:param name="type"/>
     <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
       <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="fullname" 
select="document(concat($name,'/application.xml'),/ccm:project)/ccm:application/@name"/>
+      <xsl:variable name="fullname" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application/@name"/>
       <xsl:for-each select="$requires">
         <xsl:variable name="requiredname" select="@name"/>
         <xsl:if test="$requiredname = $fullname">
+          <xsl:variable name="req_app" 
select="/ccm:project/ccm:appxmls/ccm:application[@name=$requiredname]"/>
+          <xsl:variable name="ccmrequires" 
select="$req_app/ccm:dependencies/ccm:requires"/>
+          <xsl:variable name="buildrequires" 
select="$req_app/ccm:dependencies/ccm:buildRequires"/>
+          <xsl:variable name="runrequires" 
select="$req_app/ccm:dependencies/ccm:runRequires"/>
           <path refid="{$name}.{$type}.classpath.internal"/>
-          <xsl:call-template name="AppPropertyClassPath_Requires">
-            <xsl:with-param name="requires" 
select="/ccm:project/ccm:application[@name=$requiredname]/ccm:dependencies/ccm:requires"/>
-            <xsl:with-param name="type" select="$type"/>
-          </xsl:call-template>
+          <xsl:choose>
+            <xsl:when test="$type = 'build'">
+              <xsl:call-template name="AppPropertyClassPath_Requires">
+                <xsl:with-param name="type" select="$type"/>
+                <xsl:with-param name="requires" select="$ccmrequires | 
$buildrequires"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="$type = 'run'">
+              <xsl:call-template name="AppPropertyClassPath_Requires">
+                <xsl:with-param name="type" select="$type"/>
+                <xsl:with-param name="requires" select="$ccmrequires | 
$runrequires"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="$type = 'tests'">
+              <xsl:call-template name="AppPropertyClassPath_Requires">
+                <xsl:with-param name="type" select="$type"/>
+                <xsl:with-param name="requires" select="$ccmrequires | 
$runrequires"/>
+              </xsl:call-template>
+            </xsl:when>
+          </xsl:choose>
         </xsl:if>
       </xsl:for-each>
     </xsl:for-each>
@@ -303,10 +332,6 @@
           </xsl:call-template>
         </xsl:otherwise>
       </xsl:choose>
-      <xsl:for-each select="/ccm:project/ccm:prebuilt/ccm:application">
-        <xsl:variable name="name" select="@name"/>
-        <path refid="{$name}.{$type}.classpath"/>
-      </xsl:for-each>
       <path refid="ccm.base.classpath"/>
     </path>
     <xsl:if test="/ccm:project/ccm:build/ccm:application[@name = $target]">
@@ -326,21 +351,26 @@
               <include name="${{etclib.dir}}/*.jar"/>
               <include name="${{etclib.dir}}/*.zip"/>
             </fileset>
-            <xsl:variable name="fullname" 
select="document(concat($target,'/application.xml'),/ccm:project)/ccm:application/@name"/>
-            <xsl:variable name="buildRequires"
-            select="/ccm:project/ccm:application[@name = 
$fullname]/ccm:dependencies/ccm:buildRequires"/>
-            <xsl:if test="count($buildRequires) > 0">
-              <fileset dir="${{ccm.config.lib.dir}}">
-              <xsl:for-each select="$buildRequires">
-                <xsl:variable name="name" select="@name"/>
-                <xsl:variable name="version" select="@version"/>
-                <include name="{$name}.jar"/>
-                <xsl:if test="$version">
-                  <include name="{$name}-{$version}.jar"/>
-                </xsl:if>
-              </xsl:for-each>
-              </fileset>
-            </xsl:if>
+            <xsl:for-each select="$requires">
+              <xsl:variable name="req_name" select="@name"/>
+              <xsl:variable name="req_version" select="@version"/>
+              <xsl:if 
test="count(/ccm:project/ccm:appxmls/ccm:application[@name = $req_name]) = 0">
+                <xsl:choose>
+                  <xsl:when test="$req_version">
+                    <fileset dir="${{ccm.config.lib.dir}}">
+                      <include name="{$req_name}-{$req_version}.jar"/>
+                      <include name="{$req_name}-{$req_version}/**.jar"/>
+                    </fileset>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <fileset dir="${{ccm.config.lib.dir}}">
+                      <include name="{$req_name}.jar"/>
+                      <include name="{$req_name}/**.jar"/>
+                    </fileset>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:if>
+            </xsl:for-each>
             <path refid="{$target}.run.classpath.internal"/>
           </xsl:when>
           <xsl:when test="$type = 'tests'">
@@ -357,7 +387,7 @@
   <xsl:template name="TargetClean">
     <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
       <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+      <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
       <xsl:variable name="buildhooks" select="$application/@buildHooks"/>
       <xsl:variable name="hastestdir" 
select="$application/ccm:directories/ccm:directory[@name='test'] or 
not($application/ccm:directories)"/>
       <target name="clean-{$name}" description="Cleans out the '{$name}' 
build environment and whole deployment directory">
@@ -402,14 +432,16 @@
     <xsl:param name="databases"/>
     <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
       <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+      <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
       <xsl:variable name="fullname" select="$application/@name"/>
       <xsl:variable name="buildhooks" select="$application/@buildHooks"/>
       <xsl:variable name="hassqldir" 
select="$application/ccm:directories/ccm:directory[@name='sql'] or 
not($application/ccm:directories)"/>
       <xsl:variable name="hassrcdir" 
select="$application/ccm:directories/ccm:directory[@name='src'] or 
not($application/ccm:directories)"/>
       <xsl:variable name="haspdldir" 
select="$application/ccm:directories/ccm:directory[@name='pdl'] or 
not($application/ccm:directories)"/>
       <xsl:variable name="jdodirs" 
select="$application/ccm:jdo/ccm:directory"/>
-      <xsl:variable name="requires" 
select="/ccm:project/ccm:application[@name=$fullname]/ccm:dependencies/ccm:requires"/>
+      <xsl:variable name="requires" 
select="/ccm:project/ccm:appxmls/ccm:application[@name=$fullname]/ccm:dependencies/ccm:requires"/>
+      <xsl:variable name="buildrequires" 
select="/ccm:project/ccm:appxmls/ccm:application[@name=$fullname]/ccm:dependencies/ccm:buildRequires"/>
+      <xsl:variable name="runrequires" 
select="/ccm:project/ccm:appxmls/ccm:application[@name=$fullname]/ccm:dependencies/ccm:runRequires"/>
       <target name="compile-{$name}" description="Compiles the Java code for 
the '{$name}' application" depends="init">
         <xsl:if test="$buildhooks">
           <ant target="compile-hook" dir="{$name}" inheritRefs="true">
@@ -599,7 +631,7 @@
   <xsl:template name="TargetBuildApp">
     <xsl:param name="target"/>
     <xsl:param name="requires"/>
-    <xsl:variable name="application" 
select="document(concat($target,'/application.xml'),/ccm:project)/ccm:application"/>
+    <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$target]/ccm:application"/>
     <xsl:variable name="buildhooks" select="$application/@buildHooks"/>
     <xsl:variable name="hassqldir" 
select="$application/ccm:directories/ccm:directory[@name='sql'] or 
not($application/ccm:directories)"/>
     <xsl:variable name="hassrcdir" 
select="$application/ccm:directories/ccm:directory[@name='src'] or 
not($application/ccm:directories)"/>
@@ -610,7 +642,7 @@
         <xsl:text>init</xsl:text>
         <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
           <xsl:variable name="name" select="@name"/>
-          <xsl:variable name="fullname" 
select="document(concat($name,'/application.xml'),/ccm:project)/ccm:application/@name"/>
+          <xsl:variable name="fullname" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application/@name"/>
           <xsl:for-each select="$requires">
             <xsl:variable name="requiredname" select="@name"/>
             <xsl:if test="$requiredname = $fullname">
@@ -656,15 +688,13 @@
     <xsl:param name="includeself" select="'no'"/>
     <xsl:param name="pathType" select="'library-path'"/>
     <xsl:param name="sourcexml" select="/"/>
-    <xsl:if test="($requires = 'all') or ($includeself = 'yes') or 
(count($requires) > 0) or 
(count($sourcexml//ccm:project/ccm:prebuilt/ccm:application) > 0)">
+    <xsl:if test="($requires = 'all') or ($includeself = 'yes') or 
(count($requires) > 0)">
       <xsl:element name="arg">
         <xsl:attribute name="line">
           <xsl:value-of select="concat('-',$pathType,' ')"/>
           <xsl:choose>
             <xsl:when test="$requires = 'all'">
-              <xsl:for-each 
select="$sourcexml//ccm:project/ccm:build/ccm:application">
-                <xsl:value-of select="concat(@name, '/${pdl.dir}:')"/>
-              </xsl:for-each>
+              <xsl:value-of select="'${apps.pdl.path.all}:'"/>
             </xsl:when>
             <xsl:when test="$includeself = 'no'">
               <xsl:value-of 
select="concat('${apps.',$target,'.pdl.path.internal}:')"/>
@@ -673,9 +703,6 @@
               <xsl:value-of 
select="concat('${apps.',$target,'.pdl.path}:')"/>
             </xsl:otherwise>
           </xsl:choose>
-          <xsl:for-each 
select="$sourcexml//ccm:project/ccm:prebuilt/ccm:application">
-            <xsl:value-of 
select="concat('${apps.',@name,'.location}/',@name,'-',@version,'-pdl.jar:')"/>
-          </xsl:for-each>
         </xsl:attribute>
       </xsl:element>
     </xsl:if>
@@ -762,7 +789,7 @@
     <!-- Deploy hooks -->
     <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
       <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+      <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
       <xsl:variable name="buildhooks" select="$application/@buildHooks"/>
       <xsl:variable name="haspdldir" 
select="$application/ccm:directories/ccm:directory[@name='pdl'] or 
not($application/ccm:directories)"/>
       <xsl:variable name="hassqldir" 
select="$application/ccm:directories/ccm:directory[@name='sql'] or 
not($application/ccm:directories)"/>
@@ -899,46 +926,78 @@
     <xsl:call-template name="LocalGroupingTarget">
       <xsl:with-param name="targetname" select="'deploy-jar-classes'"/>
     </xsl:call-template>
-    <!-- Deploy prebuilt apps -->
-    <xsl:for-each select="/ccm:project/ccm:prebuilt/ccm:application">
-      <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="version" select="@version"/>
-      <target name="deploy-{$name}" depends="init" description="Deploys the 
'{$name}' prebuilt application">
-        <copy todir="${{deploy.shared.lib.dir}}" preservelastmodified="true">
-          <fileset dir="${{apps.{$name}.location}}">
-            <include name="{$name}-{$version}.jar"/>
-            <include name="{$name}-{$version}-*.jar"/>
-            <exclude name="{$name}-{$version}-system.jar"/>
-          </fileset>
-        </copy>
-        <copy todir="${{deploy.system.jars.dir}}" 
preservelastmodified="true">
-          <fileset dir="${{apps.{$name}.location}}">
-            <include name="{$name}-{$version}-system.jar"/>
-          </fileset>
-        </copy>
-        <copy todir="${{deploy.private.lib.dir}}" 
preservelastmodified="true">
-          <fileset dir="${{apps.{$name}.location}}">
-            <include name="{$name}-{$version}/**"/>
-          </fileset>
-          <mapper type="glob" to="*" 
from="{$name}-{$version}${{file.separator}}*"/>
-        </copy>
-        <copy todir="${{deploy.webapp.dir}}" preservelastmodified="true">
-          <fileset dir="/">
-            <include name="${{webapp.dist.dir}}/{$name}-{$version}/**"/>
-          </fileset>
-          <mapper type="glob" to="*" 
from="${{webapp.dist.dir}}${{file.separator}}{$name}-{$version}${{file.separator}}*"/>
-        </copy>
-        <echo message="deployed '{$name}' to ${{deploy.webapp.dir}}"/>
-      </target>
-    </xsl:for-each>
-    <target name="deploy-global">
-      <xsl:attribute name="depends">
-        <xsl:text>init</xsl:text>
-        <xsl:for-each select="/ccm:project/ccm:prebuilt/ccm:application">
-          <xsl:text>,deploy-</xsl:text><xsl:value-of select="@name"/>
-        </xsl:for-each>
-      </xsl:attribute>
+    <target name="deploy-global" depends="init" description="Deploys the 
prebuilt applications">
+      <xsl:variable name="dependencies" 
select="/ccm:project/ccm:appxmls/ccm:application/ccm:dependencies/ccm:requires
 |
+                                                
/ccm:project/ccm:appxmls/ccm:application/ccm:dependencies/ccm:runRequires"/>
+      <xsl:for-each 
select="$dependencies/@name[generate-id()=generate-id(key('key-rundependency',.))]">
+        <xsl:variable name="name" select="."/>
+        <xsl:if 
test="not(/ccm:project/ccm:appxmls/ccm:application[@name=$name])">
+          <xsl:variable name="version" 
select="$dependencies[@name=$name]/@version"/>
+          <copy todir="${{deploy.shared.lib.dir}}" 
preservelastmodified="true">
+            <fileset dir="${{ccm.config.lib.dir}}">
+              <xsl:choose>
+                <xsl:when test="$version">
+                  <include name="{$name}-{$version}.jar"/>
+                  <include name="{$name}-{$version}-pdl.jar"/>
+                  <include name="{$name}-{$version}-sql.jar"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <include name="{$name}.jar"/>
+                  <include name="{$name}-pdl.jar"/>
+                  <include name="{$name}-sql.jar"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </fileset>
+          </copy>
+          <copy todir="${{deploy.system.jars.dir}}" 
preservelastmodified="true">
+            <fileset dir="${{ccm.config.lib.dir}}">
+              <xsl:choose>
+                <xsl:when test="$version">
+                  <include name="{$name}-{$version}-system.jar"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <include name="{$name}-system.jar"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </fileset>
+          </copy>
+          <copy todir="${{deploy.private.lib.dir}}" 
preservelastmodified="true">
+              <xsl:choose>
+                <xsl:when test="$version">
+                  <fileset dir="${{ccm.config.lib.dir}}">
+                    <include name="{$name}-{$version}/**"/>
+                  </fileset>
+                  <mapper type="glob" to="*" 
from="{$name}-{$version}${{file.separator}}*"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <fileset dir="${{ccm.config.lib.dir}}">
+                    <include name="{$name}/**"/>
+                  </fileset>
+                  <mapper type="glob" to="*" 
from="{$name}${{file.separator}}*"/>
+                </xsl:otherwise>
+              </xsl:choose>
+          </copy>
+          <copy todir="${{deploy.webapp.dir}}" preservelastmodified="true">
+            <xsl:choose>
+              <xsl:when test="$version">
+                <fileset dir="/">
+                  <include 
name="${{webapp.dist.dir}}/{$name}-{$version}/**"/>
+                </fileset>
+                <mapper type="glob" to="*" 
from="${{webapp.dist.dir}}${{file.separator}}{$name}-{$version}${{file.separator}}*"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <fileset dir="/">
+                  <include name="${{webapp.dist.dir}}/{$name}/**"/>
+                </fileset>
+                <mapper type="glob" to="*" 
from="${{webapp.dist.dir}}${{file.separator}}{$name}${{file.separator}}*"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </copy>
+          <echo message="deployed '{$name}' to ${{deploy.webapp.dir}}"/>
+        </xsl:if>
+      </xsl:for-each>
     </target>
+
     <target name="deploy-local">
       <xsl:attribute name="depends">
         <xsl:text>init</xsl:text>
@@ -1001,7 +1060,7 @@
             </copy>
           </xsl:when>
           <xsl:otherwise>
-            <xsl:variable name="fullname" 
select="document(concat($name,'/application.xml'),/ccm:project)/ccm:application/@name"/>
+            <xsl:variable name="fullname" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application/@name"/>
             <xsl:for-each select="$requires">
               <xsl:variable name="requiredname" select="@name"/>
               <xsl:if test="$requiredname = $fullname">
@@ -1049,8 +1108,8 @@
         <xsl:text>init</xsl:text>
         <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
           <xsl:variable name="name" select="@name"/>
-          <xsl:variable name="fullname" 
select="document(concat($name,'/application.xml'),/ccm:project)/ccm:application/@name"/>
-          <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+          <xsl:variable name="fullname" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application/@name"/>
+          <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
           <xsl:variable name="hastestdir" 
select="$application/ccm:directories/ccm:directory[@name='test'] or 
not($application/ccm:directories)"/>
           <xsl:for-each select="$requires">
             <xsl:variable name="requiredname" select="@name"/>
@@ -1072,7 +1131,7 @@
     <xsl:variable name="name" select="@name"/>
     <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
       <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+      <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
       <xsl:variable name="hastestdir" 
select="$application/ccm:directories/ccm:directory[@name='test'] or 
not($application/ccm:directories)"/>
       <xsl:variable name="requires" 
select="$application/ccm:dependencies/ccm:requires"/>
       <xsl:if test="$hastestdir">
@@ -1190,8 +1249,8 @@
             <sysproperty value="${{apps.{$name}.name}}.test.pdl.mf" 
key="waf.runtime.test.pdl"/>
             <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
               <xsl:variable name="name" select="@name"/>
-              <xsl:variable name="fullname" 
select="document(concat($name,'/application.xml'),/ccm:project)/ccm:application/@name"/>
-              <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+              <xsl:variable name="fullname" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application/@name"/>
+              <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
               <xsl:variable name="hastestdir" 
select="$application/ccm:directories/ccm:directory[@name='test'] or 
not($application/ccm:directories)"/>
               <xsl:for-each select="$requires">
                 <xsl:variable name="requiredname" select="@name"/>
@@ -1218,7 +1277,8 @@
       <xsl:attribute name="depends">
         <xsl:text>init</xsl:text>
         <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
-          <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+          <xsl:variable name="name" select="@name"/>
+          <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
           <xsl:variable name="hastestdir" 
select="$application/ccm:directories/ccm:directory[@name='test'] or 
not($application/ccm:directories)"/>
           <xsl:if test="$hastestdir">
             <xsl:value-of select="concat(',build-tests-',@name)"/>
@@ -1230,7 +1290,8 @@
       <xsl:attribute name="depends">
         <xsl:text>init</xsl:text>
         <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
-          <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+          <xsl:variable name="name" select="@name"/>
+          <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
           <xsl:variable name="hastestdir" 
select="$application/ccm:directories/ccm:directory[@name='test'] or 
not($application/ccm:directories)"/>
           <xsl:if test="$hastestdir">
             <xsl:value-of select="concat(',runtests-',@name)"/>
@@ -1272,14 +1333,14 @@
 
     <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
       <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+      <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
       <xsl:variable name="requires" 
select="$application/ccm:dependencies/ccm:requires"/>
       <target name="javadoc-{$name}" description="Generates the API 
documentation for the '{$name}' application">
         <xsl:attribute name="depends">
           <xsl:text>init</xsl:text>
           <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
             <xsl:variable name="name" select="@name"/>
-            <xsl:variable name="fullname" 
select="document(concat($name,'/application.xml'),/ccm:project)/ccm:application/@name"/>
+            <xsl:variable name="fullname" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application/@name"/>
             <xsl:for-each select="$requires">
               <xsl:variable name="requiredname" select="@name"/>
               <xsl:if test="$requiredname = $fullname">
@@ -1344,7 +1405,8 @@
       <xsl:attribute name="depends">
         <xsl:text>init</xsl:text>
         <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
-          <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+          <xsl:variable name="name" select="@name"/>
+          <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
           <xsl:variable name="hastestdir" 
select="$application/ccm:directories/ccm:directory[@name='test'] or 
not($application/ccm:directories)"/>
           <xsl:if test="$hastestdir">
             <xsl:text>,build-tests-</xsl:text><xsl:value-of select="@name"/>
@@ -1434,9 +1496,13 @@
       <tstamp><format property="YEAR" pattern="yyyy"/></tstamp>
       <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
         <xsl:variable name="name" select="@name"/>
+        <xsl:variable name="app" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
+        <xsl:variable name="haspdldir" 
select="$app/ccm:directories/ccm:directory[@name='pdl'] or 
not($app/ccm:directories)"/>
         <available property="{$name}.test.src.dir.exists" 
file="{$name}/${{test.src.dir}}" type="dir"/>
-        <pathconvert dirsep="/" pathsep=":" property="apps.{$name}.pdl.path" 
refid="apps.{$name}.pdl.path"/>
-        <pathconvert dirsep="/" pathsep=":" 
property="apps.{$name}.pdl.path.internal" 
refid="apps.{$name}.pdl.path.internal"/>
+        <xsl:if test="$haspdldir">
+          <pathconvert dirsep="/" pathsep=":" 
property="apps.{$name}.pdl.path" refid="apps.{$name}.pdl.path"/>
+          <pathconvert dirsep="/" pathsep=":" 
property="apps.{$name}.pdl.path.internal" 
refid="apps.{$name}.pdl.path.internal"/>
+        </xsl:if>
       </xsl:for-each>
       <path id="ccm.java.ext.dirs">
         <dirset dir="${{ccm.tools.dir}}">
@@ -1486,7 +1552,7 @@
       </condition>
       <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
         <xsl:variable name="name" select="@name"/>
-        <xsl:variable name="application" 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application"/>
+        <xsl:variable name="application" 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application"/>
         <xsl:variable name="shared" select="$application/@shared"/>
         <property 
value="${{deploy.webapp.dir}}/${{apps.{$name}.webapp.name}}" 
name="deploy.dir.{$name}"/>
         <xsl:choose>
@@ -1569,9 +1635,6 @@
     <target name="{$targetname}">
       <xsl:attribute name="depends">
         <xsl:text>init</xsl:text>
-        <xsl:for-each select="/ccm:project/ccm:prebuilt/ccm:application">
-          <xsl:value-of select="concat(',',$targetname,'-',@name)"/>
-        </xsl:for-each>
         <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
           <xsl:value-of select="concat(',',$targetname,'-',@name)"/>
         </xsl:for-each>

Modified: tools/devel/trunk/xsl/classpath-template.xsl
===================================================================
--- tools/devel/trunk/xsl/classpath-template.xsl        2004-09-23 15:52:10 
UTC (rev 27)
+++ tools/devel/trunk/xsl/classpath-template.xsl        2004-09-23 17:35:53 
UTC (rev 28)
@@ -13,45 +13,53 @@
   <xsl:param name="shared.lib.dist.dir" select="/usr/share/java"/>
   <xsl:param name="base.dir" select="/usr/share/java"/>
 
+  <xsl:key name="dependency" match="ccm:dependencies/ccm:requires/@name |
+                                    ccm:dependencies/ccm:runRequires/@name" 
use="."/>
+
   <xsl:template match="ccm:project">
     <xsl:value-of select="'## DO NOT EDIT THIS FILE&#10;'"/>
+    <xsl:value-of select="'## Generated by ccm-configure&#10;'"/>
     <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
-      <xsl:sort select="@buildOrder" data-type="number"/>
       <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
-      <xsl:apply-templates 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application">
+      <xsl:apply-templates 
select="/ccm:project/ccm:appxmls[@name=$name]/ccm:application">
         <xsl:with-param name="projectappname" select="$name"/>
       </xsl:apply-templates>
     </xsl:for-each>
-    <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
-      <xsl:sort select="@buildOrder" data-type="number"/>
-      <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
-      <xsl:apply-templates 
select="document(concat(@name,'/application.xml'),/ccm:project)/ccm:application/ccm:dependencies/ccm:runRequires">
-        <xsl:with-param name="projectappname" select="$name"/>
-      </xsl:apply-templates>
+    <xsl:variable name="dependencies" 
select="/ccm:project/ccm:appxmls/ccm:application/ccm:dependencies/ccm:requires
 |
+                                              
/ccm:project/ccm:appxmls/ccm:application/ccm:dependencies/ccm:runRequires"/>
+    <xsl:for-each 
select="$dependencies/@name[generate-id()=generate-id(key('dependency',.))]">
+      <xsl:variable name="name" select="."/>
+      <xsl:if 
test="not(/ccm:project/ccm:appxmls/ccm:application[@name=$name])">
+        <xsl:variable name="version" 
select="$dependencies[@name=$name]/@version"/>
+        <xsl:choose>
+          <xsl:when test="$version">
+            <xsl:value-of 
select="concat($shared.lib.dist.dir,'/',$name,'-',$version,'.jar&#10;')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of 
select="concat($shared.lib.dist.dir,'/',$name,'.jar&#10;')"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:if>
     </xsl:for-each>
-    <xsl:for-each select="/ccm:project/ccm:prebuilt/ccm:application">
-      <xsl:sort select="@buildOrder" data-type="number"/>
-      <xsl:variable name="name" select="@name"/>
-      <xsl:variable name="version" select="@version"/>
-      <xsl:value-of 
select="concat($shared.lib.dist.dir,'/',$name,'-',$version,'.jar&#10;')"/>
-      <xsl:value-of 
select="concat($shared.lib.dist.dir,'/',$name,'-',$version,'&#10;')"/>
-    </xsl:for-each>
   </xsl:template>
 
   <xsl:template match="ccm:application">
     <xsl:param name="projectappname" select="@name"/>
     <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
     <xsl:variable name="version"><xsl:value-of 
select="@version"/></xsl:variable>
-    <xsl:value-of 
select="concat($base.dir,'/',$projectappname,'/build/classes&#10;')"/>
-    <xsl:value-of 
select="concat($base.dir,'/',$projectappname,'/build/sql&#10;')"/>
+    <xsl:variable name="haspdldir" 
select="ccm:directories/ccm:directory[@name='pdl'] or not(ccm:directories)"/>
+    <xsl:variable name="hassqldir" 
select="ccm:directories/ccm:directory[@name='sql'] or not(ccm:directories)"/>
+    <xsl:variable name="hassrcdir" 
select="ccm:directories/ccm:directory[@name='src'] or not(ccm:directories)"/>
+    <xsl:if test="$hassrcdir">
+      <xsl:value-of 
select="concat($base.dir,'/',$projectappname,'/build/classes&#10;')"/>
+    </xsl:if>
+    <xsl:if test="$haspdldir or $hassqldir">
+      <xsl:value-of 
select="concat($base.dir,'/',$projectappname,'/build/sql&#10;')"/>
+    </xsl:if>
     <xsl:value-of 
select="concat($base.dir,'/',$projectappname,'/lib&#10;')"/>
-    <xsl:value-of 
select="concat($base.dir,'/',$projectappname,'/pdl&#10;')"/>
+    <xsl:if test="$haspdldir">
+      <xsl:value-of 
select="concat($base.dir,'/',$projectappname,'/pdl&#10;')"/>
+    </xsl:if>
   </xsl:template>
 
-  <xsl:template match="ccm:runRequires">
-    <xsl:param name="projectappname" select="@name"/>
-    <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
-    <xsl:value-of 
select="concat($shared.lib.dist.dir,'/',$name,'.jar&#10;')"/>
-  </xsl:template>
-
 </xsl:stylesheet>

Modified: tools/devel/trunk/xsl/combine.xsl
===================================================================
--- tools/devel/trunk/xsl/combine.xsl   2004-09-23 15:52:10 UTC (rev 27)
+++ tools/devel/trunk/xsl/combine.xsl   2004-09-23 17:35:53 UTC (rev 28)
@@ -17,7 +17,12 @@
       <xsl:copy-of select="@*"/>
       <xsl:copy-of select="*"/>
       <xsl:for-each select="/ccm:project/ccm:build/ccm:application">
-        <xsl:copy-of 
select="document(concat(@name,'/application.xml'),/ccm:project)"/>
+        <xsl:element name="ccm:appxmls">
+          <xsl:variable name="appxml"  
select="document(concat(@name,'/application.xml'),/ccm:project)"/>
+          <xsl:copy-of select="$appxml/@*"/>
+          <xsl:copy-of select="@*"/>
+          <xsl:copy-of select="$appxml/*"/>
+        </xsl:element>
       </xsl:for-each>
     </xsl:element>
   </xsl:template>




<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.