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/06/23 09:48:13 UTC

svn commit: r416599 - in /lenya/trunk/src: resources/build/module.rng resources/build/modules2build.xsl targets/modules-build.xml targets/properties-build.xml

Author: andreas
Date: Fri Jun 23 00:48:13 2006
New Revision: 416599

URL: http://svn.apache.org/viewvc?rev=416599&view=rev
Log:
Build process: Added module descriptor validation. This fixes bug #39872. Thanks to Renaud Richardet for the patch.

Added:
    lenya/trunk/src/resources/build/module.rng
Modified:
    lenya/trunk/src/resources/build/modules2build.xsl
    lenya/trunk/src/targets/modules-build.xml
    lenya/trunk/src/targets/properties-build.xml

Added: lenya/trunk/src/resources/build/module.rng
URL: http://svn.apache.org/viewvc/lenya/trunk/src/resources/build/module.rng?rev=416599&view=auto
==============================================================================
--- lenya/trunk/src/resources/build/module.rng (added)
+++ lenya/trunk/src/resources/build/module.rng Fri Jun 23 00:48:13 2006
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2006 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
+  xmlns:xsp="http://apache.org/xsp/core/v1"
+  xmlns:s="http://www.ascc.net/xml/schematron"
+  xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+  xmlns:f="http://axkit.org/NS/xsp/perform/v1" 
+  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
+  xmlns:lenya="http://apache.org/lenya/module/1.0">
+  <start>
+    <element name="lenya:module" >
+      <element name="lenya:id"><text/></element>
+      <zeroOrMore>
+        <element name="lenya:depends">
+          <attribute name="module"><text/></attribute>
+        </element>
+      </zeroOrMore>
+      <element name="lenya:package"><text/></element>
+      <element name="lenya:version"><text/></element>
+      <element name="lenya:name"><text/></element>
+      <element name="lenya:lenya-version"><text/></element>
+      <optional>
+        <element name="lenya:description"><text/></element>
+      </optional>
+      <optional>
+        <element name="lenya:creator"><text/></element>
+      </optional>
+      <optional>
+        <element name="lenya:copyrights"><text/></element>
+      </optional>
+      <optional>
+        <element name="lenya:readme"><text/></element>
+      </optional>
+      <optional>
+        <element name="lenya:installation"><text/></element>
+      </optional>
+    </element>
+  </start>
+</grammar>

Modified: lenya/trunk/src/resources/build/modules2build.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/resources/build/modules2build.xsl?rev=416599&r1=416598&r2=416599&view=diff
==============================================================================
--- lenya/trunk/src/resources/build/modules2build.xsl (original)
+++ lenya/trunk/src/resources/build/modules2build.xsl Fri Jun 23 00:48:13 2006
@@ -6,6 +6,7 @@
   <xsl:output indent="yes"/>
   
   <xsl:param name="cocoon-xconf"/>
+  <xsl:param name="module-schema"/>
 
   <xsl:template match="list:modules">
     <project name="lenya-modules">
@@ -42,8 +43,8 @@
   <xsl:template match="list:module" mode="call">
     <xsl:apply-templates select="document(concat(@src, '/module.xml'))/mod:module" mode="call"/>
   </xsl:template>
-  
-  
+
+
   <xsl:template match="mod:module" mode="call">
     <antcall target="deploy-module-{mod:id}"/>
   </xsl:template>
@@ -59,6 +60,10 @@
   <xsl:template match="mod:module" mode="target">
     <xsl:param name="src"/>
     <xsl:variable name="id" select="mod:id"/>
+
+    <target name="validate-module-{$id}">
+      <jing rngfile="{$module-schema}" file="{$src}/module.xml"/>
+    </target>
     
     <xsl:text>
       
@@ -173,7 +178,7 @@
     </xsl:variable>
     
     <target name="deploy-module-{$id}"
-      depends="{$dependencyList} compile-module-{$id}, copy-module-{$id}, patch-module-{$id}"/>
+      depends="{$dependencyList} validate-module-{$id}, compile-module-{$id}, copy-module-{$id}, patch-module-{$id}"/>
     
   </xsl:template>
   

