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:
parent
cc8ea9bf08
commit
677bbd336d
|
@ -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>
|
||||||
|
|
|
@ -412,6 +412,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>
|
||||||
|
@ -436,6 +437,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>
|
||||||
|
@ -457,6 +459,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>
|
||||||
|
@ -478,6 +481,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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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>
|
||||||
|
@ -614,7 +618,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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue