HADOOP-9845. Update protobuf to 2.5 from 2.4.x. (tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1513281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2013-08-12 22:15:10 +00:00
parent 4744075d4f
commit 19b36f0900
11 changed files with 47 additions and 4 deletions

View File

@ -105,6 +105,8 @@ Trunk (Unreleased)
HADOOP-9833 move slf4j to version 1.7.5 (Kousuke Saruta via stevel) HADOOP-9833 move slf4j to version 1.7.5 (Kousuke Saruta via stevel)
HADOOP-9845. Update protobuf to 2.5 from 2.4.x. (tucu)
BUG FIXES BUG FIXES
HADOOP-9451. Fault single-layer config if node group topology is enabled. HADOOP-9451. Fault single-layer config if node group topology is enabled.

View File

@ -308,6 +308,7 @@
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>${protobuf.version}</protocVersion>
<imports> <imports>
<param>${basedir}/src/main/proto</param> <param>${basedir}/src/main/proto</param>
</imports> </imports>
@ -336,6 +337,7 @@
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>${protobuf.version}</protocVersion>
<imports> <imports>
<param>${basedir}/src/test/proto</param> <param>${basedir}/src/test/proto</param>
</imports> </imports>

View File

@ -417,6 +417,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param> <param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/src/main/proto</param> <param>${basedir}/src/main/proto</param>
@ -441,6 +442,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param> <param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/src/main/proto</param> <param>${basedir}/src/main/proto</param>
@ -462,6 +464,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param> <param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/src/main/proto</param> <param>${basedir}/src/main/proto</param>
@ -483,6 +486,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param> <param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/src/main/proto</param> <param>${basedir}/src/main/proto</param>

View File

@ -103,6 +103,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param>${basedir}/../../../../../hadoop-common-project/hadoop-common/src/main/proto</param> <param>${basedir}/../../../../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/../../../../../hadoop-hdfs-project/hadoop-hdfs/src/main/proto</param> <param>${basedir}/../../../../../hadoop-hdfs-project/hadoop-hdfs/src/main/proto</param>

View File

@ -64,6 +64,7 @@
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param>${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto</param> <param>${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/../../../hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto</param> <param>${basedir}/../../../hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto</param>

View File

@ -78,6 +78,7 @@
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param> <param>
${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto ${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto

View File

@ -48,16 +48,41 @@ public class ProtocMojo extends AbstractMojo {
@Parameter(defaultValue="protoc") @Parameter(defaultValue="protoc")
private String protocCommand; private String protocCommand;
@Parameter(required=true)
private String protocVersion;
public void execute() throws MojoExecutionException { public void execute() throws MojoExecutionException {
try { try {
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);
}
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.mkdirs()) {
if (!output.exists()) { if (!output.exists()) {
throw new MojoExecutionException("Could not create directory: " + throw new MojoExecutionException("Could not create directory: " +
output); output);
} }
} }
List<String> command = new ArrayList<String>(); command = new ArrayList<String>();
command.add(protocCommand); command.add(protocCommand);
command.add("--java_out=" + output.getCanonicalPath()); command.add("--java_out=" + output.getCanonicalPath());
if (imports != null) { if (imports != null) {
@ -68,8 +93,8 @@ public class ProtocMojo extends AbstractMojo {
for (File f : FileSetUtils.convertFileSetToFiles(source)) { for (File f : FileSetUtils.convertFileSetToFiles(source)) {
command.add(f.getCanonicalPath()); command.add(f.getCanonicalPath());
} }
Exec exec = new Exec(this); exec = new Exec(this);
List<String> out = new ArrayList<String>(); out = new ArrayList<String>();
if (exec.run(command, out) != 0) { if (exec.run(command, out) != 0) {
getLog().error("protoc compiler error"); getLog().error("protoc compiler error");
for (String s : out) { for (String s : out) {

View File

@ -58,6 +58,10 @@
<!-- at different nesting levels in the source tree may need to override. --> <!-- at different nesting levels in the source tree may need to override. -->
<hadoop.common.build.dir>${basedir}/../../hadoop-common-project/hadoop-common/target</hadoop.common.build.dir> <hadoop.common.build.dir>${basedir}/../../hadoop-common-project/hadoop-common/target</hadoop.common.build.dir>
<java.security.egd>file:///dev/urandom</java.security.egd> <java.security.egd>file:///dev/urandom</java.security.egd>
<!-- ProtocolBuffer version, used to verify the protoc version and -->
<!-- define the protobuf JAR version -->
<protobuf.version>2.5.0</protobuf.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -609,7 +613,7 @@
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>
<version>2.4.0a</version> <version>${protobuf.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-daemon</groupId> <groupId>commons-daemon</groupId>

View File

@ -45,6 +45,7 @@
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param>${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto</param> <param>${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/src/main/proto</param> <param>${basedir}/src/main/proto</param>

View File

@ -73,6 +73,7 @@
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param>${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto</param> <param>${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/../../hadoop-yarn-api/src/main/proto</param> <param>${basedir}/../../hadoop-yarn-api/src/main/proto</param>

View File

@ -165,6 +165,7 @@
<goal>protoc</goal> <goal>protoc</goal>
</goals> </goals>
<configuration> <configuration>
<protocVersion>2.5.0</protocVersion>
<imports> <imports>
<param>${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto</param> <param>${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/../../hadoop-yarn-api/src/main/proto</param> <param>${basedir}/../../hadoop-yarn-api/src/main/proto</param>