Hi, sorry, I should have sent this version instead.

Bryan

Bryan Che wrote:
Hi, this is a patch to the distribution build files. It does the following:
-adds targets for building library and documentation distributions (including zip/tgz versions)
-adds a usage target
-refactors/cleans some functionality


Bryan

Index: beehive-imports.xml
===================================================================
--- beehive-imports.xml (revision 126297)
+++ beehive-imports.xml (working copy)
@@ -31,6 +31,7 @@
     <property name="beehive.version" value="svn-snapshot"/>
     <property name="dist.base.name" value="apache-beehive-incubating-"/>
     <property name="dist.name" value="${dist.base.name}${beehive.version}"/>
+    <property name="dist.lib.name" 
value="${dist.base.name}lib-${beehive.version}"/>
 
     <property name="webservice.runtime" value="axis"/>
     <property name="servlet.runtime" value="tomcat"/>
@@ -353,8 +354,6 @@
 
     <echo>Apache Ant version is okay.</echo>
 
-    <mkdir dir="${beehive.home}/build/lib/"/>
-
     <!-- 
======================================================================== -->
     <!-- Output a summary                                                      
   -->
     <!-- 
======================================================================== -->
Index: distribution.xml
===================================================================
--- distribution.xml    (revision 126297)
+++ distribution.xml    (working copy)
@@ -13,6 +13,7 @@
     <property name="dist.base.dir" location="${beehive.home}/build/dist"/>
     <property name="dist.docs.dir" location="${beehive.home}/build/dist-docs"/>
     <property name="dist.dir" location="${dist.base.dir}/${dist.name}"/>
+    <property name="dist.lib.dir" 
location="${dist.base.dir}/${dist.lib.name}"/>
 
     <!-- ============================================= -->
     <!--                                               -->
@@ -27,13 +28,9 @@
         <antcall target="build.dist.docs"/>
     </target>
 
-    <target name="docs" description="">
-        <ant antfile="build.xml" target="docs" inheritAll="false"/>    
-    </target>
-
-    <target name="build.dist.core">
-        <!-- copy the required libraries into dist/ -->
-        <copy todir="${dist.dir}/lib/common" failOnError="true">
+    <!-- target for buliding libraries. required property: lib.dir -->
+    <target name="build.lib">
+        <copy todir="${lib.dir}/common" failOnError="true">
             <fileset refid="commons-codec.fileset"/>
             <fileset refid="log4j.fileset"/>
             <fileset refid="xbean.fileset"/>
@@ -41,18 +38,18 @@
             <fileset refid="velocity.fileset"/>
         </copy>
 
-        <copy todir="${dist.dir}/lib/controls" failOnError="true">
+        <copy todir="${lib.dir}/controls" failOnError="true">
             <fileset refid="controls.fileset"/>
         </copy>
 
         <!-- todo: this needs to be cleaned up; axis shouldn't be in the 
Beehive distribution -->
-        <copy todir="${dist.dir}/lib/wsm" failOnError="true">
+        <copy todir="${lib.dir}/wsm" failOnError="true">
             <fileset dir="${beehive.home}/wsm/external" includes="**/*.jar"/>
             <fileset dir="${beehive.home}/wsm/lib" includes="**/*.jar"/>
             <fileset dir="${beehive.home}/wsm/build/jars" includes="**/*.jar"/>
         </copy>
 
-        <copy todir="${dist.dir}/lib/netui" failOnError="true" flatten="true">
+        <copy todir="${lib.dir}/netui" failOnError="true" flatten="true">
             <fileset dir="${beehive.home}/netui/build/dist/compiler">
                 <include name="*.jar"/>
             </fileset>
@@ -68,11 +65,38 @@
         </copy>
 
         <!-- this directory structure can't be flattened -->
-        <copy todir="${dist.dir}/lib/netui/resources" failOnError="true">
+        <copy todir="${lib.dir}/netui/resources" failOnError="true">
             <fileset dir="${beehive.home}/netui/build/dist/webapp/resources">
                 <include name="**/*"/>
             </fileset>
         </copy>
+    </target>
+
+    <target name="docs" description="">
+        <ant antfile="build.xml" target="docs" inheritAll="false"/>    
+    </target>
+
+    <target name="build.dist.lib" description="Builds a Beehive library 
distribution">
+        <mkdir dir="${dist.lib.dir}"/>
+
+        <!-- build libraries for distribution -->
+        <antcall target="build.lib">
+          <param name="lib.dir" value="${dist.lib.dir}"/>
+        </antcall>
+
+        <copy todir="${dist.lib.dir}" failOnError="true">
+            <fileset dir="${beehive.home}">
+                <include name="LICENSE.TXT"/>
+                <include name="NOTICE.txt"/>
+            </fileset>
+        </copy>
+    </target>
+
+    <target name="build.dist.core">
+        <!-- copy the required libraries into dist/ -->
+        <antcall target="build.lib">
+          <param name="lib.dir" value="${dist.dir}/lib"/>
+        </antcall>
  
         <!-- copy the required Ant build files dist/ -->
         <copy todir="${dist.dir}/ant" failOnError="true">