Modified: lenya/trunk/src/targets/modules-build.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/targets/modules-build.xml?rev=416599&r1=416598&r2=416599&view=diff
==============================================================================
--- lenya/trunk/src/targets/modules-build.xml (original)
+++ lenya/trunk/src/targets/modules-build.xml Fri Jun 23 00:48:13 2006
@@ -1,108 +1,111 @@
-<?xml version="1.0"?>
-<!--
-  Copyright 1999-2004 The Apache Software Foundation
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-
-<!-- $Id: webapp-build.xml 177920 2005-05-23 04:59:37Z gregor $ -->
-
-<project name="modules">
-
-  <description>
-    Modules Targets
-  </description>
-  
-  <property name="modules.root.dirs" value=""/>
-  <property name="build.modules" value="${build.webapp}/lenya/modules"/>
-  
-  
-  <target name="deploy-modules" depends="init-tasks">
-    
-    <property name="cocoon.xconf" value="${build.webapp}/WEB-INF/cocoon.xconf"/>
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- $Id: webapp-build.xml 177920 2005-05-23 04:59:37Z gregor $ -->
+
+<project name="modules">
+
+  <description>
+    Modules Targets
+  </description>
+  
+  <property name="modules.root.dirs" value=""/>
+  <property name="build.modules" value="${build.webapp}/lenya/modules"/>
+  
+  
+  <target name="deploy-modules" depends="init-tasks">
     
-    <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"
-      style="${src.resource.dir}/build/modules2build.xsl">
-      <param name="cocoon-xconf" expression="${cocoon.xconf}"/>
-    </xslt>
-
-    <ant antfile="${build.dir}/temp/modules-build.xml"
-      inheritall="true"
-      inheritrefs="true"
-      target="compile-modules"/>
-  </target>
-  
-  
-  <target name="copy-modules">
-    <!--
-    <copyPubs todir="${build.webapp}/lenya/modules"
-              pubsrootdirs="${modules.root.dirs}"
-              excludes="CVS,.svn,cocoon-xconf,lenya-roles"/>
-              -->
-    <bulkCopy 
-      sourcedirs="${modules.root.dirs}" 
-      todir="${build.webapp}/lenya/modules"
-      flatten="false">
-      <fileset>
-        <exclude name="java/**"/>
-        <exclude name="*/java/**"/>
-        <exclude name="config/cocoon-xconf/**"/>
-        <exclude name="*/config/cocoon-xconf/**"/>
-        <exclude name="config/lenya-roles/**"/>
-        <exclude name="*/config/lenya-roles/**"/>
-        <exclude name="config/sitemap/**"/>
-        <exclude name="*/config/sitemap/**"/>
-      </fileset>
-    </bulkCopy>
-    <bulkCopy 
-      sourcedirs="${modules.root.dirs}" 
-      todir="${build.patch}/sitemap/modules"
-      flatten="false">
-      <fileset includes="config/sitemap/**.xmap"/>
-      <fileset includes="*/config/sitemap/**.xmap"/>
-    </bulkCopy>
-    <bulkCopy 
-      sourcedirs="${modules.root.dirs}" 
-      todir="${build.patch}/cocoon-xconf/modules"
-      flatten="false">
-      <fileset includes="config/cocoon-xconf/**.xconf"/>
-      <fileset includes="*/config/cocoon-xconf/**.xconf"/>
-    </bulkCopy>
-    <bulkCopy 
-      sourcedirs="${modules.root.dirs}" 
-      todir="${build.patch}/lenya-roles/modules"
-      flatten="false">
-      <fileset includes="config/lenya-roles/**.xroles"/>
-      <fileset includes="*/config/lenya-roles/**.xroles"/>
-    </bulkCopy>
-  </target>
-  
-
-  <!-- ================================================ -->
-  <!-- Module tests -->
-  <!-- ================================================ -->
-  
-  <target name="modules.test" depends="tests.prepare, deploy-modules">
-    <property name="module" value="*"/>
-    <subant target="test" inheritall="true">
-      <property name="build.webapp" value="${build.webapp}"/>
-      <fileset dir="${build.webapp}/lenya/modules" includes="${module}/targets/test-build.xml"/>
-    </subant>
-  </target>
-  
-</project>
+    <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"
+      style="${src.resource.dir}/build/modules2build.xsl">
+      <param name="cocoon-xconf" expression="${cocoon.xconf}" />
+      <param name="module-schema" expression="${src.resource.dir}/build/module.rng"/>
+    </xslt>
+
+    <ant antfile="${build.dir}/temp/modules-build.xml"
+      inheritall="true"
+      inheritrefs="true"
+      target="compile-modules"/>
+      
+  </target>
+  
+  
+  <target name="copy-modules">
+    <!--
+    <copyPubs todir="${build.webapp}/lenya/modules"
+              pubsrootdirs="${modules.root.dirs}"
+              excludes="CVS,.svn,cocoon-xconf,lenya-roles"/>
+              -->
+    <bulkCopy 
+      sourcedirs="${modules.root.dirs}" 
+      todir="${build.webapp}/lenya/modules"
+      flatten="false">
+      <fileset>
+        <exclude name="java/**"/>
+        <exclude name="*/java/**"/>
+        <exclude name="config/cocoon-xconf/**"/>
+        <exclude name="*/config/cocoon-xconf/**"/>
+        <exclude name="config/lenya-roles/**"/>
+        <exclude name="*/config/lenya-roles/**"/>
+        <exclude name="config/sitemap/**"/>
+        <exclude name="*/config/sitemap/**"/>
+      </fileset>
+    </bulkCopy>
+    <bulkCopy 
+      sourcedirs="${modules.root.dirs}" 
+      todir="${build.patch}/sitemap/modules"
+      flatten="false">
+      <fileset includes="config/sitemap/**.xmap"/>
+      <fileset includes="*/config/sitemap/**.xmap"/>
+    </bulkCopy>
+    <bulkCopy 
+      sourcedirs="${modules.root.dirs}" 
+      todir="${build.patch}/cocoon-xconf/modules"
+      flatten="false">
+      <fileset includes="config/cocoon-xconf/**.xconf"/>
+      <fileset includes="*/config/cocoon-xconf/**.xconf"/>
+    </bulkCopy>
+    <bulkCopy 
+      sourcedirs="${modules.root.dirs}" 
+      todir="${build.patch}/lenya-roles/modules"
+      flatten="false">
+      <fileset includes="config/lenya-roles/**.xroles"/>
+      <fileset includes="*/config/lenya-roles/**.xroles"/>
+    </bulkCopy>
+  </target>
+  
+
+  <!-- ================================================ -->
+  <!-- Module tests -->
+  <!-- ================================================ -->
+  
+  <target name="modules.test" depends="tests.prepare, deploy-modules">
+    <property name="module" value="*"/>
+    <subant target="test" inheritall="true">
+      <property name="build.webapp" value="${build.webapp}"/>
+      <fileset dir="${build.webapp}/lenya/modules" includes="${module}/targets/test-build.xml"/>
+    </subant>
+  </target>
+  
+</project>

Modified: lenya/trunk/src/targets/properties-build.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/targets/properties-build.xml?rev=416599&r1=416598&r2=416599&view=diff
==============================================================================
--- lenya/trunk/src/targets/properties-build.xml (original)
+++ lenya/trunk/src/targets/properties-build.xml Fri Jun 23 00:48:13 2006
@@ -157,6 +157,7 @@
     <taskdef name="copyPubs"        classpath="${tools.tasks.dest}" classname="org.apache.lenya.cms.ant.CopyPublicationsTask"/>
     <taskdef name="xpatch"          classpath="${cocoon.src.dir}/tools/anttasks" classname="XConfToolTask" />
     <taskdef name="generateModuleList" classpath="${tools.tasks.dest}" classname="org.apache.lenya.cms.ant.GenerateModuleList" />
+    <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>
   </target>
 
   <!-- Compile tasks -->



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