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

maptool: fix JS (extract application JARs from package) #262650

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

rhendric
Copy link
Member

@rhendric rhendric commented Oct 22, 2023

Extract application JARs from package instead of using the uber-JAR release.

Packing the JARs together causes the JavaScript macro functionality not to work, as the scripting interface uses a ServiceLoader to find language providers via text file resources that share a common name. With one file per JAR, this works great. When multiple files with the same name are in one uber-JAR, all but one of them are shadowed, and the JavaScript language provider was getting lost.

Description of changes

Resolves #246830.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/2803

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/2836

makeWrapper ${jre}/bin/java "$dest"/${binName} \
"''${gappsWrapperArgs[@]}" \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ ffmpeg ]} \
--add-flags "${lib.concatStringsSep " " jvmArgs} net.rptools.maptool.client.LaunchInstructions"

runHook postInstall
'';
Copy link
Member

Choose a reason for hiding this comment

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

Please get the url via src.url

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know what line this comment is meant to refer to, but please note that src.url points to a single release artifact, not the entire repository like it would if this used fetchFromGitHub or something.

@@ -13,15 +13,10 @@
let
pname = "maptool";
version = "1.13.2";
repoBase = "https://github.com/RPTools/${pname}";
repoBase = "https://github.com/RPTools/maptool";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
repoBase = "https://github.com/RPTools/maptool";

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, this deduplicates the base repository URL between the source and the update script.

Copy link
Member

Choose a reason for hiding this comment

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

You can get this url via src.url. We do not need to cripple the URL.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you aware that the value of src.url is https://github.com/RPTools/maptool/releases/download/1.13.2/maptool-1.13.2-x86_64.pkg.tar.zst?

Are you proposing splitting on / and selecting the first n components, or stripping the last n? Because that seems way less transparent than defining a variable for the URL base. I don't see any problem with this approach.

Copy link
Member

Choose a reason for hiding this comment

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

Sandro probably meant that the deduplication is unnecessary and that one should simply write url = "https://github.com/RPTools/maptool.git"; instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see how ‘You can get this url via src.url’ could possibly mean that, but... come on, is this a blocker? Does being the maintainer of this package grant me the leeway to take the oh-so-bold position that deduplication is good actually, because in the future I want it to be obvious if the source and the update script URLs drift apart?

Run a grep -rF 'url = "${' on Nixpkgs if you think I'm being some sort of maverick by using this pattern. It's not exactly uncommon. Criticisms of functionality are more than welcome, and violations of the Nixpkgs house coding style also make good feedback, but this is something else altogether and I beg one of you to just click the dang merge button on this months-old PR if this is the only nit left to pick.

Copy link
Member

Choose a reason for hiding this comment

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

Definitely not a blocker for me. I'll give Sandro 24 hours to react before I merge it, so ping me next night if it's still not merged.

pkgs/games/maptool/default.nix Show resolved Hide resolved
pkgs/games/maptool/default.nix Show resolved Hide resolved
pkgs/games/maptool/default.nix Show resolved Hide resolved
pkgs/games/maptool/default.nix Show resolved Hide resolved
pkgs/games/maptool/default.nix Show resolved Hide resolved
install -dm755 "$dest"
makeWrapper ${jre}/bin/java "$dest"/${binName} \
"''${gappsWrapperArgs[@]}" \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ ffmpeg ]} \
Copy link
Member

Choose a reason for hiding this comment

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

Is there an alternative to LD_LIBRARY_PATH?

Copy link
Member Author

Choose a reason for hiding this comment

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

This package uses hundreds of pre-compiled JARs, many of which contain binary libraries. The only alternative I can think of would be unpacking those JARs, patchelf-ing each library, and then reassembling the JARs, and I really think using LD_LIBRARY_PATH is less brittle than that.

... instead of using the uber-JAR release.

Packing the JARs together causes the JavaScript macro functionality not
to work, as the scripting interface uses a ServiceLoader to find
language providers via text file resources that share a common name.
With one file per JAR, this works great. When multiple files with the
same name are in one uber-JAR, all but one of them are shadowed, and
the JavaScript language provider was getting lost.
@rhendric rhendric changed the title maptool: extract application JARs from package maptool: fix JS (extract application JARs from package) Nov 23, 2023
@rhendric rhendric added the backport release-23.11 Backport PR automatically label Nov 30, 2023
@@ -13,15 +13,10 @@
let
pname = "maptool";
version = "1.13.2";
repoBase = "https://github.com/RPTools/${pname}";
repoBase = "https://github.com/RPTools/maptool";
Copy link
Member

Choose a reason for hiding this comment

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

You can get this url via src.url. We do not need to cripple the URL.

@wegank wegank merged commit d25fad2 into NixOS:master Dec 7, 2023
24 of 25 checks passed
Copy link
Contributor

github-actions bot commented Dec 7, 2023

Successfully created backport PR for release-23.11:

@rhendric rhendric deleted the rhendric/maptool branch December 7, 2023 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants