Repository: kudu Updated Branches: refs/heads/master 26ef33602 -> fb512261f
java: fix kudu-client builds with TSAN-only thirdparty This turned out to be somewhat messy as only newer versions of maven[1] allow profile activation when multiple conditions are true. I tested this via repeated calls to "mvn help:active-profiles" and "mvn clean compile" while hiding various combinations of my tsan, uninstrumented, and system protoc executables. 1. https://issues.apache.org/jira/browse/MNG-4565 Change-Id: I580d69507abf0e486fc8f3f364177d0a60b6382b Reviewed-on: http://gerrit.cloudera.org:8080/4577 Tested-by: Adar Dembo <[email protected]> Reviewed-by: Jean-Daniel Cryans <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/fb512261 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/fb512261 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/fb512261 Branch: refs/heads/master Commit: fb512261fcc322e8fdb2a2489db68d892d4beeba Parents: 26ef336 Author: Adar Dembo <[email protected]> Authored: Fri Sep 30 14:06:29 2016 -0700 Committer: Jean-Daniel Cryans <[email protected]> Committed: Mon Oct 3 22:29:37 2016 +0000 ---------------------------------------------------------------------- java/kudu-client/pom.xml | 80 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/fb512261/java/kudu-client/pom.xml ---------------------------------------------------------------------- diff --git a/java/kudu-client/pom.xml b/java/kudu-client/pom.xml index 8619787..823dc15 100644 --- a/java/kudu-client/pom.xml +++ b/java/kudu-client/pom.xml @@ -116,16 +116,6 @@ http://sergei-ivanov.github.io/maven-protoc-plugin/compile-mojo.html --> <checkStaleness>true</checkStaleness> <protoSourceRoot>${project.basedir}/../../src</protoSourceRoot> - <protocExecutable> - ${project.basedir}/../../thirdparty/installed/uninstrumented/bin/protoc - </protocExecutable> - <!-- Where we'll look for built-in .proto files such as - google/protobuf/descriptor.proto. --> - <additionalProtoPathElements> - <additionalProtoPathElement> - ${project.basedir}/../../thirdparty/installed/uninstrumented/include - </additionalProtoPathElement> - </additionalProtoPathElements> <excludes> <exclude>**/*test*.proto</exclude> </excludes> @@ -154,6 +144,8 @@ <goal>clean</goal> </goals> <configuration> + <!-- Additional configuration (e.g. the location of protoc) + is done via maven profiles later in the file. --> <excludeDefaultDirectories>true</excludeDefaultDirectories> <filesets> <fileset> @@ -315,14 +307,49 @@ </pluginManagement> </build> + <!-- Find a protoc with which to compile the .proto files. + + This is done via maven profiles. The order of activation: + 1. Use TSAN protoc if it exists. + 2. Use uninstrumented protoc if it exists. + 3. Use system protoc if no other profile was activated. + + If both TSAN and uninstrumented protoc exist, the latter will override + the former by virtue of being activated after it, which is why the + profile declaration order is important. --> <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> + <id>protoc-tsan</id> + <activation> + <file> + <exists>${basedir}/../../thirdparty/installed/tsan/bin/protoc</exists> + </file> + </activation> + <build> + <plugins> + <plugin> + <groupId>com.google.protobuf.tools</groupId> + <artifactId>maven-protoc-plugin</artifactId> + <version>${maven-protoc-plugin.version}</version> + <configuration> + <protocExecutable> + ${project.basedir}/../../thirdparty/installed/tsan/bin/protoc + </protocExecutable> + <additionalProtoPathElements> + <additionalProtoPathElement> + ${project.basedir}/../../thirdparty/installed/tsan/include + </additionalProtoPathElement> + </additionalProtoPathElements> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>protoc-uninstrumented</id> <activation> <file> - <missing>${basedir}/../../thirdparty/installed/uninstrumented/bin/protoc</missing> + <exists>${basedir}/../../thirdparty/installed/uninstrumented/bin/protoc</exists> </file> </activation> <build> @@ -332,6 +359,31 @@ <artifactId>maven-protoc-plugin</artifactId> <version>${maven-protoc-plugin.version}</version> <configuration> + <protocExecutable> + ${project.basedir}/../../thirdparty/installed/uninstrumented/bin/protoc + </protocExecutable> + <additionalProtoPathElements> + <additionalProtoPathElement> + ${project.basedir}/../../thirdparty/installed/uninstrumented/include + </additionalProtoPathElement> + </additionalProtoPathElements> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>protoc-system</id> + <activation> + <activeByDefault>true</activeByDefault> + </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>
