Change:
Package name: jextract (jextract-unstable) Current version on the unstable channel: 2023-11-27 Current version on the stable/release channel: n/a As of today the current release build is (see ) It would be nice for the nixpkgs version to be based on JDK 22 -- which contains the final non-preview release of Java Foreign Function & Memory API (aka "Panama") There are significant changes to that users will want before building/launching projects that use Panama. See: I am wiling to contribute but before we can do this we'll need to build with JDK 22 (see Issue )
It would be great if we could update to be based on JDK 22 :+1: , and we should also keep the current JDK 21 package as a new name (perhaps ?) at the same time, as some downstreams still depend on it and JDK 21 is a LTS version.
So should the first step be to rename the existing package? And leave as JDK 21-based (with a warning, maybe) and then do a separate PR to upgrade to JDK 21?
Update: There is a PR for JDK 22:
I can open a PR to update jextract after gets merged. Considering the significant API changes between JDK 21 and 22, and the fact that jextract itself produces very differnt code if you have to use JDK21 (see ) , is there really value in keeping a jextract version compatible with JDK21?
Awesome! I'm going to test on macOS/aarch64 this weekend, so that will help get it merged. wrote: as some downstreams still depend on it and JDK 21 is a LTS version. JDK 21 is LTS, but Panama (Foreign Functions & Memory API) is a "preview feature" which makes it really hard to build anything real with it (i.e. publish JARs for use by other projects. I even had problems with a Gradle multi-module build). I migrated my project to 22 a few weeks ago and am not looking back (which meant I had to stop using Nix as a source for temporarily.) But, I don't see any harm in renaming the existing to and starting a new one. And we certainly don't want to unnecessarily break anyone's dependencies. And now that Panama/FF&M is final, I'm hoping it will be possible to use jextract 22 to build headers for JDK 23+. Newer versions of jextract might offer improvements, but headers generated for JDK 22 should work wth JDK 23+ (I don't know what guarantees the JDK makes for that, but this seems a reasonable conclusion given a stable API.)
Nice to hear that, and thanks for your work! IMO, I think it's worth. The point is that JDK 21 is a LTS version, some downstreams prefer to use a LTS version of JDK to develop their projects. For them, if we don't keep JDK 21's , this will be unavailable to them unless they give up on choosing LTS and do some extra effort - porting their project to a newer version of JDK.
I agree. But I also strongly encourage new projects to start with JDK 22 and existing projects to migrate as quickly as possible. Having to make sure "preview mode" is set in the compiler and at runtime can cause various problems with tools and the output of the latest is significantly improved. In general, it's much better to be using a non-LTS JDK with a non-preview feature than and LTS JDK with a preview feature. I migrated my project recently and wish I had migrated to JDK 22 much earlier.
PR has been merged. I gave it a quick test on macOS/aarch64 and it seems to be working. (I used it to build which uses JDK 22 and Panama via Gradle's Java toolchains)

Discussion:
<ins> { lib , stdenv , fetchFromGitHub , emptyDirectory , writeText , makeBinaryWrapper , gradle , jdk21 , llvmPackages }: let gradleInit = writeText "init.gradle" '' logger.lifecycle 'Replacing Maven repositories with empty directory...' gradle.projectsLoaded { rootProject.allprojects { buildscript { repositories { clear() maven { url '${emptyDirectory}' } } } repositories { clear() maven { url '${emptyDirectory}' } } } } settingsEvaluated { settings -> settings.pluginManagement { repositories { maven { url '${emptyDirectory}' } } } } ''; in stdenv.mkDerivation { pname = "jextract"; version = "unstable-2023-11-27"; src = fetchFromGitHub { owner = "openjdk"; repo = "jextract"; rev = "8730fcf05c229d035b0db52ee6bd82622e9d03e9"; # Update jextract 21 with latest fixes hash = "sha256-Wct/yx5C0EjDtDyXNYDH5LRmrfq7islXbPVIGBR6x5Y="; }; nativeBuildInputs = [ gradle makeBinaryWrapper ]; env = { ORG_GRADLE_PROJECT_llvm_home = llvmPackages.libclang.lib; ORG_GRADLE_PROJECT_jdk21_home = jdk21; }; buildPhase = '' runHook preBuild export GRADLE_USER_HOME=$(mktemp -d) gradle --console plain --init-script "${gradleInit}" assemble runHook postBuild ''; doCheck = true; checkPhase = '' runHook preCheck gradle --console plain --init-script "${gradleInit}" verify runHook postCheck ''; installPhase = '' runHook preInstall mkdir -p $out/opt/ cp -r ./build/jextract $out/opt/jextract makeBinaryWrapper "$out/opt/jextract/bin/jextract" "$out/bin/jextract" runHook postInstall ''; meta = with lib; { description = "A tool which mechanically generates Java bindings from a native library headers"; mainProgram = "jextract"; homepage = "https://github.com/openjdk/jextract"; platforms = jdk21.meta.platforms; license = licenses.gpl2Only; maintainers = with maintainers; [ sharzy ]; }; } </ins>

<ins> { lib , stdenv , fetchFromGitHub , emptyDirectory , writeText , makeBinaryWrapper , gradle , jdk22 , llvmPackages }: let gradleInit = writeText "init.gradle" '' logger.lifecycle 'Replacing Maven repositories with empty directory...' gradle.projectsLoaded { rootProject.allprojects { buildscript { repositories { clear() maven { url '${emptyDirectory}' } } } repositories { clear() maven { url '${emptyDirectory}' } } } } settingsEvaluated { settings -> settings.pluginManagement { repositories { maven { url '${emptyDirectory}' } } } } ''; in stdenv.mkDerivation { pname = "jextract"; version = "unstable-2024-03-13"; src = fetchFromGitHub { owner = "openjdk"; repo = "jextract"; rev = "b9ec8879cff052b463237fdd76382b3a5cd8ff2b"; hash = "sha256-+4AM8pzXPIO/CS3+Rd/jJf2xDvAo7K7FRyNE8rXvk5U="; }; nativeBuildInputs = [ gradle makeBinaryWrapper ]; env = { ORG_GRADLE_PROJECT_llvm_home = llvmPackages.libclang.lib; ORG_GRADLE_PROJECT_jdk22_home = jdk22; }; buildPhase = '' runHook preBuild export GRADLE_USER_HOME=$(mktemp -d) gradle --console plain --init-script "${gradleInit}" assemble runHook postBuild ''; doCheck = true; checkPhase = '' runHook preCheck gradle --console plain --init-script "${gradleInit}" verify runHook postCheck ''; installPhase = '' runHook preInstall mkdir -p $out/opt/ cp -r ./build/jextract $out/opt/jextract makeBinaryWrapper "$out/opt/jextract/bin/jextract" "$out/bin/jextract" runHook postInstall ''; meta = with lib; { description = "A tool which mechanically generates Java bindings from a native library headers"; mainProgram = "jextract"; homepage = "https://github.com/openjdk/jextract"; platforms = jdk22.meta.platforms; license = licenses.gpl2Only; maintainers = with maintainers; [ jlesquembre sharzy ]; }; } </ins>

<del> { lib , stdenv , fetchFromGitHub , emptyDirectory , writeText , makeWrapper , gradle , jdk21 , llvmPackages }: let gradleInit = writeText "init.gradle" '' logger.lifecycle 'Replacing Maven repositories with empty directory...' gradle.projectsLoaded { rootProject.allprojects { buildscript { repositories { clear() maven { url '${emptyDirectory}' } } } repositories { clear() maven { url '${emptyDirectory}' } } } } settingsEvaluated { settings -> settings.pluginManagement { repositories { maven { url '${emptyDirectory}' } } } } ''; in stdenv.mkDerivation { pname = "jextract"; version = "unstable-2023-11-27"; src = fetchFromGitHub { owner = "openjdk"; repo = "jextract"; rev = "8730fcf05c229d035b0db52ee6bd82622e9d03e9"; # Update jextract 21 with latest fixes hash = "sha256-Wct/yx5C0EjDtDyXNYDH5LRmrfq7islXbPVIGBR6x5Y="; }; nativeBuildInputs = [ gradle makeWrapper ]; env = { ORG_GRADLE_PROJECT_llvm_home = llvmPackages.libclang.lib; ORG_GRADLE_PROJECT_jdk21_home = jdk21; }; buildPhase = '' runHook preBuild export GRADLE_USER_HOME=$(mktemp -d) gradle --console plain --init-script "${gradleInit}" assemble runHook postBuild ''; doCheck = true; checkPhase = '' runHook preCheck gradle --console plain --init-script "${gradleInit}" verify runHook postCheck ''; installPhase = '' runHook preInstall mkdir -p $out/opt/ cp -r ./build/jextract $out/opt/jextract runHook postInstall ''; postFixup = '' makeWrapper "$out/opt/jextract/bin/jextract" "$out/bin/jextract" ''; meta = with lib; { description = "A tool which mechanically generates Java bindings from a native library headers"; mainProgram = "jextract"; homepage = "https://github.com/openjdk/jextract"; license = licenses.gpl2Only; maintainers = with maintainers; [ sharzy ]; }; } </del>

fastjar = callPackage ../development/tools/java/fastjar { }; <del> jextract = callPackage ../development/tools/java/jextract { }; </del> httpunit = callPackage ../development/libraries/java/httpunit { }; javaCup = callPackage ../development/libraries/java/cup {