corretto: convert to gradle setup hook

chayleaf 5e0160dc 9b470f38

+22 -26
+22 -26
pkgs/development/compilers/corretto/mk-corretto.nix
··· 31 31 32 32 dontConfigure = true; 33 33 34 - postPatch = '' 34 + postPatch = let 35 + extra_config = builtins.concatStringsSep " " extraConfig; 36 + in '' 35 37 # The rpm/deb task definitions require a Gradle plugin which we don't 36 38 # have and so the build fails. We'll simply remove them here because 37 39 # they are not needed anyways. ··· 41 43 for file in $(find installers -name "build.gradle"); do 42 44 substituteInPlace $file --replace-warn "workingDir '/usr/bin'" "workingDir '.'" 43 45 done 44 - ''; 45 - 46 46 47 - buildPhase = 48 - let 49 - # The Linux installer is placed at linux/universal/tar whereas the MacOS 50 - # one is at mac/tar. 51 - task = 52 - if stdenv.isDarwin then 53 - ":installers:mac:tar:packageBuildResults" 54 - else ":installers:linux:universal:tar:packageBuildResults"; 55 - extra_config = builtins.concatStringsSep " " extraConfig; 56 - in 57 - '' 58 - runHook preBuild 47 + gradleFlagsArray+=(-Pcorretto.extra_config="${extra_config}") 48 + ''; 59 49 60 - # Corretto's actual built is triggered via `gradle`. 61 - gradle -Pcorretto.extra_config="${extra_config}" --console=plain --no-daemon ${task} 50 + # since we dontConfigure, we must run this manually 51 + preBuild = "gradleConfigureHook"; 62 52 63 - # Prepare for the installPhase so that it looks like if a normal 64 - # OpenJDK had been built. 65 - dir=build/jdkImageName/images 66 - mkdir -p $dir 67 - file=$(find ./installers -name 'amazon-corretto-${version}*.tar.gz') 68 - tar -xzf $file -C $dir 69 - mv $dir/amazon-corretto-* $dir/jdk 53 + # The Linux installer is placed at linux/universal/tar whereas the MacOS 54 + # one is at mac/tar. 55 + gradleBuildTask = 56 + if stdenv.isDarwin then 57 + ":installers:mac:tar:build" 58 + else ":installers:linux:universal:tar:packageBuildResults"; 70 59 71 - runHook postBuild 72 - ''; 60 + postBuild = '' 61 + # Prepare for the installPhase so that it looks like if a normal 62 + # OpenJDK had been built. 63 + dir=build/jdkImageName/images 64 + mkdir -p $dir 65 + file=$(find ./installers -name 'amazon-corretto-${version}*.tar.gz') 66 + tar -xzf $file -C $dir 67 + mv $dir/amazon-corretto-* $dir/jdk 68 + '' + oldAttrs.postBuild or ""; 73 69 74 70 installPhase = oldAttrs.installPhase + '' 75 71 # The installPhase will place everything in $out/lib/openjdk and