Browse Source

HADOOP-2207. Add a 'package' target for contrib modules that permits each to determine what files are copied into release builds. Contributed by stack.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@597262 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 years ago
parent
commit
c6b146cbe9
4 changed files with 38 additions and 30 deletions
  1. 4 0
      CHANGES.txt
  2. 10 14
      build.xml
  3. 11 11
      src/contrib/build-contrib.xml
  4. 13 5
      src/contrib/build.xml

+ 4 - 0
CHANGES.txt

@@ -75,6 +75,10 @@ Trunk (unreleased changes)
     HADOOP-2113. A new shell command "dfs -text" to view the contents of
     a gziped or SequenceFile. (Chris Douglas via dhruba)
 
+    HADOOP-2207.  Add a "package" target for contrib modules that
+    permits each to determine what files are copied into release
+    builds.  (stack via cutting)
+
   OPTIMIZATIONS
 
     HADOOP-1898.  Release the lock protecting the last time of the last stack

+ 10 - 14
build.xml

@@ -319,7 +319,7 @@
   </target>
 
   <target name="compile-contrib" depends="compile-core">
-     <subant target="deploy">
+     <subant target="compile">
         <property name="version" value="${version}"/>
         <fileset file="${contrib.dir}/build.xml"/>
      </subant>  	
@@ -660,7 +660,7 @@
   <!-- ================================================================== -->
   <!--                                                                    -->
   <!-- ================================================================== -->
-  <target name="package" depends="jar, javadoc, examples, compile-core-test, deploy-contrib, ant-tasks" description="Build distribution">
+  <target name="package" depends="jar, javadoc, examples, compile-core-test, ant-tasks" description="Build distribution">
     <mkdir dir="${dist.dir}"/>
     <mkdir dir="${dist.dir}/lib"/>
     <mkdir dir="${dist.dir}/contrib"/>
@@ -681,11 +681,13 @@
 	  <arg line="${native.src.dir}/packageNativeHadoop.sh"/>
     </exec>
 
-    <copy todir="${dist.dir}/contrib" includeEmptyDirs="false" flatten="true">
-      <fileset dir="build/contrib">
-        <include name="*/*.jar"/>
-      </fileset>
-    </copy>
+    <subant target="package">
+      <!--Pass down the version in case its needed again and the target
+      distribution directory so contribs know where to install to.-->
+      <property name="version" value="${version}"/>
+      <property name="dist.dir" value="${dist.dir}"/>
+      <fileset file="${contrib.dir}/build.xml"/>
+    </subant>  	
 
     <copy todir="${dist.dir}/webapps">
       <fileset dir="${build.webapps}"/>
@@ -766,15 +768,9 @@
   </target>
 
   <!-- ================================================================== -->
-  <!-- Contrib targets. For now, they must be called explicitely          -->
+  <!-- Clean contrib target. For now, must be called explicitly           -->
   <!-- Using subant instead of ant as a workaround for 30569              -->
   <!-- ================================================================== -->
-  <target name="deploy-contrib" depends="compile-core">
-     <subant target="deploy">        
-        <property name="version" value="${version}"/>
-        <fileset file="src/contrib/build.xml"/>
-     </subant>  	
-  </target>
   <target name="clean-contrib">
      <subant target="clean">        
         <fileset file="src/contrib/build.xml"/>

+ 11 - 11
src/contrib/build-contrib.xml

@@ -31,7 +31,6 @@
   <property name="build.examples" location="${build.dir}/examples"/>
   <property name="hadoop.log.dir" location="${build.dir}/test/logs"/>
   <!-- all jars together -->
-  <property name="deploy.dir" location="${hadoop.root}/build/"/>
   <property name="javac.deprecation" value="off"/>
   <property name="javac.debug" value="on"/>
 
@@ -156,20 +155,22 @@
     </jar>
   </target>
   
-  <target name="deploy" depends="jar, jar-examples" unless="skip.contrib">
-    <echo message="contrib: ${name}"/>
-    <mkdir dir="${deploy.dir}"/>
-    <copy file="${build.dir}/hadoop-${version}-${name}.jar"
-          todir="${deploy.dir}"/>
-    <!-- <copy todir="${deploy.dir}" flatten="true">
-      <fileset refid="lib.jars"/>
-    </copy> -->
+  <!-- ====================================================== -->
+  <!-- Package a Hadoop contrib                               -->
+  <!-- ====================================================== -->
+  <target name="package" depends="jar, jar-examples" unless="skip.contrib"> 
+    <mkdir dir="${dist.dir}/contrib/${name}"/>
+    <copy todir="${dist.dir}/contrib/${name}" includeEmptyDirs="false" flatten="true">
+      <fileset dir="${build.dir}">
+        <include name="hadoop-${version}-${name}.jar" />
+      </fileset>
+    </copy>
   </target>
   
   <!-- ================================================================== -->
   <!-- Run unit tests                                                     -->
   <!-- ================================================================== -->
-  <target name="test" depends="compile-test, deploy" if="test.available">
+  <target name="test" depends="compile-test, compile, compile-examples" if="test.available">
     <echo message="contrib: ${name}"/>
     <delete dir="${hadoop.log.dir}"/>
     <mkdir dir="${hadoop.log.dir}"/>
@@ -213,7 +214,6 @@
   <target name="clean">
     <echo message="contrib: ${name}"/>
     <delete dir="${build.dir}"/>
-    <!--<delete dir="${deploy.dir}"/> -->
   </target>
 
 </project>

+ 13 - 5
src/contrib/build.xml

@@ -1,17 +1,25 @@
 <?xml version="1.0"?>
 
-<project name="hadoopcontrib" default="deploy" basedir=".">
+<project name="hadoopcontrib" default="compile" basedir=".">
   
   <!-- In case one of the contrib subdirectories -->
   <!-- fails the build or test targets and you cannot fix it: -->
   <!-- Then add to fileset: excludes="badcontrib/build.xml" -->
-  
+
   <!-- ====================================================== -->
-  <!-- Build & deploy all the contrib jars.                   -->
+  <!-- Compile contribs.                                      -->
   <!-- ====================================================== -->
+  <target name="compile">
+    <subant target="compile">
+      <fileset dir="." includes="*/build.xml"/>
+    </subant>
+  </target>
   
-  <target name="deploy">
-    <subant target="deploy">
+  <!-- ====================================================== -->
+  <!-- Package contrib jars.                                  -->
+  <!-- ====================================================== -->
+  <target name="package">
+    <subant target="package">
       <fileset dir="." includes="*/build.xml"/>
     </subant>
   </target>