Author: ekoneil
Date: Mon Mar 21 09:31:20 2005
New Revision: 158486

URL: http://svn.apache.org/viewcvs?view=rev&rev=158486
Log:
Contribution from Jim Cummings to add targets for building the test 
distribution, running the tests against a distribution, etc.

BB: self
DRT: Beehive pass
Test: test.dist passes


Added:
    incubator/beehive/trunk/docs/dist-docs/rev-readme-trailer.txt   (with props)
    incubator/beehive/trunk/docs/dist-docs/toplvl-readme-trailer.txt   (with 
props)
Modified:
    incubator/beehive/trunk/build.xml
    incubator/beehive/trunk/distribution.xml
    incubator/beehive/trunk/docs/dist-docs/README.txt
    incubator/beehive/trunk/test/dist-test/build.xml

Modified: incubator/beehive/trunk/build.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/build.xml?view=diff&r1=158485&r2=158486
==============================================================================
--- incubator/beehive/trunk/build.xml (original)
+++ incubator/beehive/trunk/build.xml Mon Mar 21 09:31:20 2005
@@ -179,21 +179,42 @@
     <!-- Distribution targets                          -->
     <!--                                               -->
     <!-- ============================================= -->
-    <target name="clean.dist">
+    <target name="clean.dist" description="Clean the Beehive distribution 
directories">
         <ant antfile="distribution.xml" target="clean.dist" 
inheritAll="false"/>
     </target>    
-    <target name="build.dist">
+    <target name="build.dist" description="Build the Beehive Binary 
distribution directory">
         <ant antfile="distribution.xml" target="build.dist" 
inheritAll="false"/>
     </target>
+    <target name="build.dist.lib" description="Build the Beehive Library 
distribution directory">
+        <ant antfile="distribution.xml" target="build.dist.lib" 
inheritAll="false"/>
+    </target>
+    <target name="build.dist.src" description="Build the Beehive Source 
distribution directory">
+        <ant antfile="distribution.xml" target="build.dist.src" 
inheritAll="false"/>
+    </target>
 
-    <target name="build.dist.archives">
+    <target name="build.dist.archives" description="Create all Beehive 
distribution archives">
         <ant antfile="distribution.xml" target="build.dist.archives" 
inheritAll="false"/>
     </target>
 
-    <target name="build.test.dist">
+    <target name="build.dist.full" description="Cleans/Builds/Bundles the full 
Beehive distribution archives (does not run tests though).">
+        <antcall target="clean"/>
+        <antcall target="deploy"/>
+        <antcall target="build.dist"/>
+        <antcall target="build.dist.lib"/>
+        <antcall target="build.dist.src"/>
+        <antcall target="build.dist.archives"/>
+    </target>
+
+    <!-- consider getting rid of this one too, since run.test.dist does this 
too -->
+    <target name="build.test.dist" description="Build the Beehive Distribution 
Tests">
         <ant antfile="distribution.xml" target="build.test.dist" 
inheritAll="false"/>
     </target>
 
+    <target name="run.test.dist" description="Run the Beehive Distribution 
Tests against the distribution archives">
+        <ant antfile="distribution.xml" target="run.test.dist" 
inheritAll="false"/>
+    </target>
+
+
     <!-- ============================================= -->
     <!--                                               -->
     <!-- Environment sanity check.  Use this if you    --> 
@@ -201,7 +222,7 @@
     <!-- or tests.                                     -->
     <!--                                               -->
     <!-- ============================================= -->
-    <target name="check.setup">
+    <target name="check.setup" description="Verifies that you have the 
prerequisites for building Beehive.">
         <echo>
 java.home       = ${java.home}
 ant.home        = ${ant.home}

Modified: incubator/beehive/trunk/distribution.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/distribution.xml?view=diff&r1=158485&r2=158486
==============================================================================
--- incubator/beehive/trunk/distribution.xml (original)
+++ incubator/beehive/trunk/distribution.xml Mon Mar 21 09:31:20 2005
@@ -6,7 +6,7 @@
     This build file contains the logic associated with creating Beehive 
distributions.  
 A distribution may take one of the following forms:
 
-  - full distribution (samples + runtime)
+  - binary distribution (samples + runtime)
   - library distribution (runtime)
   - documentation distribution (doc)
   - source distribution (source code)
@@ -18,18 +18,27 @@
 
     <import file="beehive-imports.xml"/>
 
-    <property name="dist.name.src" value="${dist.name}-src"/>
+    <property name="dist.src.name" value="${dist.name}-src"/>
     <property name="dist.lib.name" value="${dist.name}-lib"/>
