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

update asm for Java 19 support #220

Merged
merged 13 commits into from
Dec 24, 2022
Merged

update asm for Java 19 support #220

merged 13 commits into from
Dec 24, 2022

Conversation

xzel23
Copy link
Contributor

@xzel23 xzel23 commented Sep 24, 2022

fixes #219

@ice1000
Copy link

ice1000 commented Sep 25, 2022

Thanks!

@xzel23
Copy link
Contributor Author

xzel23 commented Sep 26, 2022

Ah, so it seems it's not just updating the ASM. The plugin builds, tests pass, but it still didn't work with JDK 19. So I tried to update the dependencies and make everything work with JDK 19 and Gradle 7.3+. I think Groovy and I will never be real close friends. I could not make the changes in a way that maintains compatibility with Gradle versions 4, 5, 6. That might not be acceptable for @siordache.

Java 19 needs Gradle 7.3+, and I am no expert on this, but it seems that Gradle 7+ uses Groovy 3. So I have updated all plugins dependencies to current versions. I replaced the assembler with the one supplied by gradle. I think the original author decided to use an external asm to support newer JDK independent from older Gradle versions. However I could not get it to work and I really need a working plugin for JDK 19 and Gradle 7.3+ ASAP, so I took this route.

I also removed all @CompileStatic annotations from the plugin code as that seemed to solve some problems. It might not have been necessary, as I could only get the plugin to work in Gradle 7.3+.

I had to add a dependency for JUnit4 compatibility ("@rule" etc) and had to add "useJUnitPlatform()" in the build file because tests were not found.

I have not yet tested the plugin with projects other than the supplied test projects. I will do ASAP and if it works, I might publish a Gradle7+ only version with other Gradle coordinates that might work for you.

I don't know if/when the original plugin will be updated, but this really seems to be much more complicated than I thought at first, so I think it might take some time. If the changes I made help in the process, I will be glad.

@CodeDead
Copy link

This looks like a pretty good change @xzel23 !

It seems like Gradle 7.6 will be the first version to support JDK 19:
gradle/gradle#20372

So Gradle 7.6+ will be needed in order to support JDK 19.

@ice1000
Copy link

ice1000 commented Sep 30, 2022

@CodeDead no, gradle can run on jdk 17 and build a project using another jdk which is jdk 19.

Gradle 7.6 will add support for running gradle on JDK 19, which is not needed.

@xzel23
Copy link
Contributor Author

xzel23 commented Sep 30, 2022

@CodeDead You can run Gradle on Java 17 and compile using Java 19 if you use the toolchain support like this:

    java {
        toolchain { languageVersion.set(JavaLanguageVersion.of(19)) }
    }

@CodeDead
Copy link

CodeDead commented Sep 30, 2022

@ice1000 & @xzel23 yes, but isn't this quite difficult to achieve with automated builds like GitHub Actions, Jenkins and the likes since you will need dual JDK's installed in your base image to achieve this? Just a note, that might be helpful for some struggling to get automated builds done.

@ice1000
Copy link

ice1000 commented Sep 30, 2022

@ice1000 & @xzel23 yes, but isn't this quite difficult to achieve with automated builds like GitHub Actions, Jenkins and the likes since you will need dual JDK's installed in your base image to achieve this? Just a note, that might be helpful for some struggling to get automated builds done.

One probably encounter the problem before realizing that badass jlink doesn't work with 19 lol

@xzel23
Copy link
Contributor Author

xzel23 commented Sep 30, 2022

@CodeDead Gradle will automatically download the correct JDK for the build if it isn't installed on the system.

@markusheiden
Copy link

markusheiden commented Oct 1, 2022

@xzel23 For automated builds Gradle would then automatically download and install some JDK for each build step of each build? Or is the downloaded JDK somehow cacheable?

@octylFractal
Copy link

@markusheiden
Copy link

Thanks for the fast answer, that helped me make it work. One thing that is not mentioned there: Downloaded JDKs are cached in .gradle/jdks/. If adding that directory to the CI cache, JDK re-downloads can be avoided by subsequent build steps and builds.

@Siedlerchr
Copy link

Gradle's new version 7.6 now supports jdk19 as well

@ice1000
Copy link

ice1000 commented Dec 5, 2022

It's a shame that this PR is not receiving developers' input. We have a smol library that modifies the java bytecode's java major version so that badass jlink still thinks it's Java 17 (along with two more changes -- from java.lang.MatchException to java.lang.RuntimeException and the time stamp, to prevent breaking incremental compilation).

@siordache siordache merged commit bf1cce1 into beryx:master Dec 24, 2022
@ice1000
Copy link

ice1000 commented Dec 24, 2022

Ohh! That's great! I take it all back. Nice job!!

@siordache
Copy link
Member

Thanks for the PR, @xzel23! Release 2.26.0 is out. Starting with this version, the plugin requires Gradle 7.0 or newer.

As you all noticed, I didn't have much time lately for this plugin. It would be great if some of you could help co-maintain it. I created an issue to keep track of this matter.

@ice1000
Copy link

ice1000 commented Dec 25, 2022

Thanks for the PR, @xzel23! Release 2.26.0 is out. Starting with this version, the plugin requires Gradle 7.0 or newer.

As you all noticed, I didn't have much time lately for this plugin. It would be great if some of you could help co-maintain it. I created an issue to keep track of this matter.

That's very sweet! 🆒🆒🆒

@bxqgit
Copy link

bxqgit commented Dec 27, 2022

Finally! 🙄

@xzel23
Copy link
Contributor Author

xzel23 commented Dec 28, 2022

@bxqgit I think we should be grateful and not post such comments. Providing and maintaining open source software can be a time consuming and tedious task, and it is most of the time unpaid. We all have our day jobs that we rely on to make a living. If you are unsatisfied with the progress, you can actively help by submitting your own PRs, or even step up and become a co-maintainer as @siordache recently asked for someone who could help out with this plugin. Or you could review PRs, and report or fix problems. Just replying "finally" is not motivating for the maintainer.

Don't get me wrong, I can understand your feeling. But blaming the maintainer is not the right thing to do.

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.

Upgrade asm to 9.3 to support Java 19?
8 participants