Conversation
Princemachiavelli
left a comment
There was a problem hiding this comment.
The updater script works for me. A quick nix-diff of the PR shows the only change being the update from "22+36" to "22-ga" which is correct. Running the updater today causes an update from "22-ga" to "22.0.1-ga" which appears correct.
If the latest release always ends in -ga, perhaps it's better to strip that from the version? eg. openjdk-22.0.1 instead of openjdk-22.0.1-ga.
|
@Princemachiavelli Thanks for your review. |
pkgs/top-level/java-packages.nix
Outdated
There was a problem hiding this comment.
Is there a reason why this was changed? It breaks the pattern with all of the other JDK builders, so it seems a bit out of place to change it in just 1 place. Same with the other references to the bootstrap JDK.
There was a problem hiding this comment.
Probably I should have done it on a following PR.
The main reason is to unify the arguments to mkOpenJdk and create a more generic function in the future. There is a lot of duplication between the 22.nix, 21.nix, etc. files.
It also makes it more consistent with the openjfx argument. In my opinion, we should do this:
openjdk22 = mkOpenjdk
{
jdk-bootstrap = temurin-bin.jdk-21;
openjfx = openjfx22;
};or this:
openjdk22 = mkOpenjdk
{
openjdk22-bootstrap = temurin-bin.jdk-21;
openjdk22-openjfx = openjfx22;
};There was a problem hiding this comment.
@jlesquembre regarding this change jdk-bootstrap rename, a quick git grep openjdk22-bootstrap showed me this:
pkgs/development/compilers/openjdk/22.nix:, openjdk22-bootstrap
pkgs/development/compilers/openjdk/22.nix: openjdk-bootstrap = openjdk22-bootstrap.override { gtkSupport = !headless; };
So, won't it break what's in 22.nix and 21.nix?
There was a problem hiding this comment.
I just undid that change
|
Would it make sense to add some |
|
@liff My plan was to add a test on a following PR, but since getting this PR merged is taking longer than expected, I went ahead and added a test. I also reformatted the nix file with |
|
Please split the commit to separate reformatting, adding the update script, and adding the test. |
9fbaddb to
81fae6d
Compare
|
@Infinidoge I split it into 2 commits. For the review, please ignore the first one since it only contains formatting changes. I hope this helps reviewers and we can get this merged. |
SuperSandro2000
left a comment
There was a problem hiding this comment.
Formatting of single packages is discouragrd as it creates lots of noise. Please wait for an organized effort.
There was a problem hiding this comment.
Is there a particular reason why the updater is not written in bash or python other than dog fooding?
It makes it a lot harder for general contributions to use it.
There was a problem hiding this comment.
Two reasons:
- The update script uses https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/Runtime.Version.html to parse and compare versions. It makes more sense to reuse that instead of re-implementing that logic on other languages, particularly since the Java version schema could be more complex than expected: https://openjdk.org/jeps/223
- I expect Java developers to be more interested in maintaining the updater script. I think it's fair to write the script in a language more familiar to them.
I agree, but in this particular case I think it makes sense. The nix file was like this: and this PR updates it to only with that change, the diff is already quite noisy, so I took that opportunity to reformat it. Even without reformatting it with |
|
What can I do to move forward this PR? I'm open to removing the formatting, remove the test, or other elements if it would help with the review process. My only sticking point is that I believe the update script should remain in Java (or any JDK language) to leverage the Runtime.Version utilities. |
doronbehar
left a comment
There was a problem hiding this comment.
2 more general question:
- Could we split perhaps the refactoring and the updateScript addition to separate commits?
- Does this commit apply only to
openjdk22? What about the otheropdnjdkattributes?
pkgs/top-level/java-packages.nix
Outdated
There was a problem hiding this comment.
@jlesquembre regarding this change jdk-bootstrap rename, a quick git grep openjdk22-bootstrap showed me this:
pkgs/development/compilers/openjdk/22.nix:, openjdk22-bootstrap
pkgs/development/compilers/openjdk/22.nix: openjdk-bootstrap = openjdk22-bootstrap.override { gtkSupport = !headless; };
So, won't it break what's in 22.nix and 21.nix?
|
@SuperSandro2000 @Infinidoge @doronbehar I've undone all the unrelated changes (refactoring included) to focus solely on adding the update script. Hopefully, this helps moving forward the PR. I'll address the remaining changes in future PRs. |
doronbehar
left a comment
There was a problem hiding this comment.
Diff LGTM. I trust the author to have tested the update script and that he will maintain it properly. I will merge in a week or so if no body else has any comments.
|
thanks @doronbehar For future reference, if anyone wants to test it locally, in the root directory of your (or Then you can inspect the generated update script and run it if you want. |
Infinidoge
left a comment
There was a problem hiding this comment.
Small problem with the versions specified in the build arguments, but outside of that LGTM
There was a problem hiding this comment.
These should be kept, as they are used for marking the version.
From The Temurin build wiki, about versions in build configuration:
But when you build something that is fit for others to consume, you will still want to provide a build number with --with-build-number, use -with-version-pre="" if you want to say it is an actual release (use e.g. "ea", or just leave blank to make it "internal" otherwise), and in addition set --with-version-opt to control that thing that defaults to "adhoc.$USERNAME.$basedirname".
There was a problem hiding this comment.
I replaced it with --with-version-string=${version}, where the version value is the git tag.
Notice that --with-version-XX= overwrites the value set by --with-version-string.
Currently java --version returns:
openjdk 22-ga 2024-03-19
OpenJDK Runtime Environment (build 22-ga)
OpenJDK 64-Bit Server VM (build 22-ga, mixed mode, sharing)
If we add those 2 flags again (version-opt and version-pre) the output becomes::
openjdk 22 2024-03-19
OpenJDK Runtime Environment (build 22+-nixos)
OpenJDK 64-Bit Server VM (build 22+-nixos, mixed mode, sharing)
In my opinion, the first one makes the JDK version much clearer.
Looking at the link you posted, seems that what we should use is --with-vendor-version-string , but that option isn't mentioned here: https://openjdk.org/groups/build/doc/building.html
There was a problem hiding this comment.
Hmm, ideally we would still include the vendor information if possible, especially since we do patch OpenJDK for building on Nixpkgs. I do agree that it is much more clear though. Have you tested if --with-vendor-version-string works? (Finishing up a course so I haven't done so myself yet.)
There was a problem hiding this comment.
with --with-vendor-version-string=${version}_nix-build:
openjdk 22-ga 2024-03-19
OpenJDK Runtime Environment 22-ga_nix-build (build 22-ga)
OpenJDK 64-Bit Server VM 22-ga_nix-build (build 22-ga, mixed mode, sharing)
Probably it is a good idea to add --with-vendor-version-string. What value makes sense to you? I like ${version}_nix-build, but I don't have a strong preference.
vendor-version-string is defined here:
https://github.com/openjdk/jdk/blob/6968770b1e918c74fc009e3562a827bb4acbe2d7/make/autoconf/jdk-version.m4#L488-L502
As a side note regarding the OpenJDK patches on nixpkgs, I think that some are not necessary for newer JDK versions. I'll open new PRs to remove them.
There was a problem hiding this comment.
Probably it is a good idea to add
--with-vendor-version-string. What value makes sense to you? I like${version}_nix-build, but I don't have a strong preference.
I too don't have a strong preference, but I think the 22-ga is mentioned too many times if you'd use ${version} there too, so I'd vote for --with-veondor-version-string="(nix)".
There was a problem hiding this comment.
"--with-vendor-version-string=(nix)":
openjdk 22-ga 2024-03-19
OpenJDK Runtime Environment (nix) (build 22-ga)
OpenJDK 64-Bit Server VM (nix) (build 22-ga, mixed mode, sharing)
@doronbehar makes sense, changing my vote to (nix), I like it more :)
Let's wait for @Infinidoge vote
There was a problem hiding this comment.
It feels like it displays a little bit weirdly, with (nix) before the version, etc. But that's less of our problem and more of OpenJDK's problem. Looks good to me!
There was a problem hiding this comment.
done, added "--with-vendor-version-string=(nix)"
|
Feel free to cc me for a review of other changes regarding java ecosystem @jlesquembre . |
|
thanks @doronbehar , I will :) |
Description of changes
Adds an update script for openjdk22. I tried to do make the script generic enough so it can be re-used for any openjdk version, but I'll handle that on a following PR if this one gets merged.
I had to replace the
versionattribute set with a string. The version is updated and validated in the updateScript with Java using Runtime.VersionThings done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.