Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building bookkeeper with gradle on java11 #2817

Merged
merged 6 commits into from
Oct 8, 2021
Merged

Conversation

pradeepbn
Copy link
Contributor

@pradeepbn pradeepbn commented Oct 6, 2021

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

- Use gradle native solution for using javac rather than specifying it via command line in gradle
@mauricebarnum
Copy link
Contributor

An alternative approach to generating JNI headers in a manner that the internal compiler will be aware of the dependencies:
mauricebarnum@049a510

diff --git a/circe-checksum/build.gradle b/circe-checksum/build.gradle
index e581ae6c3..5e03ec932 100644
--- a/circe-checksum/build.gradle
+++ b/circe-checksum/build.gradle
@@ -28,18 +28,8 @@ dependencies {
    testImplementation depLibs.mockito
}

-task generateJniHeaders(type: JavaCompile) {
-    ext {
-        javahOutputDir = "$buildDir/javahGenerated"
-    }
-    classpath = sourceSets.main.compileClasspath
-    destinationDir file("${buildDir}/javahGenerated")
-    source = sourceSets.main.java
-    options.compilerArgs += [
-            '-h', file("${buildDir}/javahGenerated"),
-    ]
-
-    options.annotationProcessorPath = configurations.annotationProcessor
+compileJava {
+    options.headerOutputDirectory = file("${buildDir}/javahGenerated")
}

use compileJava task to generate jni headers
@mauricebarnum
Copy link
Contributor

./gradlew jar -x test worked for me with JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

@pradeepbn
Copy link
Contributor Author

./gradlew jar -x test worked for me with JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

Verified on my local as well. It works.

@mauricebarnum
Copy link
Contributor

rerun failed checks

2 similar comments
@pradeepbn
Copy link
Contributor Author

rerun failed checks

@pkumar-singh
Copy link
Member

rerun failed checks

@pkumar-singh
Copy link
Member

rerun failure checks

1 similar comment
@pkumar-singh
Copy link
Member

rerun failure checks

Copy link
Contributor

@hsaputra hsaputra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@hsaputra
Copy link
Contributor

hsaputra commented Oct 7, 2021

Will merge this by tomorrow EOD if no more comments or concern. Thanks

@hsaputra hsaputra added this to the 4.15.0 milestone Oct 8, 2021
@hsaputra hsaputra merged commit 883231e into apache:master Oct 8, 2021
@hsaputra
Copy link
Contributor

hsaputra commented Oct 8, 2021

The PR is merged. Thanks @pradeepbn for your contribution.

Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024

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: apache#2640



Reviewers: Prashant Kumar <None>, Henry Saputra <[email protected]>, Matteo Merli <[email protected]>

This closes apache#2817 from pradeepbn/java11 and squashes the following commits:

95c19de [pradeepbn] Merge pull request #1 from mauricebarnum/pr-2817-jni
049a510 [maurice barnum] use compileJava task to generate jni headers
f690e90 [Pradeep Nagaraju] Replace javac to use gradle native config
9285c10 [Pradeep Nagaraju] Revert the changes to avoid deprecation of finalize()
22c3cfd [Pradeep Nagaraju] remove unwanted changes
b416059 [Pradeep Nagaraju] - Building bookkeeper with gradle on java11 - Use gradle native solution for using javac rather than specifying it via command line in gradle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants