summary refs log tree commit diff
path: root/pkgs/build-support/build-maven.nix
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2015-07-20 09:19:12 -0400
committerShea Levy <shea@shealevy.com>2015-07-20 09:19:12 -0400
commit745690717e24179d48e556ae487af77260eee49a (patch)
tree58abf7aa3798ae710bea8d86f7f103571a2549e6 /pkgs/build-support/build-maven.nix
parent615f64dcbe6de193a9c3b0e03591fe623fecaeb1 (diff)
build-maven: Add handling for snapshot version resolution
Diffstat (limited to 'pkgs/build-support/build-maven.nix')
-rw-r--r--pkgs/build-support/build-maven.nix16
1 files changed, 14 insertions, 2 deletions
diff --git a/pkgs/build-support/build-maven.nix b/pkgs/build-support/build-maven.nix
index a1faf8060be9c..ff91828eeca74 100644
--- a/pkgs/build-support/build-maven.nix
+++ b/pkgs/build-support/build-maven.nix
@@ -15,15 +15,27 @@ infoFile: let
 
   script = writeText "build-maven-repository.sh" ''
     ${lib.concatStrings (map (dep: let
-      inherit (dep) url sha1 groupId artifactId version authenticated;
+      inherit (dep)
+        url sha1 groupId artifactId version
+        authenticated metadata extension repository-id;
+
+      versionDir = dep.unresolved-version or version;
 
       fetch = (if authenticated then requireFile else fetchurl) {
         inherit url sha1;
       };
+
+      fetchMetadata = (if authenticated then requireFile else fetchurl) {
+        inherit (metadata) url sha1;
+      };
     in ''
-      dir=$out/$(echo ${groupId} | sed 's|\.|/|g')/${artifactId}/${version}
+      dir=$out/$(echo ${groupId} | sed 's|\.|/|g')/${artifactId}/${versionDir}
       mkdir -p $dir
       ln -sv ${fetch} $dir/${fetch.name}
+      ${lib.optionalString (dep ? metadata) ''
+        ln -svf ${fetchMetadata} $dir/maven-metadata-${repository-id}.xml
+        ln -sv ${fetch} $dir/$(echo ${fetch.name} | sed 's|${version}|${dep.unresolved-version}|')
+      ''}
     '') info.dependencies)}
   '';