about summary refs log tree commit diff
path: root/pkgs/development/compilers/aspectj/default.nix
blob: 50c54b66b73c442e0416911a74528e7497089d90 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
  lib,
  stdenvNoCC,
  fetchurl,
  jre,
}:

let
  version = "1.9.21.2";
  versionSnakeCase = builtins.replaceStrings [ "." ] [ "_" ] version;
in
stdenvNoCC.mkDerivation {
  pname = "aspectj";
  inherit version;

  __structuredAttrs = true;

  src = fetchurl {
    url = "https://github.com/eclipse/org.aspectj/releases/download/V${versionSnakeCase}/aspectj-${version}.jar";
    hash = "sha256-wqQtyopS03zX+GJme5YZwWiACqO4GAYFr3XAjzqSFnQ=";
  };

  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";
    license = lib.licenses.epl10;
    platforms = lib.platforms.unix;
    sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
  };
}