Repository: hadoop
Updated Branches:
  refs/heads/trunk 31ffaf76f -> 58c348685


HADOOP-13175. Remove hadoop-ant from hadoop-tools. Contributed by Chris Douglas.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/58c34868
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/58c34868
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/58c34868

Branch: refs/heads/trunk
Commit: 58c3486850c0503aecdeae8b67bb7e6bc42b4da8
Parents: 31ffaf7
Author: Andrew Wang <w...@apache.org>
Authored: Thu Jun 9 13:49:52 2016 -0700
Committer: Andrew Wang <w...@apache.org>
Committed: Thu Jun 9 13:49:52 2016 -0700

----------------------------------------------------------------------
 hadoop-project/pom.xml                          |   5 -
 hadoop-tools/hadoop-ant/pom.xml                 |  56 -----
 .../java/org/apache/hadoop/ant/DfsTask.java     | 220 -------------------
 .../ant/condition/DfsBaseConditional.java       |  68 ------
 .../apache/hadoop/ant/condition/DfsExists.java  |  24 --
 .../apache/hadoop/ant/condition/DfsIsDir.java   |  24 --
 .../apache/hadoop/ant/condition/DfsZeroLen.java |  24 --
 .../resources/org/apache/hadoop/ant/antlib.xml  |  29 ---
 hadoop-tools/hadoop-tools-dist/pom.xml          |   6 -
 hadoop-tools/pom.xml                            |   1 -
 10 files changed, 457 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-project/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml
index 4c618a1..35166b1 100644
--- a/hadoop-project/pom.xml
+++ b/hadoop-project/pom.xml
@@ -375,11 +375,6 @@
         <artifactId>hadoop-extras</artifactId>
         <version>${project.version}</version>
       </dependency>
-      <dependency>
-        <groupId>org.apache.hadoop</groupId>
-        <artifactId>hadoop-ant</artifactId>
-        <version>${project.version}</version>
-      </dependency>
 
       <dependency>
         <groupId>org.apache.hadoop</groupId>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-tools/hadoop-ant/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-ant/pom.xml b/hadoop-tools/hadoop-ant/pom.xml
