Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
a963735
feat: flags for TextDiffToTikz + better defaults
pmbittner Oct 14, 2024
607a18d
nix: Add and fix the phase hooks
ibbem Nov 1, 2024
7a73759
nix: Remove even more impure files from the maven repo
ibbem Nov 1, 2024
f6a2956
nix: Also provide the jar without all the bundled depedencies
ibbem Nov 1, 2024
4104e6a
nix: Add the maven repository as additional output
ibbem Nov 1, 2024
daa7df9
nix: Provide the `dependenciesHash` as argument
ibbem Nov 15, 2024
e69411c
nix: Document the implementation of default.nix
ibbem Jan 7, 2025
abe6cfd
chore(deps): Update GitHub actions dependencies
ibbem Feb 6, 2025
07756a1
Merge pull request #151 from VariantSync/enhance-nix-setup
ibbem Feb 10, 2025
392feed
Inline PropositionalFormulaParser
ibbem Feb 11, 2025
e2da89e
Reduce repeated code in ControllingCExpressionVisitor
ibbem Feb 11, 2025
842b7bb
Keep all special characters in boolean abstraction
ibbem Feb 12, 2025
8fde557
Simplify the preprocessor formula regexes
ibbem Feb 12, 2025
dd46fb8
Inline and remove AbstractingFormulaExtractor
ibbem Feb 13, 2025
11efdd9
Treat `#ifdef A` like `#if defined(A)` instead of `#if A`
ibbem Feb 13, 2025
cf5b3cb
Fix capitalization of UncheckedUnParseableFormulaException
ibbem Feb 14, 2025
83c755c
Add a missing `@Override`
ibbem Feb 14, 2025
d13d5ac
CI: Use a faster method to install Nix
ibbem Mar 28, 2025
da11a13
CI: Cache dependencies between runs
ibbem Mar 28, 2025
d8bfef1
CI: Remove the caching mechanism
ibbem Mar 31, 2025
76f7b07
CI: Disable network accesses by github-pages
ibbem Mar 30, 2025
73144c4
Merge pull request #156 from VariantSync/fix-CI-cache-restore
pmbittner Mar 31, 2025
fac48a9
Merge pull request #155 from VariantSync/improve-boolean-abstraction
pmbittner Mar 31, 2025
79262ac
README: Document the purpose of the two jars built by Nix
ibbem Apr 2, 2025
a54b459
nix: Rename the JAR with dependencies
ibbem Apr 2, 2025
92680ee
nix: Do not reduce the size of the JDK
ibbem Apr 3, 2025
5d3a844
nix: Reduce the usage of the `with` syntax
ibbem Apr 3, 2025
f64da89
nix: Specify dependencies a little bit more accurately
ibbem Apr 3, 2025
81e033c
nix: Expand variables as late as possible
ibbem Apr 3, 2025
c59db0e
nix: Improve some code formatting
ibbem Apr 3, 2025
d8461fc
nix: Use a specific helper to improve robustness
ibbem Apr 3, 2025
afccf8e
Merge pull request #158 from VariantSync/document-nix-results
pmbittner Apr 3, 2025
77a9c02
refactor: Use FormulaUtils where appropriate
ibbem Apr 3, 2025
bac167d
Merge pull request #159 from VariantSync/use-FormulaUtils
pmbittner Apr 4, 2025
f8125da
feat(nix): Invalidate the maven cache when pom.xml changes
ibbem Jun 3, 2025
a2ccec2
chore(deps): Enforce Maven version 3.6.3 or later
ibbem Jun 4, 2025
afd65e1
chore(deps): Update nixpkgs and all Maven dependencies
ibbem Jun 4, 2025
19a8518
Merge pull request #161 from VariantSync/update-dependencies
ibbem Jun 9, 2025
7d324c8
feat: Support C23/C++23 style elifdef and elifndef
ibbem Jun 3, 2025
0d1cf1c
fix: Test actually indented failures in JPPParserTest
ibbem Jun 3, 2025
326435e
refactor: Simplify the annotation parsing interfaces
ibbem Jun 9, 2025
a4979e7
fix: Reinstantiate the macro handling for Marlin
ibbem Jun 9, 2025
5bf9c77
Merge pull request #162 from VariantSync/fix-marlin-macros
pmbittner Jun 11, 2025
5d1632a
refactor: Move the default `DiffFilter` into `DiffFilter`
ibbem Apr 6, 2025
0206011
refactor: Remove some dead code
ibbem Jun 3, 2025
b07cf50
refactor: Hide the fact that Repository uses Lazy for Git
ibbem Jun 5, 2025
3ece9b2
refactor: Make GitDiffer stateless
ibbem Jun 9, 2025
58afdb5
feat: Abstract Git log calls
ibbem Jun 9, 2025
7678170
Merge pull request #163 from VariantSync/GitDiffer-refactorings
ibbem Jun 12, 2025
cbca215
fix: Count filtered commits into the total commit count
ibbem Jun 12, 2025
cd38b2b
Merge pull request #165 from VariantSync/fix-total-commit-count
ibbem Jun 12, 2025
31ffacb
fix: Manually move generated javadoc to docs/javadoc
ibbem Jun 12, 2025
e73e1ce
Merge pull request #166 from VariantSync/fix-javadoc-deployment
pmbittner Jun 13, 2025
2914752
formatting: Create a .editorconfig to nudge more consistent formatting
ibbem Jun 12, 2025
036cc34
formatting: Apply the .editorconfig to existing files
ibbem Jun 12, 2025
b90154e
Merge pull request #167 from VariantSync/editorconfig
ibbem Jun 13, 2025
1661d8c
chore: Increment DiffDetective version
ibbem Jul 2, 2025
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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

# We let Git handle end_of_line such that this setting is effectively platform
# dependent but still normalized in the Git store. See .gitattributes

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.nix]
indent_size = 2
13 changes: 5 additions & 8 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install Nix with cached packages
uses: rikhuijzer/cache-install@v.1.1.3
with:
key: nix-${{ hashFiles('.github/workflows/maven.yml', 'default.nix', 'nix/**', 'pom.xml', 'local-maven-repo') }}
nix_file: nix/github-workflow-dependencies.nix
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
# The dependencies could be cached if necessary. See PR #156 and da11a13c1451f5a52672fe494ac6e20116346865 for additional information.
- name: Build
run: nix-build
- name: Upload Javadoc artifact
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: result/share/github-pages/DiffDetective

Expand All @@ -50,7 +47,7 @@ jobs:
steps:
- name: Publish Javadoc to Github Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4

# Kill in progress deployments because only the newest version is relevant
# and concurrent deployments cause CI failures.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ To add DiffDetective as a dependency to your own project, add the following snip
<dependency>
<groupId>org.variantsync</groupId>
<artifactId>DiffDetective</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
</dependency>
```

If you prefer to just use a jar file, you can find a jar file with all dependencies at `DiffDetective/target/diffdetective-2.2.0-jar-with-dependencies.jar` (again, the version number might be different).
If you prefer to just use a jar file, you can find a jar file with all dependencies at `DiffDetective/target/diffdetective-2.3.0-jar-with-dependencies.jar` (again, the version number might be different).
You can (re-)produce this jar file by either running `mvn package` or `mvn install` within you local clone of DiffDetective.

> Disclaimer: Setup tested with maven version 3.6.3.
Expand All @@ -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
117 changes: 90 additions & 27 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,111 @@
system ? builtins.currentSystem,
pkgs ?
import sources.nixpkgs {
overlays = [];
overlays = [
(final: previous: {
defaultGemConfig = previous.defaultGemConfig // {
jekyll-github-metadata = attrs: {
dontBuild = false;
patches = [
(final.fetchpatch {
url = "https://github.com/jekyll/github-metadata/commit/17cc5af5e1fd95d98d43676610cc8a47969350ab.patch";
hash = "sha256-dUqvnYsjfG5xQIYS48B3xz0GLVYo2BrDAnYUafmDFKw=";
relative = "lib";
stripLen = 1;
extraPrefix = "lib/jekyll-github-metadata/";
})
];
};
};
})
];
config = {};
inherit system;
},
doCheck ? true,
buildGitHubPages ? true,
dependenciesHash ? "sha256-OdagSk6jYCkkw/kPoOJlma9yEK7hMBcNkuxE6qt0ra8=",
}:
pkgs.stdenvNoCC.mkDerivation rec {
pname = "DiffDetective";
# 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.
#
# We use the hash of the input files to invalidate the maven cache whenever
# the input files change. This is purely for easing maintenance. In case a
# maintainer forgets (or simply doesn't know) to change the output hash to
# force a rebuild (and obtain the new, correct hash) this usually (without
# this naming hack) result in use of a stall cash, essentially behaving like
# an unreproducable derivation where a second build results in a different
# output. By changing the name of the fixed output derivation whenever
# `mavenRepoSrc` changes, we prevent this stall cache as the resulting store
# path will never exist (except when the cache is valid).
mavenRepoSrc = pkgs.lib.sourceByRegex ./. ["^pom.xml$" "^local-maven-repo(/.*)?$"];
mavenRepoSrcName = with pkgs.lib; last (splitString "/" mavenRepoSrc.outPath);
mavenRepo = pkgs.stdenv.mkDerivation {
pname = "${pname}-mavenRepo";
pname = "${pname}-mavenRepo-${mavenRepoSrcName}";
inherit version;
src = pkgs.lib.sourceByRegex ./. ["^pom.xml$" "^local-maven-repo(/.*)?$"];
src = mavenRepoSrc;

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

buildPhase = ''
runHook preBuild

mvn org.apache.maven.plugins:maven-dependency-plugin:3.6.0:go-offline -Dmaven.repo.local="$out"

runHook postBuild
'';

# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
installPhase = ''
runHook preInstall

find "$out" -type f \
\( -name \*.lastUpdated -or \
-name resolver-status.properties -or \
-name _remote.repositories \) \
\( -not \( -name "*.pom" -o -name "*.jar" -o -name "*.sha1" -o -name "*.nbm" \) \
-o -name "maven-metadata*" \) \
-delete

runHook postInstall
'';

dontFixup = true;
dontConfigure = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-TYZP4XhM3ExLNC3H/QLch6LMVQxbR1LECwubMZn+RXY=";
outputHash = dependenciesHash;
};

jre-minimal = pkgs.callPackage (import "${sources.nixpkgs}/pkgs/development/compilers/openjdk/jre.nix") {
modules = ["java.base" "java.desktop"];
};
# - `out` contains jars, an executable wrapper and optionally documentation
# (see `buildGitHubPages`)
# - `maven` contains a local maven repository with DiffDetective and all its
# build-time and run-time dependencies.
outputs = ["out" "maven"];

buildPhase = ''
runHook preBuild
Expand All @@ -76,7 +122,8 @@ pkgs.stdenvNoCC.mkDerivation rec {
if buildGitHubPages
then ''
mvn javadoc:javadoc
JEKYLL_ENV=production PAGES_REPO_NWO=VariantSync/DiffDetective JEKYLL_BUILD_REVISION= github-pages build
mv target/reports/apidocs docs/javadoc
JEKYLL_ENV=production PAGES_REPO_NWO=VariantSync/DiffDetective JEKYLL_BUILD_REVISION= PAGES_DISABLE_NETWORK=1 github-pages build
rm -rf _site/target
''
else ""
Expand All @@ -88,30 +135,46 @@ pkgs.stdenvNoCC.mkDerivation rec {

inherit doCheck;
checkPhase = ''
runHook postTest
runHook preTest

mvn --offline -Dmaven.repo.local="$mavenRepo" test

runHook postTest
'';

installPhase = ''
runHook postInstall
runHook preInstall

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 jars in "$out"
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]}"

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

# install DiffDetective in "$maven" by creating a copy of "$mavenRepo" as base
cp -r "$mavenRepo" "$maven"
chmod u+w -R "$maven"
mvn --offline -Dmaven.repo.local="$maven" -Dmaven.test.skip=true install

# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
find "$maven" -type f \
\( -not \( -name "*.pom" -o -name "*.jar" -o -name "*.sha1" -o -name "*.nbm" \) \
-o -name "maven-metadata*" \) \
-delete

runHook postInstall
'';

Expand Down
12 changes: 6 additions & 6 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh
if [ "$(id -u)" = "0" ]; then
# running on a developer laptop as root
fix-perms -r -u user -g user /home/user
exec gosu user "$@"
# running on a developer laptop as root
fix-perms -r -u user -g user /home/user
exec gosu user "$@"
else
# running in production as a user
exec "$@"
fi
# running in production as a user
exec "$@"
fi
18 changes: 9 additions & 9 deletions docker/fix-perms.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# update the uid
if [ -n "$opt_u" ]; then
OLD_UID=$(getent passwd "${opt_u}" | cut -f3 -d:)
NEW_UID=$(stat -c "%u" "$1")
if [ "$OLD_UID" != "$NEW_UID" ]; then
echo "Changing UID of $opt_u from $OLD_UID to $NEW_UID"
usermod -u "$NEW_UID" -o "$opt_u"
if [ -n "$opt_r" ]; then
find / -xdev -user "$OLD_UID" -exec chown -h "$opt_u" {} \;
OLD_UID=$(getent passwd "${opt_u}" | cut -f3 -d:)
NEW_UID=$(stat -c "%u" "$1")
if [ "$OLD_UID" != "$NEW_UID" ]; then
echo "Changing UID of $opt_u from $OLD_UID to $NEW_UID"
usermod -u "$NEW_UID" -o "$opt_u"
if [ -n "$opt_r" ]; then
find / -xdev -user "$OLD_UID" -exec chown -h "$opt_u" {} \;
fi
fi
fi
fi
fi
Loading