Skip to content

Commit

Permalink
ant: modernize, update primary name (#360077)
Browse files Browse the repository at this point in the history
  • Loading branch information
philiptaron authored Nov 29, 2024
2 parents 01c33fb + 0b87b1f commit b61dffc
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 122 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,8 @@ ce21e97a1f20dee15da85c084f9d1148d84f853b
# sqlc: format with nixfmt
2bdec131b2bb2c8563f4556d741d34ccb77409e2

# ant: format with nixfmt-rfc-style
2538d58436b8d0b56d29780aeebf4bf720ddb9ea

# treewide: migrate packages to pkgs/by-name, take 1
571c71e6f73af34a229414f51585738894211408
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
- pkgs/by-name/ma/maven/**/*
- doc/languages-frameworks/maven.section.md
# Ant
- pkgs/by-name/ap/apacheAnt/**/*
- pkgs/by-name/an/ant/**/*
# javaPackages attrset
- pkgs/development/java-modules/**/*
- pkgs/top-level/java-packages.nix
Expand Down
125 changes: 125 additions & 0 deletions pkgs/by-name/an/ant/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
fetchurl,
lib,
stdenv,
coreutils,
makeWrapper,
gitUpdater,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "ant";
version = "1.10.15";

nativeBuildInputs = [ makeWrapper ];

src = fetchurl {
url = "mirror://apache/ant/binaries/apache-ant-${finalAttrs.version}-bin.tar.bz2";
hash = "sha256-h/SNGLoRwRVojDfvl1g+xv+J6mAz+J2BimckjaRxDEs=";
};

contrib = fetchurl {
url = "mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2";
sha256 = "1l8say86bz9gxp4yy777z7nm4j6m905pg342li1aphc14p5grvwn";
};

installPhase = ''
mkdir -p $out/bin $out/lib/ant
mv * $out/lib/ant/
# 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
# 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).
# Get rid of the other Ant scripts since we provide our own.
mv $out/lib/ant/bin/antRun $out/bin/
rm -rf $out/lib/ant/{manual,bin,WHATSNEW}
mkdir $out/lib/ant/bin
mv $out/bin/antRun $out/lib/ant/bin/
# Install ant-contrib.
unpackFile $contrib
cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/
cat >> $out/bin/ant <<EOF
#! ${stdenv.shell} -e
ANT_HOME=$out/lib/ant
# 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
# used with (say) ECJ as the compiler. Finally, allow the GNU
# JVM.
if [ -z "\''${JAVA_HOME-}" ]; then
for i in javac java gij; do
if p="\$(type -p \$i)"; then
export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))"
break
fi
done
if [ -z "\''${JAVA_HOME-}" ]; then
echo "\$0: cannot find the JDK or JRE" >&2
exit 1
fi
fi
if [ -z \$NIX_JVM ]; then
if [ -e \$JAVA_HOME/bin/java ]; then
NIX_JVM=\$JAVA_HOME/bin/java
elif [ -e \$JAVA_HOME/bin/gij ]; then
NIX_JVM=\$JAVA_HOME/bin/gij
else
NIX_JVM=java
fi
fi
LOCALCLASSPATH="\$ANT_HOME/lib/ant-launcher.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH"
exec \$NIX_JVM \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \
-Dant.home=\$ANT_HOME -Dant.library.dir="\$ANT_LIB" \
org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS \
-cp "\$CLASSPATH" "\$@"
EOF
chmod +x $out/bin/ant
'';

passthru = {
updateScript = gitUpdater {
rev-prefix = "rel/";
url = "https://gitbox.apache.org/repos/asf/ant";
};
};

meta = {
homepage = "https://ant.apache.org/";
description = "Java-based build tool";
mainProgram = "ant";

longDescription = ''
Apache Ant is a Java-based build tool. In theory, it is kind of like
Make, but without Make's wrinkles.
Why another build tool when there is already make, gnumake, nmake, jam,
and others? Because all those tools have limitations that Ant's
original author couldn't live with when developing software across
multiple platforms. Make-like tools are inherently shell-based -- they
evaluate a set of dependencies, then execute commands not unlike what
you would issue in a shell. This means that you can easily extend
these tools by using or writing any program for the OS that you are
working on. However, this also means that you limit yourself to the
OS, or at least the OS type such as Unix, that you are working on.
Ant is different. Instead of a model where it is extended with
shell-based commands, Ant is extended using Java classes. Instead of
writing shell commands, the configuration files are XML-based, calling
out a target tree where various tasks get executed. Each task is run
by an object that implements a particular Task interface.
'';

sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.asl20;
maintainers = [ ] ++ lib.teams.java.members;
platforms = lib.platforms.all;
};
})
119 changes: 0 additions & 119 deletions pkgs/by-name/ap/apacheAnt/package.nix

This file was deleted.

1 change: 1 addition & 0 deletions pkgs/top-level/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ mapAliases {
ao = libfive; # Added 2024-10-11
apacheKafka_3_5 = throw "apacheKafka_2_8 through _3_5 have been removed from nixpkgs as outdated"; # Added 2024-06-13
antimicroX = throw "'antimicroX' has been renamed to/replaced by 'antimicrox'"; # Converted to throw 2024-10-17
apacheAnt = ant; # Added 2024-11-28
appthreat-depscan = dep-scan; # Added 2024-04-10
arcanist = throw "arcanist was removed as phabricator is not supported and does not accept fixes"; # Added 2024-06-07
aria = aria2; # Added 2024-03-26
Expand Down
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7808,8 +7808,6 @@ with pkgs;

antlr = antlr4;

ant = apacheAnt;

inherit (callPackages ../servers/apache-kafka { })
apacheKafka_3_6
apacheKafka_3_7
Expand Down

0 comments on commit b61dffc

Please sign in to comment.