@@ -188,10 +212,14 @@
         </copy>
     </target>
 
-    <target name="build.dist.archives" description="Builds all Beehive 
distribution archives (.zip, .tar.gz, etc)">
+    <target name="build.dist.archives" depends="build.dist,build.dist.lib" 
description="Builds all Beehive distribution archives (.zip, .tar.gz, etc)">
         <fail unless="beehive.version" message="Could not build distribution 
archives; beehive.version property not specified!"/>
         <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.docs.jar"/>
         -->
@@ -201,16 +229,30 @@
         <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
 
         <mkdir dir="build/jars"/>
-        <zip destfile="build/jars/${dist.name}.zip" 
basedir="${dist.base.dir}"/>
+        <zip destfile="build/jars/${dist.name}.zip" includes="${dist.name}/**" 
basedir="${dist.base.dir}"/>
     </target>
 
     <target name="build.dist.tgz" description="Builds a Beehive distribution 
tarball (.tar.gz)">
         <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
 
         <mkdir dir="build/jars"/>
-        <tar destfile="build/jars/${dist.name}.tar.gz" 
basedir="${dist.base.dir}" compression="gzip"/>
+        <tar destfile="build/jars/${dist.name}.tar.gz" 
basedir="${dist.base.dir}" includes="${dist.name}/**" compression="gzip"/>
     </target>
 
+    <target name="build.dist.lib.tgz" description="Builds a Beehive library 
distribution tarball (.tar.gz)">
+        <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
+
+        <mkdir dir="build/jars"/>
+        <tar destfile="build/jars/${dist.lib.name}.tar.gz" 
basedir="${dist.base.dir}" includes="${dist.lib.name}/**" compression="gzip"/>
+    </target>
+
+    <target name="build.dist.lib.zip" description="Builds a Beehive library 
distribution zipfile">
+        <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
+
+        <mkdir dir="build/jars"/>
+        <zip destfile="build/jars/${dist.lib.name}.zip" 
includes="${dist.lib.name}/**" basedir="${dist.base.dir}"/>
+    </target>
+
     <target name="build.dist.docs.jar" depends="build.dist" 
description="Builds a Beehive distribution docs JAR">
         <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
 
@@ -218,9 +260,39 @@
         <jar destfile="build/jars/${dist.name}-docs.jar" 
basedir="${dist.dir}/docs"/>
     </target>
 
-    <target name="clean.dist">
+    <target name="build.dist.docs.zip" description="Builds a Beehive 
distribution docs zipfile">
+        <property name="tmpdocsdir" 
location="build/tmp-dist/${dist.name}-docs" />
+        <copy todir="${tmpdocsdir}">
+           <fileset dir="${dist.dir}/docs" />
+        </copy>
+
+        <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
+
+        <mkdir dir="build/jars"/>
+        <zip destfile="build/jars/${dist.name}-docs.zip" 
basedir="build/tmp-dist" includes="${dist.name}-docs/**" />
+
+        <delete dir="${tmpdocsdir}" />
+    </target>
+
+    <target name="build.dist.docs.tgz" description="Builds a Beehive 
distribution docs tarball (.tar.gz)">
+        <property name="tmpdocsdir" 
location="build/tmp-dist/${dist.name}-docs" />
+        <copy todir="${tmpdocsdir}">
+           <fileset dir="${dist.dir}/docs" />
+        </copy>
+
+        <fail unless="beehive.version" message="Could not build distribution 
archive; beehive.version was not specified"/>
+
+        <mkdir dir="build/jars"/>
+        <tar destfile="build/jars/${dist.name}-docs.tgz" 
basedir="build/tmp-dist" includes="${dist.name}-docs/**" compression="gzip"/>
+
+        <delete dir="${tmpdocsdir}" />
+    </target>
+
+    <target name="clean.dist" description="Cleans a Beehive distribution 
build">
+        <delete dir="build/jars"/>
         <delete dir="build/dist"/>
         <delete dir="build/tmp-dist"/>
+        <delete dir="build/testDistArchives"/>
     </target>
 
     <target name="test.dist" description="Tests a Beehive distribution">
@@ -258,4 +330,15 @@
                  inheritall="false"/>
     </target>
 
-</project>
\ No newline at end of file
+    <!-- ============================================= -->
+    <!--                                               -->
+    <!-- Default usage target                          -->
+    <!--                                               -->
+    <!-- ============================================= -->
+    <target name="usage" description="Print the usage for this build.xml">
+        <java fork="no" classname="org.apache.tools.ant.Main">
+            <arg line="-f distribution.xml -projecthelp"/>
+        </java>
+    </target>
+
+</project>

Reply via email to