mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
antBuild: run default hooks
Fixes https://github.com/NixOS/nixpkgs/issues/10931. antBuild overrides buildPhase and installPhase without calling default hooks.
This commit is contained in:
parent
50a981f2e4
commit
bb3fc68b30
@ -28,7 +28,7 @@ stdenv.mkDerivation (
|
|||||||
postPhases =
|
postPhases =
|
||||||
["generateWrappersPhase" "finalPhase"];
|
["generateWrappersPhase" "finalPhase"];
|
||||||
|
|
||||||
prePhases =
|
prePhases =
|
||||||
["antSetupPhase"];
|
["antSetupPhase"];
|
||||||
|
|
||||||
antSetupPhase = with stdenv.lib; ''
|
antSetupPhase = with stdenv.lib; ''
|
||||||
@ -41,8 +41,10 @@ stdenv.mkDerivation (
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out/share/java
|
mkdir -p $out/share/java
|
||||||
${ if jars == [] then ''
|
${ if jars == [] then ''
|
||||||
find . -name "*.jar" | xargs -I{} cp -v {} $out/share/java
|
find . -name "*.jar" | xargs -I{} cp -v {} $out/share/java
|
||||||
'' else stdenv.lib.concatMapStrings (j: ''
|
'' else stdenv.lib.concatMapStrings (j: ''
|
||||||
cp -v ${j} $out/share/java
|
cp -v ${j} $out/share/java
|
||||||
@ -53,13 +55,15 @@ stdenv.mkDerivation (
|
|||||||
canonicalizeJar $j
|
canonicalizeJar $j
|
||||||
echo file jar $j >> $out/nix-support/hydra-build-products
|
echo file jar $j >> $out/nix-support/hydra-build-products
|
||||||
done
|
done
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
generateWrappersPhase =
|
generateWrappersPhase =
|
||||||
let
|
let
|
||||||
cp = w: "-cp '${lib.optionalString (w ? classPath) w.classPath}${lib.optionalString (w ? mainClass) ":$out/share/java/*"}'";
|
cp = w: "-cp '${lib.optionalString (w ? classPath) w.classPath}${lib.optionalString (w ? mainClass) ":$out/share/java/*"}'";
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
header "Generating jar wrappers"
|
header "Generating jar wrappers"
|
||||||
'' + (stdenv.lib.concatMapStrings (w: ''
|
'' + (stdenv.lib.concatMapStrings (w: ''
|
||||||
|
|
||||||
@ -75,15 +79,19 @@ stdenv.mkDerivation (
|
|||||||
closeNest
|
closeNest
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = if antTargets == [] then ''
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
'' + (if antTargets == [] then ''
|
||||||
header "Building default ant target"
|
header "Building default ant target"
|
||||||
ant ${antFlags}
|
ant ${antFlags}
|
||||||
closeNest
|
closeNest
|
||||||
'' else stdenv.lib.concatMapStrings (t: ''
|
'' else stdenv.lib.concatMapStrings (t: ''
|
||||||
header "Building '${t}' target"
|
header "Building '${t}' target"
|
||||||
ant ${antFlags} ${t}
|
ant ${antFlags} ${t}
|
||||||
closeNest
|
closeNest
|
||||||
'') antTargets;
|
'') antTargets) + ''
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
finalPhase =
|
finalPhase =
|
||||||
''
|
''
|
||||||
@ -95,11 +103,11 @@ stdenv.mkDerivation (
|
|||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeAttrs args ["antProperties" "buildInputs" "pkgs" "jarWrappers"] //
|
// removeAttrs args ["antProperties" "buildInputs" "pkgs" "jarWrappers"] //
|
||||||
|
|
||||||
{
|
{
|
||||||
name = name + (if src ? version then "-" + src.version else "");
|
name = name + (if src ? version then "-" + src.version else "");
|
||||||
|
|
||||||
buildInputs = [ant jre zip unzip] ++ stdenv.lib.optional (args ? buildInputs) args.buildInputs ;
|
buildInputs = [ant jre zip unzip] ++ stdenv.lib.optional (args ? buildInputs) args.buildInputs ;
|
||||||
|
|
||||||
postHook = ''
|
postHook = ''
|
||||||
@ -109,6 +117,6 @@ stdenv.mkDerivation (
|
|||||||
|
|
||||||
origSrc=$src
|
origSrc=$src
|
||||||
src=$(findTarball $src)
|
src=$(findTarball $src)
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user