+    <property name="dist.docs.name" value="${dist.name}-docs"/>
 
     <property name="beehive.user.dir" location="${beehive.home}/user"/>
     <property name="dist.base.dir" location="${beehive.home}/build/dist"/>
     <property name="dist.dir" location="${dist.base.dir}/${dist.name}"/>
 
-    <property name="dist.docs.dir" location="${beehive.home}/build/dist-docs"/>
     <property name="dist.lib.dir" 
location="${dist.base.dir}/${dist.lib.name}"/>
+    <property name="dist.src.dir" location="${dist.base.dir}/${dist.src.name}" 
/>
     <property name="dist.archives.dir" location="${dist.base.dir}/archives"/>
     <property name="dist.tmp.dir" location="${beehive.home}/build/tmp-dist/"/>
 
+    <!-- files to dynamically pull together slightly different readmes when 
building distributions -->
+    <property name="dist.readme.template" 
location="${beehive.home}/docs/dist-docs/README.txt"/> 
+    <property name="dist.src.readme.template" 
location="${beehive.home}/README.txt"/> 
+    <property name="dist.readme.rev.trailer" 
location="${beehive.home}/docs/dist-docs/rev-readme-trailer.txt"/>
+    <property name="dist.readme.toplvl.trailer" 
location="${beehive.home}/docs/dist-docs/toplvl-readme-trailer.txt"/>
+    <property name="controlhaus.rev.file" 
location="${dist.dir}/lib/controls/controlhaus.rev"/>
+
+
     <!-- ============================================= -->
     <!--                                               -->
     <!-- Distribution targets                          -->
@@ -42,8 +51,25 @@
         <antcall target="build.system.controls"/>        
         <antcall target="build.dist.samples"/>
         <antcall target="build.dist.docs"/>
+
+        <update-dist-readme/> <!-- system controls have been downloaded incl 
their revs, update the binary dist's readme file -->
     </target>
 
+    <macrodef name="update-dist-readme">
+        <sequential>
+            <!-- update the readme to include the revision number -->
+            <build-dist-readme readmedir="${dist.dir}" 
revtrailer="${dist.readme.rev.trailer}"/>
+
+            <!-- build a slightly different readme that sits outside the 
archive -->
+            <copy file="${dist.dir}/README.txt" 
tofile="${dist.base.dir}/README.txt" overwrite="true" verbose="true"/>
+            <concat destfile="${dist.base.dir}/README.txt" append="true">
+                <fileset file="${dist.readme.toplvl.trailer}"/>
+            </concat>
+            <!-- make sure we have consistent eol's after the concat, in case 
we get mixtures from the different files -->
+            <fixcrlf srcdir="${dist.base.dir}" includes="README.txt"/>
+        </sequential>
+    </macrodef>
+
     <target name="build.system.controls" description="gets controls from 
controlhaus">
         <!-- this pulls down the most generally useful controls from 
              controlhaus.org, and builds them into the distribution --> 
@@ -121,7 +147,7 @@
              todir="${dist.dir}/lib/controls"/>        
 
         <!-- Track the svn revs used for this distro build -->
-        <concat destfile="${dist.dir}/lib/controls/controlhaus.rev" 
fixlastline="true" eol="crlf">
+        <concat destfile="${controlhaus.rev.file}" fixlastline="true" 
eol="crlf">
             <fileset dir="controlhaus">
                 <include name="**/svn.rev"/>
             </fileset>
@@ -261,6 +287,7 @@
         </copy>
     </target>
 
+    <!-- prereq: You must run build.dist before this to ensure the controlhaus 
controls are downloaded -->
     <target name="build.dist.lib" description="Builds a Beehive library 
distribution">
         <mkdir dir="${dist.lib.dir}"/>
 
@@ -277,8 +304,49 @@
             <fileset dir="${beehive.home}/build">
                 <include name="svn.rev"/>
             </fileset>
-            <fileset file="docs/dist-docs/README.txt"/>
         </copy>
