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

[#1179] feat(build): Make Gravitino build and run against JDK8, 11, 17 #1199

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

jerryshao
Copy link
Contributor

@jerryshao jerryshao commented Dec 19, 2023

What changes were proposed in this pull request?

This PR proposes to add multiple JDK version support for building and running Gravitino server, including JDK8, 11, and 17.

Users could specify the version they want to build in gradle.properties, like:

jdkVersion = 8

or 

jdkVersion = 11

or 

jdkVersion = 17

Or users could specify the version by ./gradlew build -PjdkVersion=8.

Our generated jars are JDK 8 version compatible, so it can run against Java runtime 8, 11, and 17.

Why are the changes needed?

To make Gravitino build, test and run against multiple JDK versions.

Fix: #1179

Does this PR introduce any user-facing change?

No.

How was this patch tested?

This was compiled, tested, run on JDK8, 11, and 17 locally.

@jerryshao jerryshao self-assigned this Dec 19, 2023
@jerryshao jerryshao requested review from xunliu, FANNG1 and yuqi1129 and removed request for xunliu December 19, 2023 02:43
@@ -48,7 +48,7 @@ public static EntitySerDe createEntitySerDe(String name) {
String className = ENTITY_SERDES.getOrDefault(name, name);

try {
return (EntitySerDe) Class.forName(className).newInstance();
return (EntitySerDe) Class.forName(className).getDeclaredConstructor().newInstance();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is deprecated in Java 11+

@@ -253,7 +253,7 @@ public <T> Builder hiddenImpl(Class<T> targetClass, Class<?>... types) {

try {
Constructor<T> hidden = targetClass.getDeclaredConstructor(types);
AccessController.doPrivileged(new MakeAccessible(hidden));
java.security.AccessController.doPrivileged(new MakeAccessible(hidden));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

AccessController is deprecated in JDK17 with no replacement, so currently suppress the warning as a workaround.

@FANNG1
Copy link
Contributor

FANNG1 commented Dec 19, 2023

How do we ensure the PRs by other development works for JDK 11 and 17 since GitHub action runs with JDK 8. Do we verify it before a release?

@jerryshao
Copy link
Contributor Author

I will change the CI to support running on JDK11 and 17 in the next PR.


#jdkVersion is used to specify the version of JDK to build and test against Gravitino, current
# supported version is 8, 11, and 17.
jdkVersion = 8
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the value of jdkVersion differs from that of the JDK installed actually?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the same as before, if the specified jdkVersion is not installed locally, it will download automatically by gradle.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean if the value of jdkVersion is 8 and the JDK you installed is JDK11 or JDK17, so the final behavior is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it will build, test against jdk8, no matter which version you installed in your environment.

@FANNG1
Copy link
Contributor

FANNG1 commented Dec 19, 2023

I will change the CI to support running on JDK11 and 17 in the next PR.

I'm afraid of CI time bombs, I prefer to test on JDK 11 and 17 before release since there're few JDK compatiable issues.

@yuqi1129
Copy link
Contributor

I will change the CI to support running on JDK11 and 17 in the next PR.

I'm afraid of CI time bombs, I prefer to test on JDK 11 and 17 before release since there're few JDK compatiable issues.

Agreed, we can test locally and make sure it's okay to use 8, 11, and 17. Adding them to CI may make it difficult to develop in Git Hub.

@jerryshao
Copy link
Contributor Author

I will make the

I will change the CI to support running on JDK11 and 17 in the next PR.

I'm afraid of CI time bombs, I prefer to test on JDK 11 and 17 before release since there're few JDK compatiable issues.

Agreed, we can test locally and make sure it's okay to use 8, 11, and 17. Adding them to CI may make it difficult to develop in Git Hub.

I will take a try to enable all the CI matrix, if it is too long, I'll see how to handle this.

@jerryshao jerryshao merged commit 2477685 into apache:main Dec 19, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Subtask] Make Gravitino build and run on JDK 11, 17
3 participants