You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2004/10/15 17:38:44 UTC

svn commit: rev 54855 - in incubator/beehive/trunk: . netui/ant netui/src/webapp-template/default test/ant

Author: ekoneil
Date: Fri Oct 15 08:38:42 2004
New Revision: 54855

Modified:
   incubator/beehive/trunk/build.xml
   incubator/beehive/trunk/netui/ant/webappTemplate.xml
   incubator/beehive/trunk/netui/src/webapp-template/default/build.xml
   incubator/beehive/trunk/test/ant/buildWebapp.xml
   incubator/beehive/trunk/test/ant/buildWebappCore.xml
   incubator/beehive/trunk/test/ant/runTomcatCore.xml
Log:
Additional work in getting the webapp build working for the Beehive distribution.

This incldues a build.xml file which resides in the WEB-INF/src directory of the Beehive enabled webapp template.

Slight cleanup in the runTomcatCore / buildWebappCore build files to support this including:

- change the name of the property that refers to the Tomcat root from ${tomcat.dir} to ${tomcat.home} in runTomcatCore.xml
- add a velocity.classpath to buildWebapp that is consumed by buildWebappCore and is used during controls compilation

BB: self
DRT: Beehive pass
BVT: NetUI pass



Modified: incubator/beehive/trunk/build.xml
==============================================================================
--- incubator/beehive/trunk/build.xml	(original)
+++ incubator/beehive/trunk/build.xml	Fri Oct 15 08:38:42 2004
@@ -266,7 +266,7 @@
         </copy>
 
         <copy todir="${dist.dir}/lib/netui" failOnError="true" flatten="true">
-            <fileset file="${os.BEEHIVE_HOME}/netui/build/dist/compiler">
+            <fileset dir="${os.BEEHIVE_HOME}/netui/build/dist/compiler">
                 <include name="*.jar"/>
             </fileset>
             <fileset dir="${os.BEEHIVE_HOME}/netui/build/dist/webapp">
@@ -286,17 +286,26 @@
             <fileset file="${beehive.test.dir}/ant/runTomcatCore.xml"/>
         </copy>
 
+        <property name="webapp.name" value="netui-blank"/>
+
         <!-- build the project templates in dist/ -->
         <echo>Create the Beehive webapp template</echo>
-        <copy todir="build/tmp-dist/netui-webapp">
+        <copy todir="build/tmp-dist/${webapp.name}">
             <fileset dir="${os.BEEHIVE_HOME}/netui/build/dist/webapp"/>
         </copy>
 
-        <ant dir="build/tmp-dist/netui-webapp" antfile="build.xml" target="build.webapp">
-            <property name="webapp.dir" location="${os.BEEHIVE_HOME}/build/tmp-dist/netui-webapp"/>
+        <copy todir="build/tmp-dist/${webapp.name}/WEB-INF/src" overwrite="true">
+            <fileset file="${os.BEEHIVE_HOME}/netui/build/dist/webapp/WEB-INF/src/build.xml"/>
+            <filterset>
+                <filter token="WEBAPP_CONTEXT_PATH" value="${webapp.name}"/>
+            </filterset>
+        </copy>
+
+        <ant dir="build/tmp-dist/${webapp.name}/WEB-INF/src" antfile="build.xml" target="build.webapp">
+            <property name="webapp.dir" location="${os.BEEHIVE_HOME}/build/tmp-dist/${webapp.name}"/>
         </ant>
 
-        <jar destfile="${dist.dir}/templates/netui-blank.war" basedir="build/tmp-dist/netui-webapp"/>
+        <jar destfile="${dist.dir}/templates/${webapp.name}.war" basedir="build/tmp-dist/${webapp.name}"/>
         
     </target>
 

Modified: incubator/beehive/trunk/netui/ant/webappTemplate.xml
==============================================================================
--- incubator/beehive/trunk/netui/ant/webappTemplate.xml	(original)
+++ incubator/beehive/trunk/netui/ant/webappTemplate.xml	Fri Oct 15 08:38:42 2004
@@ -109,7 +109,7 @@
         <copy file="${template.root.dir}/default/index.jsp" todir="${webapp.dir}"/>
         <copy file="${template.root.dir}/default/error.jsp" todir="${webapp.dir}"/>
         <copy file="${template.root.dir}/default/error-header.jpg" todir="${webapp.dir}/${resource.dir.name}/images"/>
-        <copy file="${template.root.dir}/default/build.xml" todir="${webapp.dir}"/>
+        <copy file="${template.root.dir}/default/build.xml" todir="${webapp.dir}/WEB-INF/src"/>
 
         <!-- copy the javascript files to the javavscript directory -->
         <copy file="${src.javascript}/netui-tree.js" todir="${javascript.dir}"/>

Modified: incubator/beehive/trunk/netui/src/webapp-template/default/build.xml
==============================================================================
--- incubator/beehive/trunk/netui/src/webapp-template/default/build.xml	(original)
+++ incubator/beehive/trunk/netui/src/webapp-template/default/build.xml	Fri Oct 15 08:38:42 2004
@@ -1,12 +1,99 @@
 <?xml version="1.0"?>
 
 <!-- 
-    Webapp build file.
+    Beehive webapp build file.
+
+    This build file will compile source files for Beehive / XMLBean / Java 
+    source artifacts that are located in the webapp under the following locations:
+
+    webapp-root/
+      *.java,*.jcs,*.jcx,*.java
+      WEB-INF/
+        schemas/
+          *.xsd
+        src/
+          *.java,*.jcs,*.jcx,*.java
+
+    In addition, all of the resource files in WEB-INF/src will be moved into 
+    WEB-INF/classes so that they are available in classloader in a webapp's 
+    runtime.
+
+    This build file is expected to be located in a webapp's WEB-INF/src directory.  
+    This is why the basedir is set to "../.." so that any source files stored in the
+    webapp itself are picked up during the build process.
+
+    In order for the webapp build process to work correctly, the following environment
+    variables need to be defined:
+
+    BEEHIVE_DIST_HOME - this is the root directory of a Beehive installation
+    CATALINA_HOME - this is the root directory of a Tomcat 5.x installation
 -->
-<project name="Webapp Build" default="usage" basedir=".">
+<project name="Webapp Build" default="usage" basedir="../..">
+
+    <property environment="os"/>
+    
+    <!--
+        Define the operating system properties that are needed in order for 
+        the webapp build to find the root of a Beehive distribution and 
+        the Tomcat directory.  
+
+        The Beehive directory root is needed so that JARs used at build-time
+        but not required in the webapp runtime can be accessed without including
+        them in WEB-INF/lib.  They are referenced via a fully-qualified
+        path to their locations in the Beehive distribution's lib/ directory.
+      -->
+    <property name="beehive.home" location="${os.BEEHIVE_DIST_HOME}"/>
+    <property name="tomcat.home" location="${os.CATALINA_HOME}"/>
+
+    <!-- 
+        These are both needed because the runTomcatCore and buildWebappCore files 
+        each use different property names to refer to the webapp root 
+
+        WARNING: do not take an external dependency on these == they need to 
+                 become a single property, so one will be going away!!!
+      -->
+    <property name="webapp.dir" location="${basedir}"/>
+
+    <!-- todo: delete me -->
+    <property name="webapp.root" location="${basedir}"/>
+
+    <!-- 
+        The context path to use when deploying this webapp to Tomcat via Tomcat's 
+        Ant deploy / undeploy / redeploy tasks.  The value CONTEXT_PATH can be 
+        replaced using Ant's filterset functionality.
+      -->
+    <property name="context.path" location="@WEBAPP_CONTEXT_PATH@"/>
+
+    <!-- 
+        These JARs are needed in order to compile source artifacts that are built
+        during the Beehive build process.
+      -->
+    <property name="xbean.jar" location="${beehive.home}/lib/common/apache-xbean.jar"/>
+    <property name="jsr173.jar" location="${beehive.home}/lib/common/jsr173_1.0_api.jar"/>
+    <property name="controls.jar" location="${beehive.home}/lib/controls/controls.jar"/>
+    <property name="netui-compiler.jar" location="${beehive.home}/lib/netui/beehive-netui-compiler.jar"/>
+    <property name="catalina-ant.jar" location="${tomcat.home}/server/lib/catalina-ant.jar"/>
+
+    <path id="velocity.classpath">
+        <fileset dir="${beehive.home}/lib/controls">
+            <include name="velocity*.jar"/>
+        </fileset>
+    </path>
+
+    <!-- 
+        Import the canonical Beehive webapp build targets.
+      -->
+    <import file="${beehive.home}/ant/buildWebappCore.xml"/>
+
+    <!-- 
+        Use of the tasks defined in runTomcatCore.xml require that the "manager" role be setup 
+        in Tomcat.  A user's credentials (username / password) should be used here in order
+        to use the Tomcat deployment Ant tasks.
+      -->
+    <property name="catalina.username" location="manager"/>
+    <property name="catalina.password" location="manager"/>
 
-    <import file="${os.BEEHIVE_DIST_HOME}/ant/buildWebappCore.xml"/>
-    <import file="${os.BEEHIVE_DIST_HOME}/ant/runTomcatCore.xml"/>
+    <import file="${beehive.home}/ant/runTomcatCore.xml"/>
 
     <target name="usage" description="Print the usage for this build.xml">
         <java fork="no" classname="org.apache.tools.ant.Main">

Modified: incubator/beehive/trunk/test/ant/buildWebapp.xml
==============================================================================
--- incubator/beehive/trunk/test/ant/buildWebapp.xml	(original)
+++ incubator/beehive/trunk/test/ant/buildWebapp.xml	Fri Oct 15 08:38:42 2004
@@ -4,7 +4,14 @@
 
     <property environment="os"/>
     <property file="${os.BEEHIVE_HOME}/beehive.properties"/>
-    <property name="velocity.jar" location="${velocity14.jar}"/>
+
+    <property name="tomcat.home" location="${tomcat.dir}"/>
+
+    <path id="velocity.classpath">
+        <fileset dir="${beehive.dir}/external/velocity">
+            <include name="velocity*.jar"/>
+        </fileset>
+    </path>
 
     <import file="buildWebappCore.xml"/>
 

Modified: incubator/beehive/trunk/test/ant/buildWebappCore.xml
==============================================================================
--- incubator/beehive/trunk/test/ant/buildWebappCore.xml	(original)
+++ incubator/beehive/trunk/test/ant/buildWebappCore.xml	Fri Oct 15 08:38:42 2004
@@ -35,11 +35,24 @@
             <fileset dir="${webapp.dir}/WEB-INF/lib">
                 <include name="*.jar"/>
             </fileset>
-            <fileset dir="${tomcat.dir}/common/lib">
+            <fileset dir="${tomcat.home}/common/lib">
                 <include name="*.jar"/>
             </fileset>
         </path>    
 
+        <!-- this path is separate for now because it includes the velocity JARs used in the control compiler -->
+        <path id="controls.build.classpath">
+            <path refid="webapp.build.classpath"/>
+            <path refid="velocity.classpath"/>
+        </path>
+
+        <!-- JPF build -->
+        <!-- apt generates intermediate files Java files into a tmp directory; WEB-INF/${tmp.sourcegen.dir} here -->
+        <path id="pageflow.build.classpath">
+            <path refid="controls.build.classpath"/>
+            <fileset file="${netui-compiler.jar}"/>
+        </path>
+
         <!-- 
             this directory needs to get whacked before every build so 
             that control interface repackagings don't cause stale
@@ -50,7 +63,8 @@
         <mkdir dir="${webapp.dir}/WEB-INF/classes"/>
 
         <!-- XMLBean build -->
-        <taskdef name="xmlbeanbuild" classname="org.apache.xmlbeans.impl.tool.XMLBean" 
+        <taskdef name="xmlbeanbuild" 
+                 classname="org.apache.xmlbeans.impl.tool.XMLBean" 
                  classpath="${xbean.jar};${jsr173.jar}"/>
         <!-- 
             for schemas to be compiled in the webapp, they must reside in 
@@ -61,50 +75,43 @@
 
             @todo: Need to file an Apache bug for this.
           -->
