From 6ddff24ba986fd741c7167fc6af6865a786b2d0f Mon Sep 17 00:00:00 2001 From: Mike Drob Date: Wed, 11 Apr 2018 21:25:04 -0500 Subject: [PATCH] HBASE-20356 Make skipping protoc possible --- dev-support/hbase-personality.sh | 2 +- hbase-protocol-shaded/pom.xml | 5 ++++- hbase-protocol/pom.xml | 5 ++++- src/main/asciidoc/_chapters/developer.adoc | 28 +++++++++++++++++++++++----- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh index 90786f2910..3507a1d8de 100755 --- a/dev-support/hbase-personality.sh +++ b/dev-support/hbase-personality.sh @@ -554,7 +554,7 @@ function hbaseprotoc_rebuild # Need to run 'install' instead of 'compile' because shading plugin # is hooked-up to 'install'; else hbase-protocol-shaded is left with # half of its process done. - modules_workers patch hbaseprotoc install -DskipTests -Pcompile-protobuf -X -DHBasePatchProcess + modules_workers patch hbaseprotoc install -DskipTests -X -DHBasePatchProcess # shellcheck disable=SC2153 until [[ $i -eq "${#MODULE[@]}" ]]; do diff --git a/hbase-protocol-shaded/pom.xml b/hbase-protocol-shaded/pom.xml index 021e424843..25443e1830 100644 --- a/hbase-protocol-shaded/pom.xml +++ b/hbase-protocol-shaded/pom.xml @@ -106,7 +106,7 @@ 1.5.3 - generate-sources + process-sources replace @@ -117,6 +117,9 @@ **/*.java + + true ([^\.])com.google.protobuf diff --git a/hbase-protocol/pom.xml b/hbase-protocol/pom.xml index e6d546e6e3..bfe2588712 100644 --- a/hbase-protocol/pom.xml +++ b/hbase-protocol/pom.xml @@ -81,7 +81,7 @@ 1.5.3 - generate-sources + process-sources replace @@ -92,6 +92,9 @@ **/*.java + + true (public)(\W+static)?(\W+final)?(\W+class) diff --git a/src/main/asciidoc/_chapters/developer.adoc b/src/main/asciidoc/_chapters/developer.adoc index 48dc79eef2..9d9f564657 100644 --- a/src/main/asciidoc/_chapters/developer.adoc +++ b/src/main/asciidoc/_chapters/developer.adoc @@ -415,22 +415,40 @@ use so we can freely change versions without upsetting any downstream project us The protobuf files are located in _hbase-protocol/src/main/protobuf_. For the change to be effective, you will need to regenerate the classes. -You can use maven profile `compile-protobuf` to do this. [source,bourne] ---- -mvn compile -Pcompile-protobuf +mvn package -pl hbase-protocol -am ---- -You may also want to define `protoc.path` for the protoc binary, using the following command: +Similarly, protobuf definitions for internal use are located in the _hbase-protocol-shaded_ module. [source,bourne] ---- +mvn package -pl hbase-protocol-shaded -am +---- + +Typically, protobuf code generation is done using the native `protoc` binary. In our build we use a maven plugin for +convenience; however, the plugin may not be able to retrieve appropriate binaries for all platforms. If you find yourself +on a platform where protoc fails, you will have to compile protoc from source, and run it independent of our maven build. +You can disable the inline code generation by specifying `-Dprotoc.skip` in your maven arguments, allowing your build to proceed further. + +A similar failure relates to the stock CentOS 6 docker image providing a too old version of glibc for the version of protoc that we use. +In this case, you would have to install glibc 2.14 and protoc 3.5.1 manually, then execute something like: -mvn compile -Pcompile-protobuf -Dprotoc.path=/opt/local/bin/protoc +[source,bourne] +---- +cd hbase-protocol-shaded +LD_LIBRARY_PATH=/opt/glibc-2.14/lib protoc \ + --proto_path=src/main/protobuf \ + --java_out=target/generated-sources/protobuf/java \ + src/main/protobuf/*.proto ---- -Read the _hbase-protocol/README.txt_ for more details. +[NOTE] +If you need to manually generate your protobuf files, you should not use `clean` in subsequent maven calls, as that will delete the newly generated files. + +Read the _hbase-protocol/README.txt_ for more details [[build.thrift]] ==== Build Thrift -- 2.16.1