You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/07/19 17:25:02 UTC

svn commit: r423490 - in /lenya/trunk/src: resources/build/modules2build.xsl targets/modules-build.xml targets/test-build.xml

Author: andreas
Date: Wed Jul 19 08:25:02 2006
New Revision: 423490

URL: http://svn.apache.org/viewvc?rev=423490&view=rev
Log:
Build process: Patch xtest file for each module separately

Modified:
    lenya/trunk/src/resources/build/modules2build.xsl
    lenya/trunk/src/targets/modules-build.xml
    lenya/trunk/src/targets/test-build.xml

Modified: lenya/trunk/src/resources/build/modules2build.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/resources/build/modules2build.xsl?rev=423490&r1=423489&r2=423490&view=diff
==============================================================================
--- lenya/trunk/src/resources/build/modules2build.xsl (original)
+++ lenya/trunk/src/resources/build/modules2build.xsl Wed Jul 19 08:25:02 2006
@@ -117,54 +117,37 @@
     <xsl:text>
     </xsl:text>
     
-    <xsl:variable name="srcDir"><xsl:value-of select="$src"/>/java/src</xsl:variable>
-    <available file="{$srcDir}" property="compile.module.{$id}"/>
+    <available file="{$src}/java/src" property="compile.module.{$id}"/>
 
-    <xsl:variable name="destDir">${build.dir}/modules/<xsl:value-of select="$id"/></xsl:variable>
-    <xsl:variable name="debug">${debug}</xsl:variable>
-    <xsl:variable name="optimize">${optimize}</xsl:variable>
-    <xsl:variable name="deprecation">${deprecation}</xsl:variable>
-    <xsl:variable name="target">${target.vm}</xsl:variable>
-    <xsl:variable name="nowarn">${nowarn}</xsl:variable>
+    <xsl:variable name="destDir">${build.dir}/modules/<xsl:value-of select="$id"/>/java/classes</xsl:variable>
     
     <target name="compile-module-{$id}" if="compile.module.{$id}">
       
       <path id="module.classpath.{$id}">
         <path refid="classpath"/>
-        <fileset includes="lenya-*-api.jar">
-          <xsl:attribute name="dir">${build.webapp}/WEB-INF/lib</xsl:attribute>
-        </fileset>
+        <fileset dir="${{build.webapp}}/WEB-INF/lib" includes="lenya-*-api.jar"/>
         <xsl:for-each select="mod:depends">
-          <fileset includes="lenya-module-{@module}.jar">
-            <xsl:attribute name="dir">${build.webapp}/WEB-INF/lib</xsl:attribute>
-          </fileset>
+          <fileset dir="${{build.webapp}}/WEB-INF/lib" includes="lenya-module-{@module}.jar"/>
         </xsl:for-each>
-        <fileset dir="{$src}">
-          <include name="java/lib/*.jar"/>
-        </fileset>
-        <fileset>
-          <xsl:attribute name="dir">${lib.dir}</xsl:attribute>
-          <include name="*.jar"/>
-        </fileset>
+        <fileset dir="{$src}" includes="java/lib/*.jar"/>
+        <fileset dir="${{lib.dir}}" includes="*.jar"/>
       </path>
       
       <mkdir dir="{$destDir}"/>
       
       <javac
         destdir="{$destDir}"
-        debug="{$debug}"
-        optimize="{$optimize}"
-        deprecation="{$deprecation}"
-        target="{$target}"
-        nowarn="{$nowarn}"
+        debug="${{debug}}"
+        optimize="${{optimize}}"
+        deprecation="${{deprecation}}"
+        target="${{target.vm}}"
+        nowarn="${{nowarn}}"
         source="1.4">
-        <src path="{$srcDir}"/>
+        <src path="{$src}/java/src"/>
         <classpath refid="module.classpath.{$id}"/>
       </javac>
       
