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

fetchMavenArtifact: deprecate phases & use pname+version #219707

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions pkgs/build-support/fetchmavenartifact/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,8 @@ assert (url == "") || (urls == []);
assert (repos != []) || (url != "") || (urls != []);

let
name_ =
lib.concatStrings [
(lib.replaceStrings ["."] ["_"] groupId) "_"
(lib.replaceStrings ["."] ["_"] artifactId) "-"
version
];
suffix = if isNull classifier then "" else "-${classifier}";
pname = (lib.replaceStrings [ "." ] [ "_" ] groupId) + "_" + (lib.replaceStrings [ "." ] [ "_" ] artifactId);
suffix = lib.optionalString (classifier != null) "-${classifier}";
filename = "${artifactId}-${version}${suffix}.jar";
mkJarUrl = repoUrl:
lib.concatStringsSep "/" [
Expand All @@ -59,13 +54,13 @@ let
else map mkJarUrl repos;
jar =
fetchurl (
builtins.removeAttrs args ["groupId" "artifactId" "version" "classifier" "repos" "url" ]
// { urls = urls_; name = "${name_}.jar"; }
builtins.removeAttrs args [ "groupId" "artifactId" "version" "classifier" "repos" "url" ]
// { urls = urls_; name = "${pname}-${version}.jar"; }
);
in
stdenv.mkDerivation {
name = name_;
phases = "installPhase fixupPhase";
inherit pname version;
dontUnpack = true;
# By moving the jar to $out/share/java we make it discoverable by java
# packages packages that mention this derivation in their buildInputs.
installPhase = ''
Expand Down