Browse Source

HADOOP-1806. Fix ant task to compile again. Contributed by Chris Douglas.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@573079 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 17 năm trước cách đây
mục cha
commit
64982995b4
3 tập tin đã thay đổi với 9 bổ sung3 xóa
  1. 3 0
      CHANGES.txt
  2. 2 2
      build.xml
  3. 4 1
      src/ant/org/apache/hadoop/ant/DfsTask.java

+ 3 - 0
CHANGES.txt

@@ -86,6 +86,9 @@ Trunk (unreleased changes)
     HADOOP-1810.  Fix incorrect value type in MRBench (SmallJobs)
     (Devaraj Das via tomwhite)
 
+    HADOOP-1806.  Fix ant task to compile again, also fix default
+    builds to compile ant tasks.  (Chris Douglas via cutting)
+
   IMPROVEMENTS
 
     HADOOP-1779. Replace INodeDirectory.getINode() by a getExistingPathINodes()

+ 2 - 2
build.xml

@@ -307,7 +307,7 @@
      </subant>  	
   </target>
   
-  <target name="compile" depends="compile-core, compile-contrib">
+  <target name="compile" depends="compile-core, compile-contrib, compile-ant-tasks">
   </target>
 
   <target name="compile-examples" 
@@ -638,7 +638,7 @@
   <!-- ================================================================== -->
   <!--                                                                    -->
   <!-- ================================================================== -->
-  <target name="package" depends="jar, javadoc, examples, compile-core-test, deploy-contrib">
+  <target name="package" depends="jar, javadoc, examples, compile-core-test, deploy-contrib, ant-tasks">
     <mkdir dir="${dist.dir}"/>
     <mkdir dir="${dist.dir}/lib"/>
     <mkdir dir="${dist.dir}/contrib"/>

+ 4 - 1
src/ant/org/apache/hadoop/ant/DfsTask.java

@@ -32,6 +32,7 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.Path;
+import org.apache.hadoop.util.ToolRunner;
 
 /**
  * {@link org.apache.hadoop.fs.FsShell FsShell} wrapper for ant Task.
@@ -46,6 +47,7 @@ public class DfsTask extends Task {
       public void write(int b)    { /* ignore */ }
       public String toString()    { return ""; }
   };
+  private static final FsShell shell = new FsShell();
 
   protected AntClassLoader confloader;
   protected OutputStream out = nullOut;
@@ -180,7 +182,8 @@ public class DfsTask extends Task {
 
       Configuration conf = new Configuration();
       conf.setClassLoader(confloader);
-      exit_code = new FsShell().doMain(conf, argv.toArray(new String[argv.size()]));
+      exit_code = ToolRunner.run(conf, shell,
+          argv.toArray(new String[argv.size()]));
       exit_code = postCmd(exit_code);
 
       if (0 > exit_code) {