This is an automated email from the ASF dual-hosted git repository.
hsaputra pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 883231e Building bookkeeper with gradle on java11
883231e is described below
commit 883231ec8be26b9b118db5a2df3651cff840d322
Author: pradeepbn <[email protected]>
AuthorDate: Fri Oct 8 09:58:06 2021 -0700
Building bookkeeper with gradle on java11
Descriptions of the changes in this PR:
### Motivation
This change enable gradle to build on java11
### Changes
- generateJniHeaders for CpuAffinity using native gradle config rather than
using javac rather than specifying it via command line in gradle
- Update gradle dependencies that helps build java11
- Update checkstyle to use native configurations from gradle
Master Issue: #2640
Reviewers: Prashant Kumar <None>, Henry Saputra <[email protected]>,
Matteo Merli <[email protected]>
This closes #2817 from pradeepbn/java11 and squashes the following commits:
95c19de0d [pradeepbn] Merge pull request #1 from mauricebarnum/pr-2817-jni
049a510b9 [maurice barnum] use compileJava task to generate jni headers
f690e90e4 [Pradeep Nagaraju] Replace javac to use gradle native config
9285c10a0 [Pradeep Nagaraju] Revert the changes to avoid deprecation of
finalize()
22c3cfd5a [Pradeep Nagaraju] remove unwanted changes
b41605931 [Pradeep Nagaraju] - Building bookkeeper with gradle on java11 -
Use gradle native solution for using javac rather than specifying it via
command line in gradle
---
build.gradle | 1 +
buildtools/src/main/resources/bookkeeper/checkstyle.xml | 2 +-
circe-checksum/build.gradle | 10 ++--------
circe-checksum/src/main/circe/build.gradle | 4 ++--
cpu-affinity/build.gradle | 16 ++++++----------
cpu-affinity/src/main/affinity/build.gradle | 4 ++--
dependencies.gradle | 2 ++
stream/distributedlog/core/build.gradle | 1 +
stream/proto/build.gradle | 1 +
stream/server/build.gradle | 1 +
stream/tests-common/build.gradle | 1 +
11 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/build.gradle b/build.gradle
index 6bb45a6..6373c77 100644
--- a/build.gradle
+++ b/build.gradle
@@ -73,6 +73,7 @@ allprojects {
checkstyle {
toolVersion "${checkStyleVersion}"
configFile
file("$rootDir/buildtools/src/main/resources/bookkeeper/checkstyle.xml")
+ configDirectory =
file("$rootDir/buildtools/src/main/resources/bookkeeper")
checkstyleMain {
source ='src/main/java'
}
diff --git a/buildtools/src/main/resources/bookkeeper/checkstyle.xml
b/buildtools/src/main/resources/bookkeeper/checkstyle.xml
index b79bfdd..fda4fb6 100644
--- a/buildtools/src/main/resources/bookkeeper/checkstyle.xml
+++ b/buildtools/src/main/resources/bookkeeper/checkstyle.xml
@@ -60,7 +60,7 @@ page at http://checkstyle.sourceforge.net/config.html -->
<property name="checkFormat" value="$1"/>
</module>
<module name="SuppressionFilter">
- <property name="file" value="${checkstyle.suppressions.file}"
default="./buildtools/src/main/resources/bookkeeper/suppressions.xml" />
+ <property name="file" value="${config_loc}/suppressions.xml"
default="./buildtools/src/main/resources/bookkeeper/suppressions.xml" />
</module>
<!-- Check that every module has a package-info.java -->
diff --git a/circe-checksum/build.gradle b/circe-checksum/build.gradle
index 17258fe..5e03ec9 100644
--- a/circe-checksum/build.gradle
+++ b/circe-checksum/build.gradle
@@ -28,14 +28,8 @@ dependencies {
testImplementation depLibs.mockito
}
-task generateJniHeaders(type:Exec) {
- ext {
- javahOutputDir = "$buildDir/javahGenerated"
- }
- dependsOn classes
- def classpath = sourceSets.main.output.classesDirs.join(":")
- commandLine("javah", "-d", javahOutputDir, "-classpath",
- classpath, "com.scurrilous.circe.crc.Sse42Crc32C")
+compileJava {
+ options.headerOutputDirectory = file("${buildDir}/javahGenerated")
}
jar {
diff --git a/circe-checksum/src/main/circe/build.gradle
b/circe-checksum/src/main/circe/build.gradle
index 5b49ba8..0a35c87 100644
--- a/circe-checksum/src/main/circe/build.gradle
+++ b/circe-checksum/src/main/circe/build.gradle
@@ -27,9 +27,9 @@ library {
binaries.configureEach { CppBinary binary ->
def compileTask = binary.compileTask.get()
- compileTask.dependsOn project(':circe-checksum').generateJniHeaders
+ compileTask.dependsOn project(':circe-checksum').compileJava
compileTask.includes.from("${Jvm.current().javaHome}/include",
-
project(':circe-checksum').generateJniHeaders.javahOutputDir)
+
project(':circe-checksum').compileJava.options.headerOutputDirectory)
def osFamily =
binary.targetPlatform.targetMachine.operatingSystemFamily
diff --git a/cpu-affinity/build.gradle b/cpu-affinity/build.gradle
index 981fd6d..750f7a2 100644
--- a/cpu-affinity/build.gradle
+++ b/cpu-affinity/build.gradle
@@ -16,29 +16,25 @@
* specific language governing permissions and limitations
* under the License.
*/
+
plugins {
id 'java'
}
dependencies {
- compileOnly depLibs.lombok
compileOnly depLibs.spotbugsAnnotations
implementation depLibs.commonsLang3
implementation depLibs.guava
implementation depLibs.slf4j
testImplementation depLibs.junit
-
+ compileOnly depLibs.lombok
annotationProcessor depLibs.lombok
+ testCompileOnly depLibs.lombok
+ testAnnotationProcessor depLibs.lombok
}
-task generateJniHeaders(type:Exec) {
- ext {
- javahOutputDir = "$buildDir/javahGenerated"
- }
- dependsOn classes
- def classpath = sourceSets.main.output.classesDirs.join(":")
- commandLine("javah", "-d", javahOutputDir, "-classpath",
- classpath,
"org.apache.bookkeeper.common.util.affinity.impl.CpuAffinityJni")
+compileJava {
+ options.headerOutputDirectory = file("${buildDir}/javahGenerated")
}
jar {
diff --git a/cpu-affinity/src/main/affinity/build.gradle
b/cpu-affinity/src/main/affinity/build.gradle
index 2e44423..49868c0 100644
--- a/cpu-affinity/src/main/affinity/build.gradle
+++ b/cpu-affinity/src/main/affinity/build.gradle
@@ -25,9 +25,9 @@ plugins {
library {
binaries.configureEach { CppBinary binary ->
def compileTask = binary.compileTask.get()
- compileTask.dependsOn project(':cpu-affinity').generateJniHeaders
+ compileTask.dependsOn project(':cpu-affinity').compileJava
compileTask.includes.from("${Jvm.current().javaHome}/include",
-
project(':cpu-affinity').generateJniHeaders.javahOutputDir)
+
project(':cpu-affinity').compileJava.options.headerOutputDirectory)
def osFamily =
binary.targetPlatform.targetMachine.operatingSystemFamily
diff --git a/dependencies.gradle b/dependencies.gradle
index 1f34a81..aee92d7 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -48,6 +48,7 @@ depVersions = [
hdrhistogram: "2.1.4",
httpclient: "4.5.13",
jackson: "2.11.1",
+ javaAnnotations:"1.3.2",
jcommander: "1.78",
jctools: "2.1.2",
jetty: "9.4.31.v20200723",
@@ -111,6 +112,7 @@ depLibs = [
hamcrest: "org.hamcrest:hamcrest-all:${depVersions.hamcrest}",
httpclient:
"org.apache.httpcomponents:httpclient:${depVersions.httpclient}",
jacksonAnnotations:
"com.fasterxml.jackson.core:jackson-annotations:${depVersions.jackson}",
+ javaAnnotations:
"javax.annotation:javax.annotation-api:${depVersions.javaAnnotations}",
jacksonCore:
"com.fasterxml.jackson.core:jackson-core:${depVersions.jackson}",
jacksonDatabind:
"com.fasterxml.jackson.core:jackson-databind:${depVersions.jackson}",
jcommander: "com.beust:jcommander:${depVersions.jcommander}",
diff --git a/stream/distributedlog/core/build.gradle
b/stream/distributedlog/core/build.gradle
index e4a65ea..ca73937 100644
--- a/stream/distributedlog/core/build.gradle
+++ b/stream/distributedlog/core/build.gradle
@@ -49,6 +49,7 @@ dependencies {
testImplementation project(path: ':stream:distributedlog:common',
configuration: 'testArtifacts')
testImplementation depLibs.junit
testImplementation depLibs.mockito
+ implementation depLibs.javaAnnotations
annotationProcessor depLibs.lombok
testAnnotationProcessor depLibs.lombok
diff --git a/stream/proto/build.gradle b/stream/proto/build.gradle
index cd90529..cc27288 100644
--- a/stream/proto/build.gradle
+++ b/stream/proto/build.gradle
@@ -25,6 +25,7 @@ dependencies {
implementation depLibs.lombok
implementation depLibs.grpc
implementation depLibs.commonsLang3
+ implementation depLibs.javaAnnotations
annotationProcessor depLibs.lombok
}
diff --git a/stream/server/build.gradle b/stream/server/build.gradle
index 08f2403..7eb3510 100644
--- a/stream/server/build.gradle
+++ b/stream/server/build.gradle
@@ -55,6 +55,7 @@ dependencies {
runtimeOnly depLibs.vertxCore
runtimeOnly depLibs.vertxWeb
testImplementation depLibs.mockito
+ implementation depLibs.javaAnnotations
annotationProcessor depLibs.lombok
}
diff --git a/stream/tests-common/build.gradle b/stream/tests-common/build.gradle
index f3c33c7..5259cd6 100644
--- a/stream/tests-common/build.gradle
+++ b/stream/tests-common/build.gradle
@@ -26,6 +26,7 @@ dependencies {
implementation depLibs.slf4j
annotationProcessor depLibs.lombok
+ implementation depLibs.javaAnnotations
}
protobuf {