Merge pull request #300346 from wegank/aspectj-refactor

aspectj: refactor
This commit is contained in:
Weijia Wang 2024-04-03 13:24:15 +02:00 committed by GitHub
commit c0d2398ba6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 43 additions and 40 deletions

View file

@ -1,28 +0,0 @@
if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
source $stdenv/setup
export JAVA_HOME=$jre
cat >> props <<EOF
output.dir=$out
context.javaPath=$jre
EOF
mkdir -p $out
$jre/bin/java -jar $src -text props
echo "Removing files at top level"
for file in $out/*
do
if test -f $file ; then
rm $file
fi
done
cat >> $out/bin/aj-runtime-env <<EOF
#! $SHELL
export CLASSPATH=$CLASSPATH:.:$out/lib/aspectjrt.jar
EOF
chmod u+x $out/bin/aj-runtime-env

View file

@ -1,25 +1,56 @@
{lib, stdenv, fetchurl, jre}:
{
lib,
stdenvNoCC,
fetchurl,
jre,
}:
stdenv.mkDerivation rec {
pname = "aspectj";
let
version = "1.9.21.2";
builder = ./builder.sh;
versionSnakeCase = builtins.replaceStrings [ "." ] [ "_" ] version;
in
stdenvNoCC.mkDerivation {
pname = "aspectj";
inherit version;
src = let
versionSnakeCase = builtins.replaceStrings ["."] ["_"] version;
in fetchurl {
__structuredAttrs = true;
src = fetchurl {
url = "https://github.com/eclipse/org.aspectj/releases/download/V${versionSnakeCase}/aspectj-${version}.jar";
sha256 = "sha256-wqQtyopS03zX+GJme5YZwWiACqO4GAYFr3XAjzqSFnQ=";
hash = "sha256-wqQtyopS03zX+GJme5YZwWiACqO4GAYFr3XAjzqSFnQ=";
};
inherit jre;
buildInputs = [jre];
dontUnpack = true;
nativeBuildInputs = [ jre ];
installPhase = ''
runHook preInstall
cat >> props <<EOF
output.dir=$out
context.javaPath=${jre}
EOF
mkdir -p $out
java -jar $src -text props
cat >> $out/bin/aj-runtime-env <<EOF
#! ${stdenvNoCC.shell}
export CLASSPATH=$CLASSPATH:.:$out/lib/aspectjrt.jar
EOF
chmod u+x $out/bin/aj-runtime-env
runHook postInstall
'';
meta = {
homepage = "https://www.eclipse.org/aspectj/";
description = "A seamless aspect-oriented extension to the Java programming language";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
platforms = lib.platforms.unix;
license = lib.licenses.epl10;
platforms = lib.platforms.unix;
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
};
}