-      <xsl:variable name="jarfile">${build.webapp}/WEB-INF/lib/lenya-module-<xsl:value-of select="$id"/>.jar</xsl:variable>
-      
-      <jar jarfile="{$jarfile}" index="true">
+      <jar jarfile="${{build.webapp}}/WEB-INF/lib/lenya-module-{$id}.jar" index="true">
         <fileset dir="{$destDir}">
           <exclude name="**/Manifest.mf"/>
         </fileset>
@@ -180,9 +163,8 @@
     
     <target name="copy-module-{$id}">
       <xsl:if test="$copy-modules = 'true'">
-        <xsl:variable name="todir">${build.webapp}/lenya/modules/<xsl:value-of select="$dirName"/></xsl:variable>
         <copy 
-          todir="{$todir}"
+          todir="${{build.webapp}}/lenya/modules/{$dirName}"
           flatten="false">
           <fileset dir="{$src}">
             <exclude name="java/**"/>
@@ -204,14 +186,12 @@
         includes="config/cocoon-xconf/*.xconf, config/cocoon-xconf/*/*.xconf"
         addComments="false"/>
         
-      <xsl:variable name="lenya-roles">${build.dir}/impl/org/apache/lenya/lenya.roles</xsl:variable>
-      <xpatch file="{$lenya-roles}"
+      <xpatch file="${{build.dir}}/impl/org/apache/lenya/lenya.roles"
         srcdir="{$src}"
         includes="config/lenya-roles/*.xroles"
         addComments="false"/>
       
-      <xsl:variable name="sitemap-xmap">${build.webapp}/sitemap.xmap</xsl:variable>
-      <xpatch file="{$sitemap-xmap}"
+      <xpatch file="${{build.webapp}}/sitemap.xmap"
         srcdir="{$src}" 
         includes="config/sitemap/*.xmap"
         addComments="false"/>
@@ -237,66 +217,79 @@
     <!-- Test -->
     <!-- ============================================================ -->
     
-    <xsl:variable name="testSrcDir"><xsl:value-of select="$src"/>/java/test</xsl:variable>
+    <available file="{$src}/java/test" property="test.module.{$id}"/>
+    
+    <xsl:variable name="testDependencyList">
+      <xsl:for-each select="mod:depends">
+        <xsl:text>patch-module-test-</xsl:text><xsl:value-of select="@module"/>
+        <xsl:if test="following-sibling::mod:depends">
+          <xsl:text>, </xsl:text>
+        </xsl:if>
+      </xsl:for-each>
+    </xsl:variable>
     
-    <available file="{$testSrcDir}" property="test.module.{$id}"/>
+    <target name="patch-module-test-{$id}">
+      <xsl:if test="normalize-space($testDependencyList) != ''">
+        <xsl:attribute name="depends"><xsl:value-of select="$testDependencyList"/></xsl:attribute>
+      </xsl:if>
+      <xslt basedir="{$src}/config/cocoon-xconf"
+        destdir="${{build.dir}}/modules/{$id}/config/xtest"
+        style="${{src.resource.dir}}/test/xpatch2testpatch.xsl"
+        extension=".xtest">
+      </xslt>
+      <xpatch file="${{build.test}}/org/apache/lenya/cms/LenyaTestCase.xtest"
+        srcdir="${{build.dir}}/modules/{$id}"
+        includes="config/xtest/*.xtest, config/xtest/*/*.xtest"
+        addComments="false"/>
+    </target>
     
-    <target name="test-module-{$id}" if="test.module.{$id}">
-      
-      <xsl:variable name="testDestDir">${build.dir}/modules/<xsl:value-of select="$id"/>-test</xsl:variable>
+    <target name="test-module-{$id}" if="test.module.{$id}" depends="patch-module-test-{$id}, compile-module-{$id}">
+
+      <xsl:variable name="testDestDir">${build.dir}/modules/<xsl:value-of select="$id"/>/java/test</xsl:variable>
       
       <mkdir dir="{$testDestDir}"/>
       