+
+        <!-- copy the readme and update it to include the revision number -->
+        <copy file="${dist.readme.template}" 
tofile="${dist.lib.dir}/README.txt" overwrite="true" verbose="true"/>
+        <build-dist-readme readmedir="${dist.lib.dir}" 
revtrailer="${dist.readme.rev.trailer}"/>
+    </target>
+
+    <!-- Builds a src dist with only src files found in our jar files, no 
tests, ant scripts, docs, etc.
+         Intended to allow a user to attach the beehive src to their debugger.
+         prereq: You must run build.dist before this to ensure the controlhaus 
controls are downloaded
+      -->
+    <target name="build.dist.src" description="Builds a Beehive source 
distribution">
+        <check-exists file="controlhaus" type="dir"/>
+
+        <mkdir dir="${dist.src.dir}"/>
+        <copy todir="${dist.src.dir}" failOnError="true">
+            <fileset dir="${beehive.home}">
+                <include name="controls/src/**"/>
+                <include name="netui/src/**"/>
+                <include name="wsm/src/**"/>
+                <include name="controlhaus/*/trunk/src/**"/>
+                <include name="controlhaus/*/trunk/servicecontrol/**"/>
+                <include name="LICENSE.TXT"/>
+                <include name="NOTICE.txt"/>
+
+                <exclude name="**/.svn/**"/>
+                <exclude name="**/build/**"/>
+                <exclude name="**/*.log"/>
+                <exclude name="**/build.xml"/>
+                <exclude name="**/*.jar"/>
+            </fileset>
+
+            <fileset dir="${beehive.home}/build">
+                <include name="svn.rev"/>
+            </fileset>
+        </copy>
+
+        <!-- copy the readme and update it to include the revision number -->
+        <copy file="${dist.src.readme.template}" 
tofile="${dist.src.dir}/README.txt" overwrite="true" verbose="true"/>
+        <build-dist-readme readmedir="${dist.src.dir}" trailerprefix="" 
revtrailer="${dist.readme.rev.trailer}"/>
+
+        <!-- put an exact copy of the src readme one dir up so it will appear 
outside the archive as well -->
+        <copy file="${dist.src.dir}/README.txt" 
tofile="${dist.base.dir}/README-src.txt" overwrite="true" verbose="true"/>
     </target>
 
     <target name="build.dist.core">
@@ -302,9 +370,11 @@
             <fileset dir="${beehive.home}/build">
                 <include name="svn.rev"/>
             </fileset>
-            <fileset file="docs/dist-docs/README.txt"/>
         </copy>
 
+        <!-- copy this now, at the end of build.dist we will add in the 
revision # info -->
+        <copy file="${dist.readme.template}" tofile="${dist.dir}/README.txt" 
overwrite="true" verbose="true"/>
+
         <property name="webapp.name" value="netui-blank"/>
 
         <!-- build the project templates in dist/ -->
@@ -476,23 +546,89 @@
             <fileset dir="${beehive.home}/build">
                 <include name="svn.rev"/>
             </fileset>
-            <fileset file="docs/dist-docs/README.txt"/>
         </copy>
-    </target>                
 
-    <target name="build.dist.archives" depends="build.dist,build.dist.lib" 
description="Builds all Beehive distribution archives (.zip, .tar.gz, etc)">
+        <!-- copy the readme and update it to include the revision number -->
+        <copy file="${dist.readme.template}" 
tofile="${dist.dir}/docs/README.txt" overwrite="true" verbose="true"/>
+        <build-dist-readme readmedir="${dist.dir}/docs" 
revtrailer="${dist.readme.rev.trailer}"/>
+    </target>          
+
+    <!-- Took off the long depends list so this can be called in a chain 
without reinvoking all the targets it depends on.
+         prereq: Now you manually have to ensure that build.dist, 
build.dist.lib and build.dist.src are done before calling this.
+      -->
+    <target name="build.dist.archives" description="Builds all Beehive 
distribution archives (.zip, .tar.gz, src, etc)">
         <fail unless="beehive.version" message="Could not build distribution 
archives; beehive.version property not specified!"/>
+        <check-exists file="${dist.dir}" type="dir"/>
+        <check-exists file="${dist.lib.dir}" type="dir"/>
+        <check-exists file="${dist.src.dir}" type="dir"/>
+
+        <mkdir dir="${dist.archives.dir}"/>
+        <copy file="${dist.base.dir}/README.txt" 
tofile="${dist.archives.dir}/README.txt" overwrite="true" verbose="true"/>
+        <copy file="${dist.base.dir}/README-src.txt" 
tofile="${dist.archives.dir}/README-src.txt" overwrite="true" verbose="true"/>
+
         <antcall target="build.dist.zip"/>
         <antcall target="build.dist.tgz"/>
         <antcall target="build.dist.lib.zip"/>
         <antcall target="build.dist.lib.tgz"/>
         <antcall target="build.dist.docs.zip"/>
         <antcall target="build.dist.docs.tgz"/>
