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
This commit is contained in:
Alejandro Abdelnur 2013-08-14 22:25:26 +00:00
parent cc8ea9bf08
commit 677bbd336d
10 changed files with 45 additions and 4 deletions

View File

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

View File

@ -412,6 +412,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<goal>protoc</goal>
</goals>
<configuration>
<protocVersion>2.5.0</protocVersion>
<imports>
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/src/main/proto</param>
@ -436,6 +437,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<goal>protoc</goal>
</goals>
<configuration>
<protocVersion>2.5.0</protocVersion>
<imports>
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/src/main/proto</param>
@ -457,6 +459,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<goal>protoc</goal>
</goals>
<configuration>
<protocVersion>2.5.0</protocVersion>
<imports>
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/src/main/proto</param>
@ -478,6 +481,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
<goal>protoc</goal>
</goals>
<configuration>
<protocVersion>2.5.0</protocVersion>
<imports>
<param>${basedir}/../../hadoop-common-project/hadoop-common/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>
</goals>
<configuration>
<protocVersion>2.5.0</protocVersion>
<imports>
<param>${basedir}/../../../../../hadoop-common-project/hadoop-common/src/main/proto</param>
<param>${basedir}/../../../../../hadoop-hdfs-project/hadoop-hdfs/src/main/proto</param>

View File

@ -64,6 +64,7 @@
<goal>protoc</goal>
</goals>
<configuration>
<protocVersion>2.5.0</protocVersion>
<imports>
<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>

View File

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

View File

@ -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<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.exists()) {
throw new MojoExecutionException("Could not create directory: " +
output);
}
}
List<String> command = new ArrayList<String>();
command = new ArrayList<String>();
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<String> out = new ArrayList<String>();
exec = new Exec(this);
out = new ArrayList<String>();
if (exec.run(command, out) != 0) {
getLog().error("protoc compiler error");
for (String s : out) {

View File

@ -58,6 +58,10 @@
<!-- 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>
<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>
<dependencyManagement>
@ -614,7 +618,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.4.0a</version>
<version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>commons-daemon</groupId>

View File

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

View File

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

View File

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