Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ nix build # Flake version
```
In case you are using Nix Flakes, you can skip cloning the repository as usual: `nix build github:VariantSync/DiffDetective#.`

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').
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').


## How to Get Started
Expand Down
42 changes: 22 additions & 20 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,27 @@ pkgs.stdenvNoCC.mkDerivation rec {
# The single source of truth for the version number is stored in `pom.xml`.
# Hence, this XML file needs to be parsed to extract the current version.
version = pkgs.lib.removeSuffix "\n" (pkgs.lib.readFile
(pkgs.runCommandLocal "DiffDetective-version" {}
"${pkgs.xq-xml}/bin/xq -x '/project/version' ${./pom.xml} > $out"));
(pkgs.runCommandLocal "DiffDetective-version" {
nativeBuildInputs = [pkgs.xq-xml];
} "xq -x '/project/version' ${./pom.xml} > $out"));
src = with pkgs.lib.fileset;
toSource {
root = ./.;
fileset = gitTracked ./.;
};

nativeBuildInputs = with pkgs; [
maven
makeWrapper
graphviz
] ++ pkgs.lib.optional buildGitHubPages (ruby.withPackages (pkgs: with pkgs; [
github-pages
jekyll-theme-cayman
nativeBuildInputs = [
pkgs.maven
pkgs.makeWrapper
] ++ pkgs.lib.optional buildGitHubPages (pkgs.ruby.withPackages (rubyPkgs: [
rubyPkgs.github-pages
rubyPkgs.jekyll-theme-cayman
]));

nativeCheckInputs = [
pkgs.graphviz
];

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

nativeBuildInputs = with pkgs; [maven];
nativeBuildInputs = [pkgs.maven];

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

jre-minimal = pkgs.callPackage (import "${sources.nixpkgs}/pkgs/development/compilers/openjdk/jre.nix") {
modules = ["java.base" "java.desktop"];
};

buildPhase = ''
runHook preBuild

Expand Down Expand Up @@ -133,16 +133,18 @@ pkgs.stdenvNoCC.mkDerivation rec {
runHook preInstall

# install jars in "$out"
install -Dm644 "target/diffdetective-${version}.jar" "$out/share/java/DiffDetective.jar"
local jar="$out/share/java/DiffDetective/DiffDetective.jar"
install -Dm644 "target/diffdetective-${version}-jar-with-dependencies.jar" "$jar"
makeWrapper "${jre-minimal}/bin/java" "$out/bin/DiffDetective" --add-flags "-cp \"$jar\"" \
--prefix PATH : "${pkgs.graphviz}/bin"
install -Dm644 "target/diffdetective-$version.jar" "$out/share/java/DiffDetective.jar"
local jar="$out/share/java/DiffDetective/DiffDetective-jar-with-dependencies.jar"
install -Dm644 "target/diffdetective-$version-jar-with-dependencies.jar" "$jar"
makeWrapper \
"${pkgs.jdk}/bin/java" "$out/bin/DiffDetective" \
--add-flags "-cp \"$jar\"" \
--prefix PATH : "${pkgs.lib.makeBinPath [pkgs.graphviz]}"

# install documentation in "$out"
${
if buildGitHubPages
then ''
# install documentation in "$out"
mkdir "$out/share/github-pages"
cp -r _site "$out/share/github-pages/DiffDetective"
''
Expand Down