+        <antcall target="build.dist.src.zip"/>
+        <antcall target="build.dist.src.tgz"/>
         <!--
         <antcall target="build.dist.docs.jar"/>
         -->
+
+        <!-- go ahead and always verify them after making them -->
+        <antcall target="verify.dist.archives"/>
     </target>
 
+    <macrodef name="build-dist-readme">
+        <attribute name="readmedir"/>
+        <attribute name="readme" default="README.txt"/>
+        <attribute name="revtrailer"/>
+        <attribute name="trailerprefix" default="  "/> <!-- characters 
prefixed to each line read from revtrailer -->
+
+        <sequential>
+            <echo message="Adding revision to file @{readmedir}/@{readme}"/>
+            <check-exists file="@{readmedir}/@{readme}"/>
+            <check-exists file="@{revtrailer}"/>
+            <check-exists file="build/svn.rev"/>
+            <check-exists file="${controlhaus.rev.file}"/>
+
+            <!-- load the revision # into a property -->
+            <loadfile property="beehive.rev" srcFile="build/svn.rev">
+                <filterchain>
+                    <tokenfilter>
+                        <!-- strip off everything before the revision flagged 
by the preceeding # -->
+                        <containsregex pattern=".*#" replace=""/>
+                    </tokenfilter>
+                </filterchain>
+            </loadfile>
+
+            <!-- append the beehive revision trailer to the readme, then we 
can substitute in the rev # -->
+            <concat destfile="@{readmedir}/@{readme}" append="true">
+                <fileset file="@{revtrailer}"/>
+                <filterchain>
+                    <prefixlines prefix="@{trailerprefix}"/>
+                </filterchain>
+            </concat>
+
+            <!-- substitute the beehive svn revision number into the tag in 
the readme file -->
+            <replace file="@{readmedir}/@{readme}" token="@BEEHIVE_REV@" 
value="${beehive.rev}"/>
+
+            <!-- append the list of controlhaus revisions to the readme as we 
build the distribution -->
+            <concat destfile="@{readmedir}/@{readme}" append="true">
+                <fileset file="${controlhaus.rev.file}"/>
+                <filterchain>
+                    <prefixlines prefix="@{trailerprefix}"/>
+                </filterchain>
+            </concat>
+
+            <!-- make sure we have consistent eol's after the concats, in case 
we get mixtures from the different files -->
+            <fixcrlf srcdir="@{readmedir}" includes="@{readme}"/>
+        </sequential>
+    </macrodef>
+
     <target name="identify_os">
         <condition property="isWindows">
             <os family="windows"/>
@@ -503,7 +639,9 @@
         <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
 
         <mkdir dir="${dist.archives.dir}"/>
