Skip to content

feat(client): publish GraalVM metadata files #534

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

Merged
merged 2 commits into from
Jul 17, 2025

Conversation

jdubois
Copy link
Contributor

@jdubois jdubois commented Jul 15, 2025

This adds support for generating the GraalVM metadata when releasing the project, as mentioned in #522

The setup is a bit complex because:

  • The current build of Kotlin doesn't work with a recent Java version (Java 24)
  • But the GraalVM native image needs a recent version for licensing issues (you need a commercial license for version 17)

So the way this is done here is:

  • Compile the module with Java 17, so it works fine with Kotlin
  • Run the tests over the compiled code with GraalVM 21 (it won't work with 24, and 21 doesn't require a commercial license)

At some point this will all need to migrate to Java 24: at that moment, please note that GraalVM will have a new file format, and will generate only one file instead of several (but always in the same directory, so this code should still work OK).

I'm keeping the full "publish to Sonatype" task, to have everything fully compiled and tested for the release. That means the tests will run twice - this could be fixed by adding -x test to that task.

Another way to achieve this would be to use the GraalVM Gradle task instead of adding the agent library like we do here as a JVM argument: this seems more elegant, but that approach cannot work currently as it would require to import that task (the task only run when the "agent" profile is set up, but the import would always be there as they can't be conditionally imported). And as that task cannot run with Java 17, that would make the Kotlin build fail. This is something that could be improved later, when the project will work with Java 24.

@jdubois jdubois requested a review from a team as a code owner July 15, 2025 09:40
@TomerAberbach
Copy link
Collaborator

Curious what errors you ran into with Java 24 if you still have them?

@jdubois
Copy link
Contributor Author

jdubois commented Jul 16, 2025

With Java 24, I had this error, using the configuration at https://github.com/jdubois/openai-java/blob/6a8d908bb52af8a4b2bea74786318dc161521f71/.github/workflows/test.yml , when running the tests:

> Could not create task ':openai-java-core:test'.
   > Could not create task of type 'Test'.
      > Could not create an instance of type org.gradle.api.internal.tasks.testing.DefaultTestTaskReports.
         > Could not create an instance of type org.gradle.api.reporting.internal.DefaultReportContainer.
            > Type T not present

@TomerAberbach TomerAberbach changed the base branch from main to next July 17, 2025 21:14
@TomerAberbach TomerAberbach changed the title Generate the GraalVM metadata file(s) when releasing the project feat(client); publish GraalVM metadata files Jul 17, 2025
@TomerAberbach TomerAberbach changed the title feat(client); publish GraalVM metadata files feat(client): publish GraalVM metadata files Jul 17, 2025
@TomerAberbach TomerAberbach merged commit e6b4fe0 into openai:next Jul 17, 2025
2 of 3 checks passed
@stainless-app stainless-app bot mentioned this pull request Jul 17, 2025
TomerAberbach pushed a commit that referenced this pull request Jul 17, 2025
* feat(client): publish GraalVM metadata files (#534)

* Generate the GraalVM metadata file(s) when releasing the project

Fix #522

* Rename the GraalVM Agent profile to "graalvmAgent"

* release: 2.16.0

---------

Co-authored-by: Julien Dubois <[email protected]>
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
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