-        <xmlbeanbuild classpath="${xbean.jar};${jsr173.jar}" schema="${webapp.dir}/WEB-INF/schemas" 
-                      classgendir="${webapp.dir}/WEB-INF/classes" failonerror="true"/>
+        <xmlbeanbuild classpath="${xbean.jar};${jsr173.jar}" 
+                      schema="${webapp.dir}/WEB-INF/schemas" 
+                      classgendir="${webapp.dir}/WEB-INF/classes" 
+                      failonerror="true"/>
 
         <!-- .java source build -->
         <echo>========== Complie Java source in WEB-INF/src ==========</echo>
         <javac srcdir="${webapp.dir}/WEB-INF/src" destdir="${webapp.dir}/WEB-INF/classes" 
                classpathref="webapp.build.classpath"/>
 
-        <!-- this path is separate for now because it includes the velocity JARs used in the control compiler -->
-        <path id="controls.build.classpath">
-            <path refid="webapp.build.classpath"/>
-            <fileset dir="${beehive.dir}/external/velocity">
-                <include name="velocity*.jar"/>
-            </fileset>
-        </path>
-
         <echo>netui-compiler.jar: ${netui-compiler.jar}</echo>
         <echo>controls.jar: ${controls.jar}</echo>
 
-        <taskdef name="apt" classname="org.apache.beehive.controls.runtime.generator.AptTask" 
-                 classpath="${controls.jar};${netui-compiler.jar}" onerror="report"/>
+        <taskdef name="apt" 
+                 classname="org.apache.beehive.controls.runtime.generator.AptTask" 
+                 classpath="${controls.jar};${netui-compiler.jar}" 
+                 onerror="report"/>
 
         <!-- Controls build -->
         <!-- apt generates intermediate files Java files into a tmp directory; WEB-INF/${tmp.sourcegen.dir} here -->
         <echo>========== Generate and compile controls ==========</echo>
         <mkdir dir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"/>
-        <apt srcdir="${webapp.dir}" destdir="${webapp.dir}/WEB-INF/classes" 
+        <apt srcdir="${webapp.dir}" 
+             destdir="${webapp.dir}/WEB-INF/classes" 
              gendir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}" 
              classpathref="controls.build.classpath" 
-             compileByExtension="true" srcExtensions="*.java,*.jcx,*.jcs">
-        </apt>
-
-        <!-- JPF build -->
-        <!-- apt generates intermediate files Java files into a tmp directory; WEB-INF/${tmp.sourcegen.dir} here -->
-        <path id="pageflow.build.classpath">
-            <path refid="controls.build.classpath"/>
-            <fileset file="${netui-compiler.jar}"/>
-        </path>
+             compileByExtension="true" 
+             srcExtensions="*.java,*.jcx,*.jcs" 
+             debug="true"/>
 
         <echo>========== Compile Page Flows ==========</echo>
-        <apt srcdir="${webapp.dir}" destdir="${webapp.dir}/WEB-INF/classes" 
+        <apt srcdir="${webapp.dir}" 
+             destdir="${webapp.dir}/WEB-INF/classes" 
              gendir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"
-             classpathref="pageflow.build.classpath" srcExtensions="*.jpf,*.jpfs,*.app,*.jsfb">
-        </apt>
+             classpathref="pageflow.build.classpath" 
+             srcExtensions="*.jpf,*.jpfs,*.app,*.jsfb" 
+             debug="true"/>
 
 	<echo>Copy all .properties files</echo>
         <copy todir="${webapp.dir}/WEB-INF/classes">

Modified: incubator/beehive/trunk/test/ant/runTomcatCore.xml
==============================================================================
--- incubator/beehive/trunk/test/ant/runTomcatCore.xml	(original)
+++ incubator/beehive/trunk/test/ant/runTomcatCore.xml	Fri Oct 15 08:38:42 2004
@@ -11,7 +11,7 @@
 
     <target name="deploy" description="Deploy a webapp to a running Tomcat server">
         <fail unless="context.path" message="Can't deploy webapp; the value ${context.path} was unspecified"/>
-        <fail unless="webapp.root" message="Can't deploy webapp; the value ${webapp.name} was unspecified"/>
+        <fail unless="webapp.root" message="Can't deploy webapp; the value ${webapp.root} was unspecified"/>
 
         <available property="webapp.available" file="${webapp.root}" type="dir"/>
         <fail unless="webapp.available" message="The webapp at ${webapp.root} does not exist."/>