hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1514082 - in /hadoop/common/branches/branch-2.1.0-beta: ./ hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/util/ hadoop-project/
Date Wed, 14 Aug 2013 22:49:56 GMT
Author: tucu
Date: Wed Aug 14 22:49:55 2013
New Revision: 1514082

URL: http://svn.apache.org/r1514082
Log:
HADOOP-9872. Improve protoc version handling and detection. (tucu)

Modified:
    hadoop/common/branches/branch-2.1.0-beta/BUILDING.txt
    hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java
    hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/util/Exec.java
    hadoop/common/branches/branch-2.1.0-beta/hadoop-project/pom.xml

Modified: hadoop/common/branches/branch-2.1.0-beta/BUILDING.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1.0-beta/BUILDING.txt?rev=1514082&r1=1514081&r2=1514082&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1.0-beta/BUILDING.txt (original)
+++ hadoop/common/branches/branch-2.1.0-beta/BUILDING.txt Wed Aug 14 22:49:55 2013
@@ -7,7 +7,7 @@ Requirements:
 * JDK 1.6
 * Maven 3.0
 * Findbugs 1.3.9 (if running findbugs)
-* ProtocolBuffer 2.4.1+ (for MapReduce and HDFS)
+* ProtocolBuffer 2.5.0
 * CMake 2.6 or newer (if compiling native code)
 * Internet connection for first build (to fetch all Maven and Hadoop dependencies)
 
@@ -100,6 +100,16 @@ time out after a while, using the Maven 
 to update SNAPSHOTs from external repos.
 
 ----------------------------------------------------------------------------------
+Protocol Buffer compiler
+
+The version of Protocol Buffer compiler, protoc, must match the version of the
+protobuf JAR.
+
+If you have multiple versions of protoc in your system, you can set in your 
+build shell the HADOOP_PROTOC_PATH environment variable to point to the one you 
+want to use for the Hadoop build. If you don't define this environment variable,
+protoc is looked up in the PATH.
+----------------------------------------------------------------------------------
 Importing projects to eclipse
 
 When you import the project to eclipse, install hadoop-maven-plugins at first.

Modified: hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java?rev=1514082&r1=1514081&r2=1514082&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java
(original)
+++ hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java
Wed Aug 14 22:49:55 2013
@@ -45,7 +45,7 @@ public class ProtocMojo extends Abstract
   @Parameter(required=true)
   private FileSet source;
 
-  @Parameter(defaultValue="protoc")
+  @Parameter
   private String protocCommand;
 
   @Parameter(required=true)
@@ -53,21 +53,22 @@ public class ProtocMojo extends Abstract
 
   public void execute() throws MojoExecutionException {
     try {
+      if (protocCommand == null || protocCommand.trim().isEmpty()) {
+        protocCommand = "protoc";
+      }
       List<String> command = new ArrayList<String>();
       command.add(protocCommand);
       command.add("--version");
       Exec exec = new Exec(this);
       List<String> out = new ArrayList<String>();
-      if (exec.run(command, out) != 0) {
-        getLog().error("protoc, could not get version");
-        for (String s : out) {
-          getLog().error(s);
-        }
+      if (exec.run(command, out) == 127) {
+        getLog().error("protoc, not found at: " + protocCommand);
         throw new MojoExecutionException("protoc failure");        
       } else {
-        if (out.size() == 0) {
+        if (out.isEmpty()) {
+          getLog().error("stdout: " + out);
           throw new MojoExecutionException(
-              "'protoc -version' did not return a version");
+              "'protoc --version' did not return a version");
         } else {
           if (!out.get(0).endsWith(protocVersion)) {
             throw new MojoExecutionException(

Modified: hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/util/Exec.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/util/Exec.java?rev=1514082&r1=1514081&r2=1514082&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/util/Exec.java
(original)
+++ hadoop/common/branches/branch-2.1.0-beta/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/util/Exec.java
Wed Aug 14 22:49:55 2013
@@ -63,11 +63,10 @@ public class Exec {
         for (String s : stdErr.getOutput()) {
           mojo.getLog().debug(s);
         }
-      } else {
-        stdOut.join();
-        stdErr.join();
-        output.addAll(stdOut.getOutput());
       }
+      stdOut.join();
+      stdErr.join();
+      output.addAll(stdOut.getOutput());
     } catch (Exception ex) {
       mojo.getLog().warn(command + " failed: " + ex.toString());
     }

Modified: hadoop/common/branches/branch-2.1.0-beta/hadoop-project/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1.0-beta/hadoop-project/pom.xml?rev=1514082&r1=1514081&r2=1514082&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1.0-beta/hadoop-project/pom.xml (original)
+++ hadoop/common/branches/branch-2.1.0-beta/hadoop-project/pom.xml Wed Aug 14 22:49:55 2013
@@ -61,6 +61,7 @@
     <!-- ProtocolBuffer version, used to verify the protoc version and -->
     <!-- define the protobuf JAR version                               -->
     <protobuf.version>2.5.0</protobuf.version>
+    <protoc.path>${env.HADOOP_PROTOC_PATH}</protoc.path>
   </properties>
 
   <dependencyManagement>



Mime
View raw message