sdkman / sdkman-db-migrations

Database migrations for the sdkman API
Apache License 2.0
69 stars 123 forks source link

Feature: Add support for `jextract` #663

Open overheadhunter opened 9 months ago

overheadhunter commented 9 months ago

Feature request

The jextract tool used to be part of the JDK in older builds of Project Panama but has been externalized to decouple the release cycle. It helps generating Java bindings from C header files using the FFM API (currently still in preview).

You might want to have multiple versions of jextract installed at the same time, each of which compatible with a different JDK. SDKMAN! would simplify managing those installations.

helpermethod commented 9 months ago

Hi @overheadhunter,

just gave it a quick look, and it's possible to distribute jextract via SDKMAN!.

But note that only ea builds currently exist, so at some point the URLs pointing to the binaries may stop working.

@marc0der Wdyt? I guess it would be a great addition to SDKMAN!.

marc0der commented 9 months ago

Yep, I see no problem in supporting jextract, although we would need to do some additional work as it is only distributed as .tgz.

helpermethod commented 9 months ago

@marc0der Prebuilt binaries are distributed as .tar.gz. Do we need to make changes to the sdkman-candidates service?

marc0der commented 9 months ago

We will need to make some changes to hooks to handle this. After that we can merge. I'll see what I can do over the weekend.

marc0der commented 9 months ago

Okay, I've deployed the changes to sdkman-hooks. I'll unblock the PR @helpermethod

marc0der commented 9 months ago

Hi @overheadhunter, we released Jextract but realised it includes java and javac too. This is a big problem because it clobbers the java binaries provided by our java candidate. I will need to pull Jextract for now until this issue is resolved.

helpermethod commented 9 months ago

I've asked on the jextract-dev mailing list if they could remove java and javac from the binaries but it doesn't seem that easy

Hi,
While removing javac should be doable, I think dropping the java
launcher is more problematic, as that launcher is called by the jextract
launcher.

So, doing something like that would require a deeper restructuring of
the build layout I'm afraid.

Maurizio

So I fear we can't support jextract any time soon.

overheadhunter commented 9 months ago

I have seen Maurizio's answer as well.

I guess adding a different dir to PATH, which solely contains a symlink to the jextract binary is not an option?

marc0der commented 9 months ago

It's a big pity, and we can always revisit this if they find a different way of repackaging their tools.

helpermethod commented 1 month ago

@overheadhunter The jextract guys made some changes to the distribution so that we should finally be able to publish EA builds.

PR incoming https://github.com/sdkman/sdkman-db-migrations/pull/695

overheadhunter commented 1 month ago

Great news, looking forward to it!

marc0der commented 1 month ago

It would be great to test these binaries with a local install before we add jextract @helpermethod

helpermethod commented 1 month ago

It would be great to test these binaries with a local install before we add jextract @helpermethod

Tested the latest version on Ubuntu and it seems to work fine.

Directory structure fits, jextract binary is executable.

IMG_20240601_122342.jpg

Looking at the extracted TAR, I wonder if the version shouldn't just include the OpenJDK version 🤔.

marc0der commented 1 month ago

Okay, so is it a tar archive? Do they have a zip variant? If it's only tar, we'll need to override it in the hooks service.

Looking at the extracted TAR, I wonder if the version shouldn't just include the OpenJDK version

We're you referring to the version in the containing folder?

helpermethod commented 1 month ago

Okay, so is it a tar archive? Do they have a zip variant? If it's only tar, we'll need to override it in the hooks service.

Looking at the extracted TAR, I wonder if the version shouldn't just include the OpenJDK version

We're you referring to the version in the containing folder?

Yes, it's only distributed as a TAR, so we also need to extend the hooks service.

helpermethod commented 1 month ago

@marc0der It seems you already made the necessary changes to the sdkman-hooks service a while ago

https://github.com/sdkman/sdkman-hooks/commit/7781dcb037456cac7314561af7aee06f010b7d16

marc0der commented 1 month ago

Yeah, I was just rereading the thread above and saw it ☺️