You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by jd...@apache.org on 2016/02/26 22:22:57 UTC
[2/4] incubator-kudu git commit: java: fix fallback to system protoc
java: fix fallback to system protoc
This used to work, but broke in commit 65b7e5b with the introduction of
additionalProtoPathelements. The new approach uses an automatically
activated maven profile which obviates the need for the protoc wrapper
script.
Change-Id: I9f307844b455667f87b56df4e12b27b39344aa71
Reviewed-on: http://gerrit.cloudera.org:8080/2321
Reviewed-by: Jean-Daniel Cryans
Tested-by: Adar Dembo <ad...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/7a0244c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/7a0244c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/7a0244c8
Branch: refs/heads/master
Commit: 7a0244c8c539dd800b7269c32a6826d2fdad43d9
Parents: d43a91f
Author: Adar Dembo <ad...@cloudera.com>
Authored: Thu Feb 25 17:49:37 2016 -0800
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Fri Feb 26 02:50:28 2016 +0000
----------------------------------------------------------------------
java/kudu-client/dev-support/build-proto.sh | 36 ------------------------
java/kudu-client/pom.xml | 35 ++++++++++++++++++++++-
2 files changed, 34 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/7a0244c8/java/kudu-client/dev-support/build-proto.sh
----------------------------------------------------------------------
diff --git a/java/kudu-client/dev-support/build-proto.sh b/java/kudu-client/dev-support/build-proto.sh
deleted file mode 100755
index 9a03a0b..0000000
--- a/java/kudu-client/dev-support/build-proto.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-##
-# Script to find and run protoc to generate protocol buf files.
-# Should be used exclusively by Maven.
-#
-
-KUDU_DIR=`dirname $0`/../../..
-PROTOC_BIN=$KUDU_DIR/thirdparty/installed-deps/bin/protoc
-if [ ! -f "$PROTOC_BIN" ] ; then
- if which protoc > /dev/null; then
- PROTOC_BIN=`which protoc`
- else
- echo 'Error: protoc is missing from the 3rd party folder and on the PATH'
- exit 1
- fi
-fi
-
-$PROTOC_BIN "$@"
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/7a0244c8/java/kudu-client/pom.xml
----------------------------------------------------------------------
diff --git a/java/kudu-client/pom.xml b/java/kudu-client/pom.xml
index 666f494..112b441 100644
--- a/java/kudu-client/pom.xml
+++ b/java/kudu-client/pom.xml
@@ -110,7 +110,11 @@
http://sergei-ivanov.github.io/maven-protoc-plugin/compile-mojo.html -->
<checkStaleness>true</checkStaleness>
<protoSourceRoot>${project.basedir}/../../src</protoSourceRoot>
- <protocExecutable>${project.basedir}/dev-support/build-proto.sh</protocExecutable>
+ <protocExecutable>
+ ${project.basedir}/../../thirdparty/installed-deps/bin/protoc
+ </protocExecutable>
+ <!-- Where we'll look for built-in .proto files such as
+ google/protobuf/descriptor.proto. -->
<additionalProtoPathElements>
<additionalProtoPathElement>
${project.basedir}/../../thirdparty/installed-deps/include
@@ -299,4 +303,33 @@
</plugins>
</pluginManagement>
</build>
+
+ <profiles>
+ <!-- If thirdparty's protoc can't be found, this profile will activate and
+ use the system's protoc during the build. -->
+ <profile>
+ <id>protoc-system</id>
+ <activation>
+ <file>
+ <missing>${basedir}/../../thirdparty/installed-deps/bin/protoc</missing>
+ </file>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.google.protobuf.tools</groupId>
+ <artifactId>maven-protoc-plugin</artifactId>
+ <version>${maven-protoc-plugin.version}</version>
+ <configuration>
+ <protocExecutable>protoc</protocExecutable>
+ <additionalProtoPathElements>
+ <additionalProtoPathElement>/usr/include</additionalProtoPathElement>
+ <additionalProtoPathElement>/usr/local/include</additionalProtoPathElement>
+ </additionalProtoPathElements>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>