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

Fix: Java 18+ Builds #7087

Closed
wants to merge 2 commits into from
Closed

Conversation

sgammon
Copy link
Contributor

@sgammon sgammon commented Mar 8, 2024

Summary

Amends the build to be compatible with JDKs newer than 18. Adds JDK21 to the CI matrix.

Related issues

Changelog

  • fix: build against embedded jdk sources needs --enable-preview when built against jvm21
  • fix: add -Djava.security.manager=allow to fix security manager tests under modern java
  • fix: upgrade asm → latest
  • chore: add jvm21 to ci

android/pom.xml Show resolved Hide resolved
android/pom.xml Outdated Show resolved Hide resolved
android/pom.xml Outdated Show resolved Hide resolved
guava/pom.xml Outdated Show resolved Hide resolved
pom.xml Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
@sgammon
Copy link
Contributor Author

sgammon commented Mar 8, 2024

cc / @cpovirk Sorry for the flood of tags; this first one is ready to go for review.

Copy link
Member

@cpovirk cpovirk left a comment

Choose a reason for hiding this comment

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

Thanks, I think this looks good. Just one question below, and then I'll see about getting it submitted internally and mirrored out.

(The flood of mentions is fine with me. I'll try to keep up as best I can, but I can say in advance that I won't be as on top of things as I'd like at the moment.)

guava/pom.xml Outdated Show resolved Hide resolved
@cpovirk cpovirk self-assigned this Mar 8, 2024
@cpovirk cpovirk added type=other Miscellaneous activities not covered by other type= labels package=general P2 labels Mar 8, 2024
@sgammon
Copy link
Contributor Author

sgammon commented Mar 8, 2024

@cpovirk Thanks for the quick review! I'll see if I can run down that additionalJOption property. Seems like it can be simplified. In the meantime, could you approve CI workflows? I want to make sure I didn't break anything.

I don't think I did, I run the actions on my fork, but the feedback would help

Copy link
Member

@cpovirk cpovirk left a comment

Choose a reason for hiding this comment

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

Sure, here's an approval.

(Our internal tooling is going to scold me to not approve Guava PRs because we don't have a good import configuration for them. I will ignore it :) (Approving doesn't actually hurt anything; we just have it set up so that anyone who approves a Guava PR realizes that it won't get automatically imported. It is not ideal that that discourages me from approving to run CI.))

@cpovirk
Copy link
Member

cpovirk commented Mar 9, 2024

...annnnnd that isn't even the kind of approval it needed :) Now actually approved for CI.

@sgammon sgammon mentioned this pull request Mar 10, 2024
@sgammon
Copy link
Contributor Author

sgammon commented Mar 10, 2024

Ha ha! I didn't even notice. It looks like everything but Copybara is happy, as you'd predicted @cpovirk. I'm not exactly sure why the Windows run isn't making it in; should I take a look, or is that expected?

I'll also rebase onto latest.

@cpovirk
Copy link
Member

cpovirk commented Mar 11, 2024

I'm not exactly sure why the Windows run isn't making it in; should I take a look, or is that expected?

I couldn't easily find the old results anymore, so I re-approved.

It might be that what you're seeing is that "pom.xml on JDK 17 on windows-latest" is listed as "Expected — Waiting for status to be reported" because our branch-protection settings have that listed as a requirement. But what runs now is "CI / pom.xml on JDK 21 on windows-latest (pull_request)," which does appear to be running. (And I assume that I will see it pass soon.) If that's all that's going on, then I can update our settings to look under the new name (and, for that matter, to look for the JDK 21 runs in general) when we merge this.

Anyway, I think I'm going to send this out for internal review (minus the additional additionalJOption usage, unless you've determined that we should be adding that, probably in both "flavors").

@cpovirk
Copy link
Member

cpovirk commented Mar 11, 2024

Or I guess we might not need the javadocs-jdk19plus --enable-preview maven-javadoc-plugin.additionalJOptions at all after #7092?

.github/workflows/ci.yml Outdated Show resolved Hide resolved
Copy link
Member

@cpovirk cpovirk left a comment

Choose a reason for hiding this comment

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

Oops, I can never press the right button in GitHub's review UI, so I published one of my comments separately.

.github/workflows/ci.yml Show resolved Hide resolved
@sgammon
Copy link
Contributor Author

sgammon commented Mar 11, 2024

@cpovirk Going to rebase this one now that JDK srczip has been merged.

@sgammon sgammon force-pushed the chore/build-jdk21 branch 3 times, most recently from 923aead to 8a7df43 Compare March 11, 2024 19:16
@sgammon sgammon requested a review from cpovirk March 11, 2024 19:16
@sgammon
Copy link
Contributor Author

sgammon commented Mar 11, 2024

Okay, this is cleaned up and all review comments have been addressed, I think.

- fix: build against embedded jdk sources needs `--enable-preview`
  when built against jvm21

- fix: add `-Djava.security.manager=allow` to fix security manager
  tests under modern java

Fixes and closes google#7065

Signed-off-by: Sam Gammon <[email protected]>
.github/workflows/ci.yml Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
copybara-service bot pushed a commit that referenced this pull request Mar 12, 2024
The main changes is that tests need `-Djava.security.manager=allow`.

Fixes and closes #7065

Helps with #6790

Fixes #6245 (at least the remaining parts that we actually care about)

Fixes #7087

Signed-off-by: Sam Gammon <[email protected]>
RELNOTES=n/a
PiperOrigin-RevId: 614671411
copybara-service bot pushed a commit that referenced this pull request Mar 12, 2024
The main changes is that tests need `-Djava.security.manager=allow`.

Fixes and closes #7065

Helps with #6790

Fixes #6245 (at least the remaining parts that we actually care about)

Fixes #7087

Signed-off-by: Sam Gammon <[email protected]>
RELNOTES=n/a
PiperOrigin-RevId: 614671411
@sgammon
Copy link
Contributor Author

sgammon commented Mar 12, 2024

@cpovirk I've adjusted the PR to meet all comments. Re/your notes about JVM testing and CI resources, I'm happy to file a change like this one once this is merged, if you are open to it.

That approach changes things a bit because Guava would build at latest JVM only, and then test at each JVM tier using Maven toolchains and specific bytecode settings for each suite. The effect is the same except that no expectation is provided that the codebase builds at earlier JDKs. I've found it to be very effective in my workflows.

@sgammon
Copy link
Contributor Author

sgammon commented Mar 12, 2024

Oh, also, thank you for the note about credit! But I know Copybara doesn't align perfectly with the PR process, and I expect the conclusion of this PR to be closing it no matter what, even if it appears on master :) lol.

copybara-service bot pushed a commit that referenced this pull request Mar 12, 2024
The main changes is that tests need `-Djava.security.manager=allow`.

Fixes and closes #7065

Helps with #6790

Fixes #6245 (at least the remaining parts that we actually care about)

Fixes #7087

Signed-off-by: Sam Gammon <[email protected]>
RELNOTES=n/a
PiperOrigin-RevId: 614671411
@cpovirk
Copy link
Member

cpovirk commented Mar 12, 2024

Re/your notes about JVM testing and CI resources, I'm happy to file a change like this one once this is merged, if you are open to it.

That approach changes things a bit because Guava would build at latest JVM only, and then test at each JVM tier using Maven toolchains and specific bytecode settings for each suite. The effect is the same except that no expectation is provided that the codebase builds at earlier JDKs. I've found it to be very effective in my workflows.

Yes, please. I think it's time to give that a try. It should help with everything from "actually being able to compile a module-info" to (eventually) "phasing out Unsafe." There's some discussion in #6549, none of which is likely to come as a big surprise to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 package=general type=other Miscellaneous activities not covered by other type= labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Guava build fails on master with JDK 21
2 participants