corretto: convert to gradle setup hook

chayleaf 5e0160dc 9b470f38

+22 -26
+22 -26
pkgs/development/compilers/corretto/mk-corretto.nix
··· 31 32 dontConfigure = true; 33 34 - postPatch = '' 35 # The rpm/deb task definitions require a Gradle plugin which we don't 36 # have and so the build fails. We'll simply remove them here because 37 # they are not needed anyways. ··· 41 for file in $(find installers -name "build.gradle"); do 42 substituteInPlace $file --replace-warn "workingDir '/usr/bin'" "workingDir '.'" 43 done 44 - ''; 45 - 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 59 60 - # Corretto's actual built is triggered via `gradle`. 61 - gradle -Pcorretto.extra_config="${extra_config}" --console=plain --no-daemon ${task} 62 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 70 71 - runHook postBuild 72 - ''; 73 74 installPhase = oldAttrs.installPhase + '' 75 # The installPhase will place everything in $out/lib/openjdk and
··· 31 32 dontConfigure = true; 33 34 + postPatch = let 35 + extra_config = builtins.concatStringsSep " " extraConfig; 36 + in '' 37 # The rpm/deb task definitions require a Gradle plugin which we don't 38 # have and so the build fails. We'll simply remove them here because 39 # they are not needed anyways. ··· 43 for file in $(find installers -name "build.gradle"); do 44 substituteInPlace $file --replace-warn "workingDir '/usr/bin'" "workingDir '.'" 45 done 46 47 + gradleFlagsArray+=(-Pcorretto.extra_config="${extra_config}") 48 + ''; 49 50 + # since we dontConfigure, we must run this manually 51 + preBuild = "gradleConfigureHook"; 52 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"; 59 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 ""; 69 70 installPhase = oldAttrs.installPhase + '' 71 # The installPhase will place everything in $out/lib/openjdk and