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

Support newer Graalvm JDK 17 distributions #164

Merged

Conversation

mdedetrich
Copy link
Contributor

@mdedetrich mdedetrich commented Sep 14, 2023

This PR adds support for the new updates to the setup-graalvm github action which allows you to specify different graalvm distributions (i.e. graalvm, graalvm-community and mandrel), see https://github.com/graalvm/setup-graalvm#migrating-from-graalvm-223-or-earlier-to-the-new-graalvm-for-jdk-17-and-later for more details.

Rather than just using a raw string, this PR introduces a new trait called Graalvm which allows you to specify which format of the github action you want to use. It was done this way because the setup-graalvm github action doesn't allow using graalvm distributions for JDK versions older than 17. Basic validation for throwing exceptions was also added to verify this (i.e. you cannot use Graalvm.Distribution if the JDK is older than 17).

The final rendering of the github action is the same if you Graalvm.Version (i.e. current JavaSpec.graalvm("22.3.0", "17") renders the same as this PR's JavaSpec.graalvm(Graalvm.Version("22.3.0"), "17") but not JavaSpec.graalvm(Graalvm.Distribution("graalvm"), "17"). The old version of def graalvm(graal: String, version: String): JavaSpec was retained to not break current sbt project builds but its been marked as deprecated.

Furthermore this PR updates build.sbt to use the new Graalvm.Distribution so that we are testing our own dog food (i.e. just to make sure that this new setup-graalvm github action feature works).

@mdedetrich mdedetrich force-pushed the support-newer-graalvm-jdk-17-distribution branch from a484c0f to a7d3111 Compare September 14, 2023 10:15
* @see https://github.com/graalvm/setup-graalvm#migrating-from-graalvm-223-or-earlier-to-the-new-graalvm-for-jdk-17-and-later
*/
sealed trait Graalvm {
private[sbtghactions] def compile: String
Copy link
Contributor Author

@mdedetrich mdedetrich Sep 14, 2023

Choose a reason for hiding this comment

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

This is private because we don't want to expose this method to sbt project build's in case we need to change it for later.

@mdedetrich mdedetrich force-pushed the support-newer-graalvm-jdk-17-distribution branch from a7d3111 to 6c78009 Compare September 14, 2023 10:19
@mdedetrich mdedetrich force-pushed the support-newer-graalvm-jdk-17-distribution branch 4 times, most recently from 1bd8f74 to 018221c Compare September 14, 2023 11:09
@mdedetrich mdedetrich force-pushed the support-newer-graalvm-jdk-17-distribution branch from 018221c to 2ef4830 Compare September 14, 2023 11:10
@mdedetrich mdedetrich merged commit e1d9490 into sbt:main Sep 15, 2023
5 checks passed
@mdedetrich mdedetrich deleted the support-newer-graalvm-jdk-17-distribution branch September 15, 2023 07:28
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.

2 participants