@@ -33,6 +33,9 @@ pkgs.stdenvNoCC.mkDerivation rec {
3333 jekyll-theme-cayman
3434 ] ) ) ;
3535
36+ # Maven needs to download necessary dependencies which is impure because it
37+ # requires network access. Hence, we download all dependencies as a
38+ # fixed-output derivation. This also serves as a nice cache.
3639 mavenRepo = pkgs . stdenv . mkDerivation {
3740 pname = "${ pname } -mavenRepo" ;
3841 inherit version ;
@@ -67,6 +70,10 @@ pkgs.stdenvNoCC.mkDerivation rec {
6770 outputHash = dependenciesHash ;
6871 } ;
6972
73+ # - `out` contains jars, an executable wrapper and optionally documentation
74+ # (see `buildGitHubPages`)
75+ # - `maven` contains a local maven repository with DiffDetective and all its
76+ # build-time and run-time dependencies.
7077 outputs = [ "out" "maven" ] ;
7178
7279 jre-minimal = pkgs . callPackage ( import "${ sources . nixpkgs } /pkgs/development/compilers/openjdk/jre.nix" ) {
@@ -108,12 +115,14 @@ pkgs.stdenvNoCC.mkDerivation rec {
108115 installPhase = ''
109116 runHook preInstall
110117
118+ # install jars in "$out"
111119 install -Dm644 "target/diffdetective-${ version } .jar" "$out/share/java/DiffDetective.jar"
112120 local jar="$out/share/java/DiffDetective/DiffDetective.jar"
113121 install -Dm644 "target/diffdetective-${ version } -jar-with-dependencies.jar" "$jar"
114122 makeWrapper "${ jre-minimal } /bin/java" "$out/bin/DiffDetective" --add-flags "-cp \"$jar\"" \
115123 --prefix PATH : "${ pkgs . graphviz } /bin"
116124
125+ # install documentation in "$out"
117126 ${
118127 if buildGitHubPages
119128 then ''
@@ -123,6 +132,7 @@ pkgs.stdenvNoCC.mkDerivation rec {
123132 else ""
124133 }
125134
135+ # install DiffDetective in "$maven" by creating a copy of "$mavenRepo" as base
126136 cp -r "$mavenRepo" "$maven"
127137 chmod u+w -R "$maven"
128138 mvn --offline -Dmaven.repo.local="$maven" -Dmaven.test.skip=true install
0 commit comments