You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by tu...@apache.org on 2013/08/15 00:25:27 UTC
svn commit: r1514071 - in /hadoop/common/branches/branch-2:
hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java
hadoop-project/pom.xml
Author: tucu
Date: Wed Aug 14 22:25:26 2013
New Revision: 1514071
URL: http://svn.apache.org/r1514071
Log:
HADOOP-9845. Update protobuf to 2.5 from 2.4.x. (tucu)
Modified:
hadoop/common/branches/branch-2/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java
hadoop/common/branches/branch-2/hadoop-project/pom.xml
Modified: hadoop/common/branches/branch-2/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/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java?rev=1514071&r1=1514070&r2=1514071&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java (original)
+++ hadoop/common/branches/branch-2/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocMojo.java Wed Aug 14 22:25:26 2013
@@ -48,16 +48,41 @@ public class ProtocMojo extends Abstract
@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 Abstract
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) {
Modified: hadoop/common/branches/branch-2/hadoop-project/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-project/pom.xml?rev=1514071&r1=1514070&r2=1514071&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-project/pom.xml (original)
+++ hadoop/common/branches/branch-2/hadoop-project/pom.xml Wed Aug 14 22:25:26 2013
@@ -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>