Skip to content

Commit afccf8e

Browse files
authored
Merge pull request #158 from VariantSync/document-nix-results
Document nix results + some nix refactorings
2 parents fac48a9 + d8461fc commit afccf8e

2 files changed

Lines changed: 23 additions & 21 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ nix build # Flake version
6868
```
6969
In case you are using Nix Flakes, you can skip cloning the repository as usual: `nix build github:VariantSync/DiffDetective#.`
7070

71-
Afterward, the [result](result) symlink points to the [Javadoc](result/share/github-pages/DiffDetective/docs/javadoc/index.html), the [DiffDetective jar](result/share/java/DiffDetective/DiffDetective.jar) and a simple [script](result/bin/DiffDetective) for executing a DiffDetective main class provided as argument (e.g., evaluations used in previous research, see below under 'Publications').
71+
Afterward, the [result](result) symlink points to the [Javadoc](result/share/github-pages/DiffDetective/docs/javadoc/index.html), a [DiffDetective jar for use as a library](result/share/java/DiffDetective.jar), a [self contained DiffDetective jar with all dependencies included](result/share/java/DiffDetective/DiffDetective-jar-with-dependencies.jar) and a simple [script](result/bin/DiffDetective) for executing a DiffDetective main class provided as argument (e.g., evaluations used in previous research, see below under 'Publications').
7272

7373

7474
## How to Get Started

default.nix

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,27 @@ pkgs.stdenvNoCC.mkDerivation rec {
3333
# The single source of truth for the version number is stored in `pom.xml`.
3434
# Hence, this XML file needs to be parsed to extract the current version.
3535
version = pkgs.lib.removeSuffix "\n" (pkgs.lib.readFile
36-
(pkgs.runCommandLocal "DiffDetective-version" {}
37-
"${pkgs.xq-xml}/bin/xq -x '/project/version' ${./pom.xml} > $out"));
36+
(pkgs.runCommandLocal "DiffDetective-version" {
37+
nativeBuildInputs = [pkgs.xq-xml];
38+
} "xq -x '/project/version' ${./pom.xml} > $out"));
3839
src = with pkgs.lib.fileset;
3940
toSource {
4041
root = ./.;
4142
fileset = gitTracked ./.;
4243
};
4344

44-
nativeBuildInputs = with pkgs; [
45-
maven
46-
makeWrapper
47-
graphviz
48-
] ++ pkgs.lib.optional buildGitHubPages (ruby.withPackages (pkgs: with pkgs; [
49-
github-pages
50-
jekyll-theme-cayman
45+
nativeBuildInputs = [
46+
pkgs.maven
47+
pkgs.makeWrapper
48+
] ++ pkgs.lib.optional buildGitHubPages (pkgs.ruby.withPackages (rubyPkgs: [
49+
rubyPkgs.github-pages
50+
rubyPkgs.jekyll-theme-cayman
5151
]));
5252

53+
nativeCheckInputs = [
54+
pkgs.graphviz
55+
];
56+
5357
# Maven needs to download necessary dependencies which is impure because it
5458
# requires network access. Hence, we download all dependencies as a
5559
# fixed-output derivation. This also serves as a nice cache.
@@ -58,7 +62,7 @@ pkgs.stdenvNoCC.mkDerivation rec {
5862
inherit version;
5963
src = pkgs.lib.sourceByRegex ./. ["^pom.xml$" "^local-maven-repo(/.*)?$"];
6064

61-
nativeBuildInputs = with pkgs; [maven];
65+
nativeBuildInputs = [pkgs.maven];
6266

6367
buildPhase = ''
6468
runHook preBuild
@@ -93,10 +97,6 @@ pkgs.stdenvNoCC.mkDerivation rec {
9397
# build-time and run-time dependencies.
9498
outputs = ["out" "maven"];
9599

96-
jre-minimal = pkgs.callPackage (import "${sources.nixpkgs}/pkgs/development/compilers/openjdk/jre.nix") {
97-
modules = ["java.base" "java.desktop"];
98-
};
99-
100100
buildPhase = ''
101101
runHook preBuild
102102
@@ -133,16 +133,18 @@ pkgs.stdenvNoCC.mkDerivation rec {
133133
runHook preInstall
134134
135135
# install jars in "$out"
136-
install -Dm644 "target/diffdetective-${version}.jar" "$out/share/java/DiffDetective.jar"
137-
local jar="$out/share/java/DiffDetective/DiffDetective.jar"
138-
install -Dm644 "target/diffdetective-${version}-jar-with-dependencies.jar" "$jar"
139-
makeWrapper "${jre-minimal}/bin/java" "$out/bin/DiffDetective" --add-flags "-cp \"$jar\"" \
140-
--prefix PATH : "${pkgs.graphviz}/bin"
136+
install -Dm644 "target/diffdetective-$version.jar" "$out/share/java/DiffDetective.jar"
137+
local jar="$out/share/java/DiffDetective/DiffDetective-jar-with-dependencies.jar"
138+
install -Dm644 "target/diffdetective-$version-jar-with-dependencies.jar" "$jar"
139+
makeWrapper \
140+
"${pkgs.jdk}/bin/java" "$out/bin/DiffDetective" \
141+
--add-flags "-cp \"$jar\"" \
142+
--prefix PATH : "${pkgs.lib.makeBinPath [pkgs.graphviz]}"
141143
142-
# install documentation in "$out"
143144
${
144145
if buildGitHubPages
145146
then ''
147+
# install documentation in "$out"
146148
mkdir "$out/share/github-pages"
147149
cp -r _site "$out/share/github-pages/DiffDetective"
148150
''

0 commit comments

Comments
 (0)