From 677bbd336d960044af28fde2bbb253c7f63c892f Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Wed, 14 Aug 2013 22:25:26 +0000 Subject: [PATCH] HADOOP-9845. Update protobuf to 2.5 from 2.4.x. (tucu) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1514071 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/pom.xml | 2 ++ hadoop-hdfs-project/hadoop-hdfs/pom.xml | 4 +++ .../hadoop-hdfs/src/contrib/bkjournal/pom.xml | 1 + .../hadoop-mapreduce-client-common/pom.xml | 1 + .../hadoop-mapreduce-client-hs/pom.xml | 1 + .../maven/plugin/protoc/ProtocMojo.java | 31 +++++++++++++++++-- hadoop-project/pom.xml | 6 +++- .../hadoop-yarn/hadoop-yarn-api/pom.xml | 1 + .../hadoop-yarn-server-common/pom.xml | 1 + .../hadoop-yarn-server-nodemanager/pom.xml | 1 + 10 files changed, 45 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/pom.xml b/hadoop-common-project/hadoop-common/pom.xml index 1a206421a4a..8c98ebe33e3 100644 --- a/hadoop-common-project/hadoop-common/pom.xml +++ b/hadoop-common-project/hadoop-common/pom.xml @@ -308,6 +308,7 @@ protoc + ${protobuf.version} ${basedir}/src/main/proto @@ -336,6 +337,7 @@ protoc + ${protobuf.version} ${basedir}/src/test/proto diff --git a/hadoop-hdfs-project/hadoop-hdfs/pom.xml b/hadoop-hdfs-project/hadoop-hdfs/pom.xml index 20c8f1cf8ef..befc401681b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/pom.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/pom.xml @@ -412,6 +412,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> protoc + 2.5.0 ${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/src/main/proto @@ -436,6 +437,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> protoc + 2.5.0 ${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/src/main/proto @@ -457,6 +459,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> protoc + 2.5.0 ${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/src/main/proto @@ -478,6 +481,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> protoc + 2.5.0 ${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/src/main/proto diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/pom.xml b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/pom.xml index 9cc5b3f5a0a..9fbd8e849c2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/pom.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/pom.xml @@ -103,6 +103,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> protoc + 2.5.0 ${basedir}/../../../../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/../../../../../hadoop-hdfs-project/hadoop-hdfs/src/main/proto diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/pom.xml b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/pom.xml index c6fe8e04ef6..a004915383b 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/pom.xml +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/pom.xml @@ -64,6 +64,7 @@ protoc + 2.5.0 ${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/../../../hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/pom.xml b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/pom.xml index aac52f3680b..6f67a3474ae 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/pom.xml +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/pom.xml @@ -78,6 +78,7 @@ protoc + 2.5.0 ${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto diff --git a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java index 47e97db9ef7..51901ff14d5 100644 --- a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java +++ b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java @@ -48,16 +48,41 @@ public class ProtocMojo extends AbstractMojo { @Parameter(defaultValue="protoc") private String protocCommand; + @Parameter(required=true) + private String protocVersion; public void execute() throws MojoExecutionException { try { + List command = new ArrayList(); + command.add(protocCommand); + command.add("--version"); + Exec exec = new Exec(this); + List out = new ArrayList(); + if (exec.run(command, out) != 0) { + getLog().error("protoc, could not get version"); + for (String s : out) { + getLog().error(s); + } + throw new MojoExecutionException("protoc failure"); + } else { + if (out.size() == 0) { + throw new MojoExecutionException( + "'protoc -version' did not return a version"); + } else { + if (!out.get(0).endsWith(protocVersion)) { + throw new MojoExecutionException( + "protoc version is '" + out.get(0) + "', expected version is '" + + protocVersion + "'"); + } + } + } if (!output.mkdirs()) { if (!output.exists()) { throw new MojoExecutionException("Could not create directory: " + output); } } - List command = new ArrayList(); + command = new ArrayList(); command.add(protocCommand); command.add("--java_out=" + output.getCanonicalPath()); if (imports != null) { @@ -68,8 +93,8 @@ public class ProtocMojo extends AbstractMojo { for (File f : FileSetUtils.convertFileSetToFiles(source)) { command.add(f.getCanonicalPath()); } - Exec exec = new Exec(this); - List out = new ArrayList(); + exec = new Exec(this); + out = new ArrayList(); if (exec.run(command, out) != 0) { getLog().error("protoc compiler error"); for (String s : out) { diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 6ef2d0cac8c..ede89e4dd24 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -58,6 +58,10 @@ ${basedir}/../../hadoop-common-project/hadoop-common/target file:///dev/urandom + + + + 2.5.0 @@ -614,7 +618,7 @@ com.google.protobuf protobuf-java - 2.4.0a + ${protobuf.version} commons-daemon diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/pom.xml index dbf6c0b0702..5990fffe166 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/pom.xml @@ -45,6 +45,7 @@ protoc + 2.5.0 ${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/src/main/proto diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml index ca51ceace7d..5c325ef42ee 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml @@ -73,6 +73,7 @@ protoc + 2.5.0 ${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/../../hadoop-yarn-api/src/main/proto diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/pom.xml index ac1ea95aa1c..e07d07f50b0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/pom.xml @@ -165,6 +165,7 @@ protoc + 2.5.0 ${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/../../hadoop-yarn-api/src/main/proto