ant: format with nixfmt-rfc-style

Also:
* Remove a stray unused comment
This commit is contained in:
Tomodachi94 2024-11-29 01:08:54 +00:00
parent 4f2b642f6c
commit 2538d58436

View File

@ -1,4 +1,11 @@
{ fetchurl, lib, stdenv, coreutils, makeWrapper, gitUpdater }: {
fetchurl,
lib,
stdenv,
coreutils,
makeWrapper,
gitUpdater,
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "ant"; pname = "ant";
@ -16,67 +23,66 @@ stdenv.mkDerivation rec {
sha256 = "1l8say86bz9gxp4yy777z7nm4j6m905pg342li1aphc14p5grvwn"; sha256 = "1l8say86bz9gxp4yy777z7nm4j6m905pg342li1aphc14p5grvwn";
}; };
installPhase = installPhase = ''
'' mkdir -p $out/bin $out/lib/ant
mkdir -p $out/bin $out/lib/ant mv * $out/lib/ant/
mv * $out/lib/ant/
# Get rid of the manual (35 MiB). Maybe we should put this in a # Get rid of the manual (35 MiB). Maybe we should put this in a
# separate output. Keep the antRun script since it's vanilla sh # separate output. Keep the antRun script since it's vanilla sh
# and needed for the <exec/> task (but since we set ANT_HOME to # and needed for the <exec/> task (but since we set ANT_HOME to
# a weird value, we have to move antRun to a weird location). # a weird value, we have to move antRun to a weird location).
# Get rid of the other Ant scripts since we provide our own. # Get rid of the other Ant scripts since we provide our own.
mv $out/lib/ant/bin/antRun $out/bin/ mv $out/lib/ant/bin/antRun $out/bin/
rm -rf $out/lib/ant/{manual,bin,WHATSNEW} rm -rf $out/lib/ant/{manual,bin,WHATSNEW}
mkdir $out/lib/ant/bin mkdir $out/lib/ant/bin
mv $out/bin/antRun $out/lib/ant/bin/ mv $out/bin/antRun $out/lib/ant/bin/
# Install ant-contrib. # Install ant-contrib.
unpackFile $contrib unpackFile $contrib
cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/ cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/
cat >> $out/bin/ant <<EOF cat >> $out/bin/ant <<EOF
#! ${stdenv.shell} -e #! ${stdenv.shell} -e
ANT_HOME=$out/lib/ant ANT_HOME=$out/lib/ant
# Find the JDK by looking for javac. As a fall-back, find the # Find the JDK by looking for javac. As a fall-back, find the
# JRE by looking for java. The latter allows just the JRE to be # JRE by looking for java. The latter allows just the JRE to be
# used with (say) ECJ as the compiler. Finally, allow the GNU # used with (say) ECJ as the compiler. Finally, allow the GNU
# JVM. # JVM.
if [ -z "\''${JAVA_HOME-}" ]; then if [ -z "\''${JAVA_HOME-}" ]; then
for i in javac java gij; do for i in javac java gij; do
if p="\$(type -p \$i)"; then if p="\$(type -p \$i)"; then
export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))" export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))"
break break
fi fi
done done
if [ -z "\''${JAVA_HOME-}" ]; then if [ -z "\''${JAVA_HOME-}" ]; then
echo "\$0: cannot find the JDK or JRE" >&2 echo "\$0: cannot find the JDK or JRE" >&2
exit 1 exit 1
fi fi
fi fi
if [ -z \$NIX_JVM ]; then if [ -z \$NIX_JVM ]; then
if [ -e \$JAVA_HOME/bin/java ]; then if [ -e \$JAVA_HOME/bin/java ]; then
NIX_JVM=\$JAVA_HOME/bin/java NIX_JVM=\$JAVA_HOME/bin/java
elif [ -e \$JAVA_HOME/bin/gij ]; then elif [ -e \$JAVA_HOME/bin/gij ]; then
NIX_JVM=\$JAVA_HOME/bin/gij NIX_JVM=\$JAVA_HOME/bin/gij
else else
NIX_JVM=java NIX_JVM=java
fi fi
fi fi
LOCALCLASSPATH="\$ANT_HOME/lib/ant-launcher.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH" LOCALCLASSPATH="\$ANT_HOME/lib/ant-launcher.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH"
exec \$NIX_JVM \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \ exec \$NIX_JVM \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \
-Dant.home=\$ANT_HOME -Dant.library.dir="\$ANT_LIB" \ -Dant.home=\$ANT_HOME -Dant.library.dir="\$ANT_LIB" \
org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS \ org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS \
-cp "\$CLASSPATH" "\$@" -cp "\$CLASSPATH" "\$@"
EOF EOF
chmod +x $out/bin/ant chmod +x $out/bin/ant
''; # */ '';
passthru = { passthru = {
updateScript = gitUpdater { updateScript = gitUpdater {