fixes to ant-build

svn path=/nixpkgs/trunk/; revision=24383
This commit is contained in:
Rob Vermaas 2010-10-20 12:30:03 +00:00
parent 51ac7f1a27
commit 0df15241ca
1 changed files with 9 additions and 3 deletions

View File

@ -15,10 +15,12 @@
let let
antFlags = "-f ${buildfile} " + stdenv.lib.concatMapStrings ({name, value}: "-D${name}=${value} " ) antProperties ; antFlags = "-f ${buildfile} " + stdenv.lib.concatMapStrings ({name, value}: "-D${name}=${value} " ) antProperties ;
lib = stdenv.lib;
in in
stdenv.mkDerivation ( stdenv.mkDerivation (
{ {
inherit jre ant;
showBuildStats = true; showBuildStats = true;
postPhases = postPhases =
@ -48,14 +50,18 @@ stdenv.mkDerivation (
done done
''; '';
generateWrappersPhase = '' generateWrappersPhase =
let
cp = w: "-cp ${lib.optionalString (w ? classPath) w.classPath}${lib.optionalString (w ? mainClass) ":$out/lib/java/${w.jar}"}";
in
''
header "Generating jar wrappers" header "Generating jar wrappers"
'' + (stdenv.lib.concatMapStrings (w: '' '' + (stdenv.lib.concatMapStrings (w: ''
cat >> $out/bin/${w.name} <<EOF cat >> $out/bin/${w.name} <<EOF
#! /bin/sh #! /bin/sh
export JAVA_HOME=$jre export JAVA_HOME=$jre
$jre/bin/java ${if w ? mainClass then "-cp $out/lib/java/${w.jar} ${w.mainClass}" else "-jar $out/lib/java/${w.jar}"} \$@ $jre/bin/java ${cp w} ${if w ? mainClass then w.mainClass else "-jar ${w.jar}"} \$@
EOF EOF
chmod a+x $out/bin/${w.name} || exit 1 chmod a+x $out/bin/${w.name} || exit 1
@ -83,7 +89,7 @@ stdenv.mkDerivation (
''; '';
} }
// removeAttrs args ["antProperties" "buildInputs" "pkgs"] // // removeAttrs args ["antProperties" "buildInputs" "pkgs" "jarWrappers"] //
{ {
name = name + (if src ? version then "-" + src.version else ""); name = name + (if src ? version then "-" + src.version else "");