-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdefault.nix
107 lines (90 loc) · 2.55 KB
/
default.nix
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{
sources ? import ./nix/sources.nix,
system ? builtins.currentSystem,
pkgs ?
import sources.nixpkgs {
overlays = [];
config = {};
inherit system;
},
doCheck ? true,
buildJavadoc ? true,
}:
pkgs.stdenv.mkDerivation rec {
pname = "DiffDetective";
version = "2.0.0";
src = ./.;
nativeBuildInputs = with pkgs; [
maven
makeWrapper
graphviz
];
mavenRepo = pkgs.stdenv.mkDerivation {
pname = "${pname}-mavenRepo";
inherit version;
src = pkgs.lib.sourceByRegex ./. ["^pom.xml$" "^local-maven-repo(/.*)?$"];
nativeBuildInputs = with pkgs; [maven];
buildPhase = ''
mvn org.apache.maven.plugins:maven-dependency-plugin:3.6.0:go-offline -Dmaven.repo.local="$out"
'';
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
installPhase = ''
find "$out" -type f \
\( -name \*.lastUpdated -or \
-name resolver-status.properties -or \
-name _remote.repositories \) \
-delete
'';
dontFixup = true;
dontConfigure = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-qIKFqNwooJ0iqzkv6TTS5GM4bA6iYkVa35zqE+q5izY=";
};
buildPhase = ''
runHook preBuild
mvn --offline -Dmaven.repo.local="$mavenRepo" -Dmaven.test.skip=true clean package ${
if buildJavadoc
then "javadoc:javadoc"
else ""
}
runHook postBuild
'';
inherit doCheck;
checkPhase = ''
runHook postTest
mvn --offline -Dmaven.repo.local="$mavenRepo" test
runHook postTest
'';
installPhase = ''
runHook postInstall
local jar="$out/share/java/DiffDetective/DiffDetective.jar"
install -Dm644 "target/diffdetective-${version}-jar-with-dependencies.jar" "$jar"
makeWrapper "${pkgs.maven.jdk}/bin/java" "$out/bin/DiffDetective" --add-flags "-cp \"$jar\"" \
--prefix PATH : "${pkgs.graphviz}"
${
if buildJavadoc
then ''
local doc="$out/share/doc"
mkdir -p "$doc"
cp -r docs/javadoc "$doc/DiffDetective"
''
else ""
}
runHook postInstall
'';
meta = {
description = "DiffDetective is a library for analysing changes to software product lines";
homepage = "https://github.com/VariantSync/DiffDetective";
license = pkgs.lib.licenses.lgpl3;
platforms = pkgs.maven.meta.platforms;
maintainers = [
{
name = "Benjamin Moosherr";
email = "[email protected]";
github = "ibbem";
githubId = 61984399;
}
];
};
}