This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 2a02629d8a2f06fbb063b57b0a539dd7cc9c02c8
Author: Grant Henke <[email protected]>
AuthorDate: Thu Jan 14 12:38:31 2021 -0600

    [build] Separate protobuf java compilation into a seperate module
    
    Currently we compile the protobufs in both the kudu-client
    and the kudu-subprocess. Doing this also combines them onto
    the same classpath as the module itself.
    
    This patch breaks those classes into a separate `kudu-proto`
    module so that we can avoid duplicate work and ignore
    the `kudu-proto` module in API compatibility and test
    coverage checks.
    
    This module is not published, so there is no net change to the final
    artifacts.
    
    Change-Id: Ib83db74c4a09cdd597bee90f5124ed804adac42d
    Reviewed-on: http://gerrit.cloudera.org:8080/16953
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <[email protected]>
---
 build-support/check_compatibility.py              |  1 +
 java/kudu-client/build.gradle                     | 14 +-------
 java/{settings.gradle => kudu-proto/build.gradle} | 39 ++++++++++++++---------
 java/kudu-subprocess/build.gradle                 | 14 +-------
 java/settings.gradle                              |  1 +
 5 files changed, 28 insertions(+), 41 deletions(-)

diff --git a/build-support/check_compatibility.py 
b/build-support/check_compatibility.py
index 52e82b4..24762cc 100755
--- a/build-support/check_compatibility.py
+++ b/build-support/check_compatibility.py
@@ -132,6 +132,7 @@ def find_client_jars(path):
       "kudu-backup" not in j and
       "kudu-hive" not in j and
       "kudu-jepsen" not in j and
+      "kudu-proto" not in j and
       "kudu-subprocess" not in j)]
 
 
diff --git a/java/kudu-client/build.gradle b/java/kudu-client/build.gradle
index 8e655ff..082b7d9 100644
--- a/java/kudu-client/build.gradle
+++ b/java/kudu-client/build.gradle
@@ -15,11 +15,11 @@
 // specific language governing permissions and limitations
 // under the License.
 
-apply from: "$rootDir/gradle/protobuf.gradle"
 apply from: "$rootDir/gradle/shadow.gradle"
 apply from: "$rootDir/gradle/benchmarks.gradle"
 
 dependencies {
+  compile project(path: ":kudu-proto")
   // Not shaded in the client JAR because it's part of the public API.
   compileUnshaded(libs.async) {
     // async uses versions ranges for slf4j making builds non-deterministic.
@@ -32,7 +32,6 @@ dependencies {
   compile libs.micrometerCore
   compile libs.murmur
   compile libs.netty
-  compile libs.protobufJava
 
   optional libs.jsr305
   optional libs.yetusAnnotations
@@ -44,14 +43,3 @@ dependencies {
   testCompile libs.log4jSlf4jImpl
   testCompile libs.mockitoCore
 }
-
-// Add protobuf files to the proto source set.
-sourceSets {
-  main {
-    proto {
-      srcDir "${project.rootDir}/../src"
-      // Excluded any test proto files
-      exclude "**/*test*.proto"
-    }
-  }
-}
diff --git a/java/settings.gradle b/java/kudu-proto/build.gradle
similarity index 61%
copy from java/settings.gradle
copy to java/kudu-proto/build.gradle
index a6c3355..c32cad4 100644
--- a/java/settings.gradle
+++ b/java/kudu-proto/build.gradle
@@ -15,19 +15,28 @@
 // specific language governing permissions and limitations
 // under the License.
 
-// This file contains the configuration of the project hierarchy.
-// Mainly we just define what subprojects are in the build.
+apply from: "$rootDir/gradle/protobuf.gradle"
 
-rootProject.name = "kudu-parent"
-include "kudu-backup"
-include "kudu-backup-common"
-include "kudu-backup-tools"
-include "kudu-client"
-include "kudu-client-tools"
-include "kudu-hive"
-include "kudu-jepsen"
-include "kudu-mapreduce"
-include "kudu-spark"
-include "kudu-spark-tools"
-include "kudu-subprocess"
-include "kudu-test-utils"
+dependencies {
+  compile libs.protobufJava
+}
+
+// Add protobuf files to the proto source set.
+sourceSets {
+  main {
+    proto {
+      srcDir "${project.rootDir}/../src"
+      // Excluded any test proto files
+      exclude "**/*test*.proto"
+    }
+  }
+}
+
+// kudu-proto has no public Javadoc.
+javadoc {
+  enabled = false
+}
+
+// Skip publishing kudu-proto artifact because it will always be shaded into 
kudu-client.
+uploadArchives.enabled = false
+install.enabled = false
diff --git a/java/kudu-subprocess/build.gradle 
b/java/kudu-subprocess/build.gradle
index 45360aa..bef4ead 100644
--- a/java/kudu-subprocess/build.gradle
+++ b/java/kudu-subprocess/build.gradle
@@ -15,13 +15,13 @@
 // specific language governing permissions and limitations
 // under the License.
 
-apply from: "$rootDir/gradle/protobuf.gradle"
 apply from: "$rootDir/gradle/shadow.gradle"
 
 // Explicitly allow slf4j to be included in this jar.
 shadowIncludeSlf4j = true
 
 dependencies {
+  compile project(path: ":kudu-proto")
   compile(libs.hadoopCommon) {
     // hadoopCommon and rangerPlugin use different versions of jersey.
     exclude group: "com.sun.jersey"
@@ -29,7 +29,6 @@ dependencies {
     exclude group: "log4j"
     exclude group: "org.slf4j"
   }
-  compile libs.protobufJava
   compile libs.protobufJavaUtil
 
   compile(libs.rangerPlugin) {
@@ -54,17 +53,6 @@ dependencies {
   testCompile libs.mockitoCore
 }
 
-// Add protobuf files to the proto source set.
-sourceSets {
-  main {
-    proto {
-      srcDir "${project.rootDir}/../src"
-      // Excluded any test proto files
-      exclude "**/*test*.proto"
-    }
-  }
-}
-
 // kudu-subprocess has no public Javadoc.
 javadoc {
   enabled = false
diff --git a/java/settings.gradle b/java/settings.gradle
index a6c3355..0fd3ebc 100644
--- a/java/settings.gradle
+++ b/java/settings.gradle
@@ -27,6 +27,7 @@ include "kudu-client-tools"
 include "kudu-hive"
 include "kudu-jepsen"
 include "kudu-mapreduce"
+include "kudu-proto"
 include "kudu-spark"
 include "kudu-spark-tools"
 include "kudu-subprocess"

Reply via email to