-      <xsl:variable name="build-webapp">${build.webapp}</xsl:variable>
-      <xsl:variable name="build-test">${build.test}</xsl:variable>
-      
       <path id="module.test-classpath.{$id}">
         <path refid="module.classpath.{$id}"/>
-        <fileset dir="{$build-webapp}/WEB-INF/lib">
+        <fileset dir="${{build.webapp}}/WEB-INF/lib">
           <include name="lenya-module-{$id}.jar"/>
         </fileset>
-        <path location="{$build-test}"/>
+        <path location="${{build.test}}"/>
       </path>
       
       <javac
         destdir="{$testDestDir}"
-        debug="{$debug}"
-        optimize="{$optimize}"
-        deprecation="{$deprecation}"
-        target="{$target}"
-        nowarn="{$nowarn}"
+        debug="${{debug}}"
+        optimize="${{optimize}}"
+        deprecation="${{deprecation}}"
+        target="${{target.vm}}"
+        nowarn="${{nowarn}}"
         source="1.4">
-        <src path="{$testSrcDir}"/>
+        <src path="{$src}/java/test"/>
         <classpath refid="module.test-classpath.{$id}"/>
       </javac>
       
       <!-- Copy test resources -->
       <copy todir="{$testDestDir}" filtering="on">
-        <fileset dir="{$testSrcDir}" excludes="**.java"/>
+        <fileset dir="{$src}/java/test" excludes="**.java"/>
       </copy>
       
-      <xsl:variable name="loglevel">${junit.test.loglevel}</xsl:variable>
-      <xsl:variable name="junit-dir">${junit.dir}</xsl:variable>
-      <xsl:variable name="repository-factory">${repository.factory}</xsl:variable>
-      <xsl:variable name="contextRoot">${basedir}/build/lenya/webapp</xsl:variable>
-      <xsl:variable name="tempDir">${basedir}/build/lenya/temp</xsl:variable>
-      
       <junit printsummary="yes" showoutput="true" haltonerror="on" haltonfailure="on">
         <classpath>
-          <fileset dir="{$build-webapp}/WEB-INF/lib" includes="*.jar, endorsed/*.jar"/>
-          <path location="{$build-webapp}/WEB-INF/classes"/>
-          <path location="{$build-test}"/>
+          <fileset dir="${{build.webapp}}/WEB-INF/lib" includes="*.jar, endorsed/*.jar"/>
+          <path location="${{build.webapp}}/WEB-INF/classes"/>
+          <path location="${{build.test}}"/>
           <path location="{$testDestDir}"/>
         </classpath>
         <formatter type="plain" usefile="false" />
         <formatter type="xml" />
-        <jvmarg value="-Djava.endorsed.dirs {$build-webapp}/WEB-INF/lib/endorsed"/>
-        <sysproperty key="junit.test.loglevel" value="{$loglevel}"/>
-        <sysproperty key="contextRoot" value="{$contextRoot}"/>
-        <sysproperty key="tempDir" value="{$tempDir}"/>
-        <sysproperty key="test.repo.webappDirectory" value="{$build-webapp}"/>
-        <sysproperty key="test.repo.repositoryFactory" value="{$repository-factory}"/>
-        <batchtest todir="{$junit-dir}">
+        <jvmarg value="-Djava.endorsed.dirs ${{build-webapp}}/WEB-INF/lib/endorsed"/>
+        <sysproperty key="junit.test.loglevel" value="${{junit.test.loglevel}}"/>
+        <sysproperty key="contextRoot" value="${{basedir}}/build/lenya/webapp"/>
+        <sysproperty key="tempDir" value="${{basedir}}/build/lenya/temp"/>
+        <sysproperty key="test.repo.webappDirectory" value="${{build-webapp}}"/>
+        <sysproperty key="test.repo.repositoryFactory" value="${{repository.factory}}"/>
+        <batchtest todir="${{junit.dir}}">
           <fileset dir="{$testDestDir}" includes="**/*.class" excludes="**/Abstract*.class"/>
         </batchtest>
       </junit>