-        <zip destfile="${dist.archives.dir}/${dist.name}.zip" 
includes="${dist.name}/**" basedir="${dist.base.dir}"/>
+        <!-- exclude the docs/*txt files to eliminate redundant readmes, 
notices, licenses, etc. -->
+        <zip destfile="${dist.archives.dir}/${dist.name}.zip" 
includes="${dist.name}/**"
+                       
excludes="${dist.name}/docs/*.txt,${dist.name}/docs/*.TXT" 
basedir="${dist.base.dir}"/>
     </target>
 
     <target name="build.dist.tgz" description="Builds a Beehive distribution 
tarball (.tar.gz)" depends="identify_os">
@@ -516,15 +654,18 @@
     </target>
 
     <target name="build.dist.tgz.windows" if="isWindows">
-        <exec executable="tar" dir="${dist.base.dir}">
-            <arg value="-cvzf"/>
+        <exec executable="tar" dir="${dist.base.dir}" failonerror="true">
+            <!-- <arg value="-force-local"/> add this (with extra "-" before 
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
+            <arg value="-czf"/>
             <arg value="${dist.archives.dir}/${dist.name}.tar.gz"/>
             <arg value="${dist.name}"/>
         </exec>
     </target>
 
     <target name="build.dist.tgz.non_windows" unless="isWindows">
-        <tar destfile="${dist.archives.dir}/${dist.name}.tar.gz" 
basedir="${dist.base.dir}" includes="${dist.name}/**" compression="gzip"/>
+        <!-- exclude the docs/*txt files to eliminate redundant readmes, 
notices, licenses, etc. -->
+        <tar destfile="${dist.archives.dir}/${dist.name}.tar.gz" 
basedir="${dist.base.dir}" includes="${dist.name}/**"
+             excludes="${dist.name}/docs/*.txt,${dist.name}/docs/*.TXT" 
compression="gzip"/>
     </target>
 
     <target name="build.dist.lib.tgz" description="Builds a Beehive library 
distribution tarball (.tar.gz)" depends="identify_os">
@@ -537,8 +678,9 @@
     </target>
 
     <target name="build.dist.lib.tgz.windows" if="isWindows">
-        <exec executable="tar" dir="${dist.base.dir}">
-            <arg value="-cvzf"/>
+        <exec executable="tar" dir="${dist.base.dir}" failonerror="true">
+            <!-- <arg value="-force-local"/> add this (with extra "-" before 
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
+            <arg value="-czf"/>
             <arg value="${dist.archives.dir}/${dist.lib.name}.tar.gz"/>
             <arg value="${dist.lib.name}"/>
         </exec>
@@ -559,11 +701,11 @@
         <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
 
         <mkdir dir="${dist.archives.dir}"/>
-        <jar destfile="${dist.archives.dir}/${dist.name}-docs.jar" 
basedir="${dist.dir}/docs"/>
+        <jar destfile="${dist.archives.dir}/${dist.docs.name}.jar" 
basedir="${dist.dir}/docs"/>
     </target>
 
     <target name="build.dist.docs.zip" description="Builds a Beehive 
distribution docs zipfile">
-        <property name="tmpdocsdir" 
location="${dist.tmp.dir}/${dist.name}-docs" />
+        <property name="tmpdocsdir" 
location="${dist.tmp.dir}/${dist.docs.name}" />
         <copy todir="${tmpdocsdir}">
            <fileset dir="${dist.dir}/docs" />
         </copy>
@@ -571,13 +713,13 @@
         <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
 
         <mkdir dir="${dist.archives.dir}"/>
-        <zip destfile="${dist.archives.dir}/${dist.name}-docs.zip" 
basedir="${dist.tmp.dir}" includes="${dist.name}-docs/**" />
+        <zip destfile="${dist.archives.dir}/${dist.docs.name}.zip" 
basedir="${dist.tmp.dir}" includes="${dist.docs.name}/**" />
 
         <delete dir="${tmpdocsdir}" />
     </target>
 
     <target name="build.dist.docs.tgz" description="Builds a Beehive 
distribution docs tarball (.tar.gz)" depends="identify_os">
-        <property name="tmpdocsdir" 
location="${dist.tmp.dir}/${dist.name}-docs" />
+        <property name="tmpdocsdir" 
location="${dist.tmp.dir}/${dist.docs.name}" />
         <copy todir="${tmpdocsdir}">
            <fileset dir="${dist.dir}/docs" />
         </copy>
@@ -594,19 +736,125 @@
     </target>        
 
     <target name="build.dist.docs.tgz.windows" if="isWindows">
-        <exec executable="tar" dir="${dist.tmp.dir}">
-            <arg value="-cvzf"/>
-            <arg value="${dist.archives.dir}/${dist.name}-docs.tar.gz"/>
-            <arg value="${dist.name}-docs"/>
+        <exec executable="tar" dir="${dist.tmp.dir}" failonerror="true">
+            <!-- <arg value="-force-local"/> add this (with extra "-" before 
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
+            <arg value="-czf"/>
+            <arg value="${dist.archives.dir}/${dist.docs.name}.tar.gz"/>
+            <arg value="${dist.docs.name}"/>
         </exec>
     </target>
 
     <target name="build.dist.docs.tgz.non_windows" unless="isWindows">
-        <tar destfile="${dist.archives.dir}/${dist.name}-docs.tar.gz" 
basedir="${dist.tmp.dir}" includes="${dist.name}-docs/**" compression="gzip"/>
+        <tar destfile="${dist.archives.dir}/${dist.docs.name}.tar.gz" 
basedir="${dist.tmp.dir}" includes="${dist.docs.name}/**" compression="gzip"/>
+    </target>
+
+    <target name="build.dist.src.tgz" description="Builds a Beehive source 
distribution tarball (.tar.gz)" depends="identify_os">
+        <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
+
+        <mkdir dir="${dist.archives.dir}"/>
+        <!-- the <tar> task has a bug under Windows, so we special-case it to 
call out to an external tar program -->
+        <antcall target="build.dist.src.tgz.windows"/>
+        <antcall target="build.dist.src.tgz.non_windows"/>
+    </target>
+
+    <target name="build.dist.src.tgz.windows" if="isWindows">
+        <exec executable="tar" dir="${dist.base.dir}" failonerror="true">
+            <!-- <arg value="-force-local"/> add this (with extra "-" before 
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
+            <arg value="-czf"/>
+            <arg value="${dist.archives.dir}/${dist.src.name}.tar.gz"/>
+            <arg value="${dist.src.name}"/>
+        </exec>
+    </target>
+
+    <target name="build.dist.src.tgz.non_windows" unless="isWindows">
+        <tar destfile="${dist.archives.dir}/${dist.src.name}.tar.gz" 
basedir="${dist.base.dir}" includes="${dist.src.name}/**" compression="gzip"/>
+    </target>
+
+    <target name="build.dist.src.zip" description="Builds a Beehive source 
distribution zipfile">
+        <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
+
+        <mkdir dir="${dist.archives.dir}"/>
+        <zip destfile="${dist.archives.dir}/${dist.src.name}.zip" 
includes="${dist.src.name}/**" basedir="${dist.base.dir}"/>
+    </target>
+
+    <!-- prereq: you must have built the archives with build.dist.archives 
already -->
+    <target name="verify.dist.archives" depends="identify_os" 
description="Verifies all Beehive distribution archives (.zip, .tar.gz, src, 
etc)">
+        <verify-archive filebase="${dist.name}"/>
+        <verify-archive filebase="${dist.lib.name}"/>
+        <verify-archive filebase="${dist.docs.name}"/>
+        <verify-archive filebase="${dist.src.name}"/>
+    </target>
+
+    <macrodef name="verify-archive">
+        <attribute name="filebase"/>
+
+        <sequential>
+            <!-- check the zip file -->
+            <echo message="${line.separator}Verifying archive 
@{filebase}.zip"/>
+            <delete dir="${dist.tmp.dir}/@{filebase}"/>
+            <mkdir dir="${dist.tmp.dir}/@{filebase}"/>
+
+            <unzip src="${dist.archives.dir}/@{filebase}.zip" 
dest="${dist.tmp.dir}"/>
+            <check-exists file="${dist.tmp.dir}/@{filebase}/LICENSE.TXT"/>
+            <check-exists file="${dist.tmp.dir}/@{filebase}/NOTICE.txt"/>
+            <check-exists file="${dist.tmp.dir}/@{filebase}/README.txt"/>
+            <delete dir="${dist.tmp.dir}/@{filebase}"/>
+
+            <!-- check the .tar.gz file -->
+            <echo message="${line.separator}Verifying archive 
@{filebase}.tar.gz"/>
+            <mkdir dir="${dist.tmp.dir}/@{filebase}"/>
+
+            <antcall target="build.dist.untgz.windows">
+                <param name="tgz.file" 
value="${dist.archives.dir}/@{filebase}.tar.gz"/>
+                <param name="tgz.dest.dir" value="${dist.tmp.dir}"/>
+            </antcall>
+            <antcall target="build.dist.untgz.non_windows">
+                <param name="tgz.file" 
value="${dist.archives.dir}/@{filebase}.tar.gz"/>
+                <param name="tgz.dest.dir" value="${dist.tmp.dir}"/>
+            </antcall>
+
+            <check-exists file="${dist.tmp.dir}/@{filebase}/LICENSE.TXT"/>
+            <check-exists file="${dist.tmp.dir}/@{filebase}/NOTICE.txt"/>
+            <check-exists file="${dist.tmp.dir}/@{filebase}/README.txt"/>
+            <delete dir="${dist.tmp.dir}/@{filebase}"/>
+        </sequential>
+    </macrodef>
+
+    <!-- Do a chk to see if a file exists, but allow turning this off with the 
docheck attribute.
+         Doing this instead of the simple available/fail pattern to reduce the 
number of properties being used.
+      -->
+    <macrodef name="check-exists">
+        <attribute name="file"/>
+        <attribute name="type" default="file"/>
+        <attribute name="docheck" default="true"/>
+        <sequential>
+            <fail message="Required file @{file} could not be found!">
+                <condition>
+                    <and>
+                        <istrue value="@{docheck}"/>
+                        <not>
+                            <available file="@{file}" type="@{type}"/>
+                        </not>
+                    </and>
+                </condition>
+            </fail>
+        </sequential>
+    </macrodef>
+
+    <target name="build.dist.untgz.windows" if="isWindows">
+        <exec executable="tar" dir="${tgz.dest.dir}" failonerror="true">
+            <!-- <arg value="-force-local"/> add this (with extra "-" before 
-force) if using cygwin gnu tar on windows - see JIRA issue BEEHIVE-403 -->
+            <arg value="-xzf"/>
+            <arg value="${tgz.file}"/>
+        </exec>
+    </target>
+
+    <target name="build.dist.untgz.non_windows" unless="isWindows">
+        <untar src="${tgz.file}" dest="${tgz.dest.dir}" compression="gzip"/>
     </target>
 
     <target name="build.livesite" description="Builds a zipfile of the current 
live site.">
-        <property name="tmpdocsdir" 
location="${dist.tmp.dir}/${dist.name}-docs" />
+        <property name="tmpdocsdir" 
location="${dist.tmp.dir}/${dist.docs.name}" />
         <copy todir="${tmpdocsdir}">
            <fileset dir="${dist.dir}/docs" />
         </copy>
@@ -614,7 +862,7 @@
         <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
 
         <mkdir dir="${dist.archives.dir}"/>
-        <zip destfile="${dist.archives.dir}/site.zip" 
basedir="${dist.tmp.dir}/${dist.name}-docs/" />
+        <zip destfile="${dist.archives.dir}/site.zip" 
basedir="${dist.tmp.dir}/${dist.docs.name}/" />
 
         <delete dir="${tmpdocsdir}" />
     </target>
@@ -622,8 +870,10 @@
     <target name="clean.dist" description="Cleans a Beehive distribution 
build">
         <delete dir="${dist.archives.dir}"/>
         <delete dir="${dist.base.dir}"/>
+        <delete dir="${dist.src.dir}"/>
         <delete dir="${dist.tmp.dir}"/>
-        <delete dir="build/testDistArchives"/>
+
+        <ant dir="${beehive.home}/test/dist-test" antfile="build.xml" 
target="clean" inheritall="false"/>
     </target>
 
     <!-- ===========================================  -->
@@ -644,14 +894,14 @@
              inheritall="false"/>
     </target>
 
-    <target name="run.test.dist">
-<!--
-        <antcall target="build.dist"/>
-        <antcall target="build.test.dist"/>
--->
-        <ant dir="${beehive.home}/test/dist-test" antfile="build.xml" 
target="run.test.dist" inheritall="false">
-            <property name="beehive.dist.dir" value="${dist.dir}"/> 
-            <property name="beehive.dist.name" value="${dist.name}"/> 
+    <!-- prereq: before doing this, you will need to do a build.dist -->
+    <target name="run.test.dist" description="Run the beehive tests against 
the archive files">
+       <!-- keep it simple - build the tests and run them together -->
+       <antcall target="build.test.dist"/>
+
+       <ant dir="${beehive.home}/test/dist-test" antfile="build.xml" 
target="run.test.dist" inheritall="false">
+           <property name="beehive.dist.dir" value="${dist.dir}"/> 
+           <property name="beehive.dist.name" value="${dist.name}"/> 
        </ant>
     </target>
 </project>

Modified: incubator/beehive/trunk/docs/dist-docs/README.txt
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/dist-docs/README.txt?view=diff&r1=158485&r2=158486
==============================================================================
--- incubator/beehive/trunk/docs/dist-docs/README.txt (original)
+++ incubator/beehive/trunk/docs/dist-docs/README.txt Mon Mar 21 09:31:20 2005
@@ -44,4 +44,5 @@
 
   and online at
 
-     http://incubator.apache.org/beehive/index.html
\ No newline at end of file
+     http://incubator.apache.org/beehive/index.html
+

Added: incubator/beehive/trunk/docs/dist-docs/rev-readme-trailer.txt
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/dist-docs/rev-readme-trailer.txt?view=auto&rev=158486
==============================================================================
--- incubator/beehive/trunk/docs/dist-docs/rev-readme-trailer.txt (added)
+++ incubator/beehive/trunk/docs/dist-docs/rev-readme-trailer.txt Mon Mar 21 
09:31:20 2005
@@ -0,0 +1,6 @@
+
+Revisions
+---------
+In revision @BEEHIVE_REV@ of Apache Beehive you will also find the following
+svn revisions/versions of system controls from Controlhaus.org:
+

Propchange: incubator/beehive/trunk/docs/dist-docs/rev-readme-trailer.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/beehive/trunk/docs/dist-docs/toplvl-readme-trailer.txt
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/dist-docs/toplvl-readme-trailer.txt?view=auto&rev=158486
==============================================================================
--- incubator/beehive/trunk/docs/dist-docs/toplvl-readme-trailer.txt (added)
+++ incubator/beehive/trunk/docs/dist-docs/toplvl-readme-trailer.txt Mon Mar 21 
09:31:20 2005
@@ -0,0 +1,9 @@
+
+  Download
+  ------------
+  Please download
+    apache-beehive-incubating-svn-snapshot-*.{tar.gz or zip}
+    apache-beehive-incubating-svn-snapshot-lib-*.{tar.gz or zip}
+
+  And also a local copy of the documentation if you wish
+    apache-beehive-incubating-svn-snapshot-docs-*.{tar.gz or zip}

Propchange: incubator/beehive/trunk/docs/dist-docs/toplvl-readme-trailer.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/test/dist-test/build.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/test/dist-test/build.xml?view=diff&r1=158485&r2=158486
==============================================================================
--- incubator/beehive/trunk/test/dist-test/build.xml (original)
+++ incubator/beehive/trunk/test/dist-test/build.xml Mon Mar 21 09:31:20 2005
@@ -11,6 +11,7 @@
     <property name="build.dir" value="${beehive.home}/build"/>
     <property name="build.tmp.dir" value="${build.dir}/tmp"/>
     <property name="test.dist.base.dir" value="${build.tmp.dir}/test-dist"/>
+    <property name="test.dist.run.dir" value="${test.dist.base.dir}/run"/>
  
 
     <target name="prep" description="Prepare the test-distribution assembling 
area">
@@ -116,4 +117,61 @@
             <tarfileset dir="${test.dist.base.dir}" 
excludes="**/*.zip,**/*.cmd"/>
         </tar>
       </target>
+    <target name="clean" description="Cleans the test distribution 
directories">
+        <delete dir="${test.dist.base.dir}"/>
+        <delete dir="${test.dist.run.dir}"/>
+        <delete dir="${beehive.home}/build/testDistArchives"/>
+    </target>
+
+    <!-- prereq: caller must run build.dist and build.test.dist before calling 
this, and define the props beehive.dist.dir & beehive.dist.name -->
+    <target name="run.test.dist">
+        <fail unless="beehive.dist.dir" message="Could not run tests on 
distribution archive; beehive.dist.dir was not specified"/>
+        <fail unless="beehive.dist.name" message="Could not run tests on 
distribution archive; beehive.dist.name was not specified"/>
+
+        <available property="dist.dir.available" file="${beehive.dist.dir}" 
type="dir"/>
+        <fail unless="dist.dir.available" message="Can't find the required 
dist directory ${beehive.dist.dir}"/>
+
+        <delete dir="${test.dist.run.dir}" />
+
+        <!-- copy the beehive dist and the test dist into a new directory for 
testing -->
+        <copy todir="${test.dist.run.dir}/${beehive.dist.name}">
+            <fileset dir="${beehive.dist.dir}" includes="**/*"/>
+        </copy>
+
+        <unzip 
src="${beehive.home}/build/testDistArchives/${dist.name}-test.zip" 
dest="${test.dist.run.dir}"/>
+
+        <!-- if coreweb is deployed, undeploy it before running the tests -->
+        <property name="waitfor.url" value="http://localhost:8080/coreWeb"/>
+        <undeploy-coreweb/>
+
+        <ant dir="${test.dist.run.dir}/beehive-test-dist" target="run.tests" 
inheritAll="false"/>
+    </target>
+
+    <!-- Undeploys coreweb from tomcat else the tests will fail.
+         NOTE - this is something temporary as whatever is leaving the coreweb 
app deployed should be undeploying coreweb itself.  
+      -->
+    <macrodef name="undeploy-coreweb">
+        <sequential>
+            <parallel>
+                <echo message="Starting tomcat server."/>
+                <start-server shmem="false" javaOptions=""/>
+                <sequential>
+                    <echo>Waiting for server to start...</echo>
+                    <waitfor maxwait="60" maxwaitunit="second" 
timeoutproperty="server.timedOut" checkevery="500">
+                        <http url="${waitfor.url}"/>
+                    </waitfor>
+
+                    <antcall target="undeploy.coreweb.timeoutchk"/>
+
+                    <echo>Stopping tomcat server.</echo>
+                    <stop-server/>
+                </sequential>
+            </parallel>
+        </sequential>
+    </macrodef>
+
+    <target name="undeploy.coreweb.timeoutchk" unless="server.timedOut">
+        <echo>Undeploying coreweb...</echo>
+        <undeploy-webapp contextPath="coreWeb"/>
+    </target>
 </project>


Reply via email to