deleted file mode 100644
index e0b038e..0000000
--- a/hadoop-tools/hadoop-ant/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License. See accompanying LICENSE file.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0";
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
-                      http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.hadoop</groupId>
-    <artifactId>hadoop-project</artifactId>
-    <version>3.0.0-alpha1-SNAPSHOT</version>
-    <relativePath>../../hadoop-project</relativePath>
-  </parent>
-  <groupId>org.apache.hadoop</groupId>
-  <artifactId>hadoop-ant</artifactId>
-  <version>3.0.0-alpha1-SNAPSHOT</version>
-  <description>Apache Hadoop Ant Tasks</description>
-  <name>Apache Hadoop Ant Tasks</name>
-  <packaging>jar</packaging>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.ant</groupId>
-      <artifactId>ant</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-annotations</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-common</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-hdfs-client</artifactId>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-
-</project>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/DfsTask.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/DfsTask.java 
b/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/DfsTask.java
deleted file mode 100644
index 36119f5..0000000
--- a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/DfsTask.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.ant;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.LinkedList;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FsShell;
-import org.apache.tools.ant.AntClassLoader;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.apache.hadoop.util.ToolRunner;
-import org.apache.hadoop.classification.InterfaceAudience;
-
-/**
- * {@link org.apache.hadoop.fs.FsShell FsShell} wrapper for ant Task.
- */
-@InterfaceAudience.Private
-public class DfsTask extends Task {
-
-  static {
-    // adds the default resources
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
-  }
-
-  /**
-   * Default sink for {@link java.lang.System#out}
-   * and {@link java.lang.System#err}.
-   */
-  private static final OutputStream nullOut = new OutputStream() {
-      public void write(int b)    { /* ignore */ }
-      public String toString()    { return ""; }
-  };
-  private static final FsShell shell = new FsShell();
-
-  protected AntClassLoader confloader;
-  protected OutputStream out = nullOut;
-  protected OutputStream err = nullOut;
-
-  // set by ant
-  protected String cmd;
-  protected final LinkedList<String> argv = new LinkedList<String>();
-  protected String outprop;
-  protected String errprop;
-  protected boolean failonerror = true;
-
-  // saved ant context
-  private PrintStream antOut;
-  private PrintStream antErr;
-
-  /**
-   * Sets the command to run in {@link org.apache.hadoop.fs.FsShell FsShell}.
-   * @param cmd A valid command to FsShell, sans &quot;-&quot;.
-   */
-  public void setCmd(String cmd) {
-    this.cmd = "-" + cmd.trim();
-  }
-
-  /**
-   * Sets the argument list from a String of comma-separated values.
-   * @param args A String of comma-separated arguments to FsShell.
-   */
-  public void setArgs(String args) {
-    for (String s : args.trim().split("\\s*,\\s*"))
-      argv.add(s);
-  }
-
-  /**
-   * Sets the property into which System.out will be written.
-   * @param outprop The name of the property into which System.out is written.
-   * If the property is defined before this task is executed, it will not be 
updated.
-   */
-  public void setOut(String outprop) {
-    this.outprop = outprop;
-    out = new ByteArrayOutputStream();
-    if (outprop.equals(errprop))
-      err = out;
-  }
-
-  /**
-   * Sets the property into which System.err will be written. If this property
-   * has the same name as the property for System.out, the two will be 
interlaced.
-   * @param errprop The name of the property into which System.err is written.
-   * If the property is defined before this task is executed, it will not be 
updated.
-   */
-  public void setErr(String errprop) {
-    this.errprop = errprop;
-    err = (errprop.equals(outprop)) ? err = out : new ByteArrayOutputStream();
-  }
-
-  /**
-   * Sets the path for the parent-last ClassLoader, intended to be used for
-   * {@link org.apache.hadoop.conf.Configuration Configuration}.
-   * @param confpath The path to search for resources, classes, etc. before
-   * parent ClassLoaders.
-   */
-  public void setConf(String confpath) {
-    confloader = AccessController.doPrivileged(
-        new PrivilegedAction<AntClassLoader>() {
-          @Override
-          public AntClassLoader run() {
-            return new AntClassLoader(getClass().getClassLoader(), false);
-          }
-        });
-    confloader.setProject(getProject());
-    if (null != confpath)
-      confloader.addPathElement(confpath);
-  }
-
-  /**
-   * Sets a property controlling whether or not a
-   * {@link org.apache.tools.ant.BuildException BuildException} will be thrown
-   * if the command returns a value less than zero or throws an exception.
-   * @param failonerror If true, throw a BuildException on error.
-   */
-  public void setFailonerror(boolean failonerror) {
-    this.failonerror = failonerror;
-  }
-
-  /**
-   * Save the current values of System.out, System.err and configure output
-   * streams for FsShell.
-   */
-  protected void pushContext() {
-    antOut = System.out;
-    antErr = System.err;
-    try {
-      System.setOut(new PrintStream(out, false, "UTF-8"));
-      System.setErr(out == err ?
-          System.out : new PrintStream(err, false, "UTF-8"));
-    } catch (UnsupportedEncodingException ignored) {
-    }
-  }
-
-  /**
-   * Create the appropriate output properties with their respective output,
-   * restore System.out, System.err and release any resources from created
-   * ClassLoaders to aid garbage collection.
-   */
-  protected void popContext() {
-    // write output to property, if applicable
-    if (outprop != null && !System.out.checkError())
-      getProject().setNewProperty(outprop, out.toString());
-    if (out != err && errprop != null && !System.err.checkError())
-      getProject().setNewProperty(errprop, err.toString());
-
-    System.setErr(antErr);
-    System.setOut(antOut);
-    confloader.cleanup();
-    confloader.setParent(null);
-  }
-
-  // in case DfsTask is overridden
-  protected int postCmd(int exit_code) {
-    if ("-test".equals(cmd) && exit_code != 0)
-      outprop = null;
-    return exit_code;
-  }
-
-  /**
-   * Invoke {@link org.apache.hadoop.fs.FsShell#main} after a
-   * few cursory checks of the configuration.
-   */
-  public void execute() throws BuildException {
-    if (null == cmd)
-      throw new BuildException("Missing command (cmd) argument");
-    argv.add(0, cmd);
-
-    if (null == confloader) {
-      setConf(getProject().getProperty("hadoop.conf.dir"));
-    }
-
-    int exit_code = 0;
-    try {
-      pushContext();
-
-      Configuration conf = new Configuration();
-      conf.setClassLoader(confloader);
-      exit_code = ToolRunner.run(conf, shell,
-          argv.toArray(new String[argv.size()]));
-      exit_code = postCmd(exit_code);
-
-      if (0 > exit_code) {
-        StringBuilder msg = new StringBuilder();
-        for (String s : argv)
-          msg.append(s + " ");
-        msg.append("failed: " + exit_code);
-        throw new Exception(msg.toString());
-      }
-    } catch (Exception e) {
-      if (failonerror)
-          throw new BuildException(e);
-    } finally {
-      popContext();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsBaseConditional.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsBaseConditional.java
 
b/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsBaseConditional.java
deleted file mode 100644
index 33cf52b..0000000
--- 
a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsBaseConditional.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.ant.condition;
-
-import org.apache.tools.ant.taskdefs.condition.Condition;
-
-/**
- * This wrapper around {@link org.apache.hadoop.ant.DfsTask} implements the
- * Ant &gt;1.5
- * {@link org.apache.tools.ant.taskdefs.condition.Condition Condition}
- * interface for HDFS tests. So one can test conditions like this:
- * {@code
- *   <condition property="precond">
- *     <and>
- *       <hadoop:exists file="fileA" />
- *       <hadoop:exists file="fileB" />
- *       <hadoop:sizezero file="fileB" />
- *     </and>
- *   </condition>
- * }
- * This will define the property precond if fileA exists and fileB has zero
- * length.
- */
-public abstract class DfsBaseConditional extends org.apache.hadoop.ant.DfsTask
-                       implements Condition {
-
-  protected boolean result;
-  String file;
-
-  private void initArgs() {
-    setCmd("test");
-    setArgs("-"  +  getFlag() + "," + file);
-  }
-
-  public void setFile(String file) {
-    this.file = file;
-  }
-
-  protected abstract char getFlag();
-
-  protected int postCmd(int exit_code) {
-    exit_code = super.postCmd(exit_code);
-    result = exit_code == 0;
-    return exit_code;
-  }
-
-  public boolean eval() {
-    initArgs();
-    execute();
-    return result;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsExists.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsExists.java
 
b/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsExists.java
deleted file mode 100644
index 95e3868..0000000
--- 
a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsExists.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.ant.condition;
-
-public class DfsExists extends DfsBaseConditional {
-  protected static final char flag = 'e';
-  protected char getFlag() { return flag; }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsIsDir.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsIsDir.java
 
b/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsIsDir.java
deleted file mode 100644
index b889615..0000000
--- 
a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsIsDir.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.ant.condition;
-
-public class DfsIsDir extends DfsBaseConditional {
-  protected static final char flag = 'd';
-  protected char getFlag() { return flag; }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsZeroLen.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsZeroLen.java
 
b/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsZeroLen.java
deleted file mode 100644
index 70b4fbf..0000000
--- 
a/hadoop-tools/hadoop-ant/src/main/java/org/apache/hadoop/ant/condition/DfsZeroLen.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.ant.condition;
-
-public class DfsZeroLen extends DfsBaseConditional {
-  protected static final char flag = 'z';
-  protected char getFlag() { return flag; }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-tools/hadoop-ant/src/main/resources/org/apache/hadoop/ant/antlib.xml
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-ant/src/main/resources/org/apache/hadoop/ant/antlib.xml 
b/hadoop-tools/hadoop-ant/src/main/resources/org/apache/hadoop/ant/antlib.xml
deleted file mode 100644
index 968b899..0000000
--- 
a/hadoop-tools/hadoop-ant/src/main/resources/org/apache/hadoop/ant/antlib.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-
-<antlib>
-  <taskdef name="hdfs"
-           classname="org.apache.hadoop.ant.DfsTask" />
-  <taskdef name="exists"
-           classname="org.apache.hadoop.ant.condition.DfsExists" />
-  <taskdef name="isdir"
-           classname="org.apache.hadoop.ant.condition.DfsIsDir" />
-  <taskdef name="sizezero"
-           classname="org.apache.hadoop.ant.condition.DfsZeroLen" />
-</antlib>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-tools/hadoop-tools-dist/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-tools-dist/pom.xml 
b/hadoop-tools/hadoop-tools-dist/pom.xml
index ef469fa..e1fbef1 100644
--- a/hadoop-tools/hadoop-tools-dist/pom.xml
+++ b/hadoop-tools/hadoop-tools-dist/pom.xml
@@ -105,12 +105,6 @@
       <artifactId>hadoop-sls</artifactId>
       <scope>compile</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-ant</artifactId>
-      <version>${project.version}</version>
-      <scope>compile</scope>
-    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/58c34868/hadoop-tools/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-tools/pom.xml b/hadoop-tools/pom.xml
index bb6d893..bd5f784 100644
--- a/hadoop-tools/pom.xml
+++ b/hadoop-tools/pom.xml
@@ -38,7 +38,6 @@
     <module>hadoop-rumen</module>
     <module>hadoop-gridmix</module>
     <module>hadoop-datajoin</module>
-    <module>hadoop-ant</module>
     <module>hadoop-tools-dist</module>
     <module>hadoop-extras</module>
     <module>hadoop-pipes</module>


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to