Modified: lenya/trunk/src/targets/modules-build.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/targets/modules-build.xml?rev=423490&r1=423489&r2=423490&view=diff
==============================================================================
--- lenya/trunk/src/targets/modules-build.xml (original)
+++ lenya/trunk/src/targets/modules-build.xml Wed Jul 19 08:25:02 2006
@@ -28,14 +28,14 @@
   <property name="modules.copy" value="false"/>
   
   
-  <target name="deploy-modules" depends="init-tasks">
+  <target name="prepare-modules" depends="init-tasks">
     
     <property name="cocoon.xconf" value="${build.webapp}/WEB-INF/cocoon.xconf"/>
     
     <generateModuleList
       moduleDirs="${modules.root.dirs}"
       moduleFile="${build.dir}/temp/modules.xml"/>
-      
+    
     <xslt
       in="${build.dir}/temp/modules.xml"
       out="${build.dir}/temp/modules-build.xml"
@@ -44,7 +44,7 @@
       <param name="module-schema" expression="${src.resource.dir}/build/module.rng"/>
       <param name="copy-modules" expression="${modules.copy}"/>
     </xslt>
-
+    
     <xslt
       in="${build.dir}/temp/modules.xml"
       out="${build.dir}/temp/modules.xconf"
@@ -57,11 +57,14 @@
       srcdir="${build.dir}/temp/"
       file="${cocoon.xconf}"/>
     
+  </target>
+  
+  
+  <target name="deploy-modules" depends="prepare-modules">
     <ant antfile="${build.dir}/temp/modules-build.xml"
       inheritall="true"
       inheritrefs="true"
       target="compile-modules"/>
-      
   </target>
   
   
@@ -69,14 +72,14 @@
   <!-- Module tests -->
   <!-- ================================================ -->
   
-  <target name="modules.test" depends="tests.prepare">
+  <target name="modules.test" depends="tests.prepare, prepare-modules">
     <ant antfile="${build.dir}/temp/modules-build.xml"
       inheritall="true"
       inheritrefs="true"
       target="test-modules"/>
   </target>
   
-  <target name="module.test" depends="tests.prepare">
+  <target name="module.test" depends="tests.prepare, prepare-modules">
     <property name="module" value=""/>
     <ant antfile="${build.dir}/temp/modules-build.xml"
       inheritall="true"

Modified: lenya/trunk/src/targets/test-build.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/targets/test-build.xml?rev=423490&r1=423489&r2=423490&view=diff
==============================================================================
--- lenya/trunk/src/targets/test-build.xml (original)
+++ lenya/trunk/src/targets/test-build.xml Wed Jul 19 08:25:02 2006
@@ -69,7 +69,7 @@
   </target>
   
   <!-- prepares the tests. -->
-  <target name="tests.prepare" depends="init">
+  <target name="tests.prepare" depends="init, test.pub.prepare">
     <mkdir dir="${build.test}"/>
     <mkdir dir="${junit.dir}" />
     
@@ -134,9 +134,6 @@
       includes="**/*.xconf"
       excludes="prepare/*.xconf"
       addComments="true"/>
-    <antcall target="deploy-modules">
-      <param name="cocoon.xconf" value="${build.temp}/test/xconf-template.xml"/>
-    </antcall>
     
     <xslt in="${build.temp}/test/xconf-template.xml"
       out="${build.temp}/test/components.xsl"
@@ -158,7 +155,7 @@
 
 
   <!-- Runs JUnit tests -->
-  <target name="tests.junit" depends="tests.prepare, test.pub.prepare">
+  <target name="tests.junit" depends="tests.prepare">
     <junit printsummary="yes" showoutput="true" haltonerror="on" haltonfailure="on" fork="true">
       <jvmarg value="-Djava.endorsed.dirs=${build.webapp}/WEB-INF/lib/endorsed"/>
       <jvmarg value="-Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser"/>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org