2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv
|
2020-11-30 08:33:03 +00:00
|
|
|
, fetchurl
|
|
|
|
, jdk
|
2022-02-10 20:34:41 +00:00
|
|
|
, gradle_7
|
|
|
|
, perl
|
2020-11-30 08:33:03 +00:00
|
|
|
, jre
|
|
|
|
, makeWrapper
|
2022-02-10 20:34:41 +00:00
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
2022-04-27 09:35:20 +00:00
|
|
|
, testers
|
2020-11-30 08:33:03 +00:00
|
|
|
, key
|
|
|
|
}:
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
let
|
2020-11-30 08:33:03 +00:00
|
|
|
pname = "key";
|
2022-02-10 20:34:41 +00:00
|
|
|
version = "2.10.0";
|
2020-11-30 08:33:03 +00:00
|
|
|
src = fetchurl {
|
2022-02-10 20:34:41 +00:00
|
|
|
url = "https://www.key-project.org/dist/${version}/key-${version}-sources.tgz";
|
|
|
|
sha256 = "1f201cbcflqd1z6ysrkh3mff5agspw3v74ybdc3s2lfdyz3b858w";
|
2020-11-30 08:33:03 +00:00
|
|
|
};
|
2022-02-10 20:34:41 +00:00
|
|
|
sourceRoot = "key-${version}/key";
|
2020-11-30 08:33:03 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
# fake build to pre-download deps into fixed-output derivation
|
|
|
|
deps = stdenv.mkDerivation {
|
|
|
|
pname = "${pname}-deps";
|
|
|
|
inherit version src sourceRoot;
|
|
|
|
nativeBuildInputs = [ gradle_7 perl ];
|
|
|
|
buildPhase = ''
|
|
|
|
export GRADLE_USER_HOME=$(mktemp -d)
|
|
|
|
# https://github.com/gradle/gradle/issues/4426
|
|
|
|
${lib.optionalString stdenv.isDarwin "export TERM=dumb"}
|
|
|
|
gradle --no-daemon classes testClasses
|
|
|
|
'';
|
|
|
|
# perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
|
|
|
|
installPhase = ''
|
|
|
|
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
|
|
|
|
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
|
|
|
|
| sh
|
|
|
|
'';
|
|
|
|
outputHashMode = "recursive";
|
2022-02-20 05:27:41 +00:00
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHash = "sha256-GjBUwJxeyJA6vGrPQVtNpcHb4CJlNlY4kHt1PT21xjo=";
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
inherit pname version src sourceRoot;
|
2020-11-30 08:33:03 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
jdk
|
2022-02-10 20:34:41 +00:00
|
|
|
gradle_7
|
2020-11-30 08:33:03 +00:00
|
|
|
makeWrapper
|
2022-02-10 20:34:41 +00:00
|
|
|
copyDesktopItems
|
2020-11-30 08:33:03 +00:00
|
|
|
];
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
executable-name = "KeY";
|
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "KeY";
|
|
|
|
exec = executable-name;
|
|
|
|
icon = "key";
|
|
|
|
comment = meta.description;
|
|
|
|
desktopName = "KeY";
|
|
|
|
genericName = "KeY";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Science" ];
|
2022-02-10 20:34:41 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
# disable tests (broken on darwin)
|
|
|
|
gradleAction = if stdenv.isDarwin then "assemble" else "build";
|
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
buildPhase = ''
|
2022-02-10 20:34:41 +00:00
|
|
|
runHook preBuild
|
2020-11-30 08:33:03 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
export GRADLE_USER_HOME=$(mktemp -d)
|
|
|
|
# https://github.com/gradle/gradle/issues/4426
|
|
|
|
${lib.optionalString stdenv.isDarwin "export TERM=dumb"}
|
|
|
|
# point to offline repo
|
|
|
|
sed -ie "s#repositories {#repositories { maven { url '${deps}' }#g" build.gradle
|
|
|
|
cat <(echo "pluginManagement { repositories { maven { url '${deps}' } } }") settings.gradle > settings_new.gradle
|
|
|
|
mv settings_new.gradle settings.gradle
|
|
|
|
gradle --offline --no-daemon ${gradleAction}
|
|
|
|
|
|
|
|
runHook postBuild
|
2020-11-30 08:33:03 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2022-02-10 20:34:41 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
mkdir -p $out/share/java
|
2022-02-10 20:34:41 +00:00
|
|
|
cp key.ui/build/libs/key-*-exe.jar $out/share/java/KeY.jar
|
2020-11-30 08:33:03 +00:00
|
|
|
mkdir -p $out/bin
|
2022-02-10 20:34:41 +00:00
|
|
|
mkdir -p $out/share/icons/hicolor/256x256/apps
|
|
|
|
cp key.ui/src/main/resources/de/uka/ilkd/key/gui/images/key-color-icon-square.png $out/share/icons/hicolor/256x256/apps/key.png
|
2020-11-30 08:33:03 +00:00
|
|
|
makeWrapper ${jre}/bin/java $out/bin/KeY \
|
|
|
|
--add-flags "-cp $out/share/java/KeY.jar de.uka.ilkd.key.core.Main"
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-11-30 08:33:03 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
passthru.tests.version =
|
2022-04-27 09:35:20 +00:00
|
|
|
testers.testVersion {
|
2021-05-20 23:08:51 +00:00
|
|
|
package = key;
|
|
|
|
command = "KeY --help";
|
|
|
|
};
|
2020-11-30 08:33:03 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-11-30 08:33:03 +00:00
|
|
|
description = "Java formal verification tool";
|
|
|
|
homepage = "https://www.key-project.org"; # also https://formal.iti.kit.edu/key/
|
|
|
|
longDescription = ''
|
|
|
|
The KeY System is a formal software development tool that aims to
|
|
|
|
integrate design, implementation, formal specification, and formal
|
|
|
|
verification of object-oriented software as seamlessly as possible.
|
|
|
|
At the core of the system is a novel theorem prover for the first-order
|
|
|
|
Dynamic Logic for Java with a user-friendly graphical interface.
|
|
|
|
'';
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ fgaz ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = executable-name;
|
2020-11-30 08:33:03 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|