Skip to content

Commit

Permalink
fetchMavenArtifact: deprecate phases & use pname+version
Browse files Browse the repository at this point in the history
  • Loading branch information
Stunkymonkey committed Mar 26, 2023
1 parent 972b0fa commit 0f57b4b
Showing 1 changed file with 6 additions and 11 deletions.
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

0 comments on commit 0f57b4b

Please sign in to comment.