Skip to content

Commit 2e7139b

Browse files
authored
Merge pull request #178 from VariantSync/develop
Release 2.4.0
2 parents 8a229af + 5f8961c commit 2e7139b

File tree

323 files changed

+6533
-2983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

323 files changed

+6533
-2983
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
DiffDetective is an open-source Java library for variability-aware source code differencing and the **analysis of version histories of software product lines**. This means that DiffDetective can **turn a generic differencer into a variability-aware differencer** by means of a pre- or post-processing. DiffDetective is centered around **formally verified** data structures for variability (variation trees) and variability-aware diffs (variation diffs). These data structures are **generic**, and DiffDetective currently implements **C preprocessor support** to parse respective annotations when used to implement variability. The picture below depicts the process of variability-aware differencing.
1212

13-
<img alt="Variability-Aware Differencing Overview" src="docs/teaser.png" height="500" />
13+
<img alt="Variability-Aware Differencing Overview" src="src/main/java/org/variantsync/diffdetective/variation/diff/doc-files/variability-aware-differencing.png" height="500" />
1414

1515
Given two states of a C-preprocessor annotated source code file (left), for example before and after a commit, DiffDetective constructs a variability-aware diff (right) that distinguishes changes to source code from changes to variability annotations. DiffDetective can construct such a variation diff either, by first using a generic differencer, and separating the information (center path), or by first parsing both input versions to an abstract representation, a variation tree (center top and bottom), and constructing a variation diff using a tree differencing algorithm in a second step.
1616

@@ -80,6 +80,18 @@ Additionally, there is a screencast available on YouTube, guiding you through th
8080
[![DiffDetective Demonstration](docs/yt_thumbnail.png)](https://www.youtube.com/watch?v=q6ight5EDQY)
8181

8282

83+
## Supported Differencing Algorithms
84+
85+
In principle, any generic differencing algorithm (i.e, any algorithm that may operate on text or trees) can be made variability-aware with DiffDetective, as explained in our demo paper (see below). Some algorithms are integrated directly in the DiffDetective library, while others come as additional Maven projects.
86+
87+
### Shipped with DiffDetective
88+
- Git Diff as implemented by [JGit](https://github.com/eclipse-jgit/jgit)
89+
- [GumTree](https://github.com/GumTreeDiff/gumtree), and all algorithms and matching engines supported by the GumTree library
90+
91+
### Extra Modules
92+
- [TrueDiff](https://gitlab.rlp.net/plmz/truediff): Support for TrueDiff comes as [a separate Maven project](https://github.com/VariantSync/TrueDiffDetective).
93+
94+
8395
## Publications
8496

8597
### Variability-Aware Differencing with DiffDetective (FSE 2024, ⭐ [Best Demo Paper](https://2024.esec-fse.org/info/awards) ⭐)
@@ -167,9 +179,10 @@ Edge-typed variation diffs and the replication package are implemented in a fork
167179

168180
DiffDetective was extended and used within bachelor's and master's theses:
169181

182+
- _Unparsing von Datenstrukturen zur Analyse von C-Präprozessor-Variabilität_, Eugen Shulimov, Bachelor's Thesis, 2025, [DOI 10.17619/UNIPB/1-2385](http://doi.org/10.17619/UNIPB/1-2385), (german): Eugen added an unparser for variation trees, essentially inverting the horizontal arrows in our commuting diagram at the top of this README file. The unparser for variation diffs reuses the unparser for variation trees by projecting a variation diff to its two variation trees (before and after the change), unparsing the trees, and then diffing the obtained text files to eventually compute a text-based diff.
170183
- _Constructing Variation Diffs Using Tree Diffing Algorithms_, Benjamin Moosherr, Bachelor's Thesis, 2023, [DOI 10.18725/OPARU-50108](https://dx.doi.org/10.18725/OPARU-50108): Benjamin added support for tree-differencing and integrated the GumTree differencer ([Github](https://github.com/GumTreeDiff/gumtree), [Paper](https://doi.org/10.1145/2642937.2642982)). In his thesis, Benjamin also reviewed a range of quality metrics for tree-diffs with focus on their applicability for rating variability-aware diffs. The [org.variantsync.diffdetective.experiments.thesis_bm](src/main/java/org/variantsync/diffdetective/experiments/thesis_bm) package implements the corresponding empirical study and may serve as an example on how to use the tree-differencing.
171184
- _Reverse Engineering Feature-Aware Commits From Software Product-Line Repositories_, Lukas Bormann, Bachelor's Thesis, 2023, [10.18725/OPARU-47892](https://dx.doi.org/10.18725/OPARU-47892): Lukas implemented an algorithm for feature-based commit-untangling, which turns variation diff into a series of smaller diffs, each of which contains an edit to a single feature or feature formula. This work was later refined in our publication _Views on Edits to Variational Software_ illustrated above.
172-
- _Inspecting the Evolution of Feature Annotations in Configurable Software_, Lukas Güthing, Master's Thesis, 2023: Lukas implemented different edge-types for associating variability annotations within variation diffs. He published his work later at VaMoS 2024 under the title _Explaining Edits to Variability Annotations in Evolving Software Product Lines_, illustrated above.
185+
- _Inspecting the Evolution of Feature Annotations in Configurable Software_, Lukas Güthing, Master's Thesis, 2023: Lukas implemented different edge-types for associating variability annotations within variation diffs. He published his work later at VaMoS 2024 under the title _Explaining Edits to Variability Annotations in Evolving Software Product Lines_, illustrated above. His work can be found in a [fork][forklg] of DiffDetective.
173186
- _Empirical Evaluation of Feature Trace Recording on the Edit History of Marlin_, Sören Viegener, Bachelor's Thesis, 2021, [DOI 10.18725/OPARU-38603](http://dx.doi.org/10.18725/OPARU-38603): In his thesis, Sören started the DiffDetective project and implemented the first version of an algorithm, which parses text-based diffs to C-preprocessor files to variation diffs. He also came up with an initial classification of edits, which we wanted to reuse to evaluate [Feature Trace Recording](https://variantsync.github.io/FeatureTraceRecording/), a method for deriving variability annotations from annotated patches.
174187

175188
[documentation]: https://variantsync.github.io/DiffDetective/docs/javadoc

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
doCheck ? true,
2828
buildGitHubPages ? true,
29-
dependenciesHash ? "sha256-OdagSk6jYCkkw/kPoOJlma9yEK7hMBcNkuxE6qt0ra8=",
29+
dependenciesHash ? "sha256-xQG7IjBROSXfMIe7kvU8fXfKShdqKwVaJR0y97jsZWU=",
3030
}:
3131
pkgs.stdenvNoCC.mkDerivation rec {
3232
pname = "DiffDetective";
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Project name | Domain | Source code available (\*\*y\*\*es/\*\*n\*\*o)? | Is it a git repository (\*\*y\*\*es/\*\*n\*\*o)? | Repository URL | Clone URL | Estimated number of commits
2+
-------------------|-------------------------|-------------------------------------------------|--------------------------------------------------|--------------------------------------------------------------|----------------------------------------------------|---------------------------------
3+
berkeley-db-libdb | database system | y | y | https://github.com/berkeleydb/libdb | https://github.com/berkeleydb/libdb.git | 7
4+
sylpheed | e-mail client | y | y | https://github.com/jan0sch/sylpheed | https://github.com/jan0sch/sylpheed.git | 2,682
5+
vim | text editor | y | y | https://github.com/vim/vim | https://github.com/vim/vim.git | 17,109

docs/teaser.png

-286 KB
Binary file not shown.

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>org.variantsync</groupId>
88
<artifactId>diffdetective</artifactId>
99
<!-- The DiffDetective version, needs to be the first version tag in this file. -->
10-
<version>2.3.0</version>
10+
<version>2.4.0</version>
1111

1212
<properties>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -163,7 +163,7 @@
163163
<dependency>
164164
<groupId>org.apache.commons</groupId>
165165
<artifactId>commons-lang3</artifactId>
166-
<version>3.17.0</version>
166+
<version>3.18.0</version>
167167
</dependency>
168168

169169
<dependency>

replication/thesis-es/Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM alpine:3.15
4+
# PACKAGE STAGE
5+
6+
# Prepare the compile environment. JDK is automatically installed
7+
RUN apk add maven
8+
9+
# Create and navigate to a working directory
10+
WORKDIR /home/user
11+
12+
COPY local-maven-repo ./local-maven-repo
13+
14+
# Copy the source code
15+
COPY src ./src
16+
# Copy the pom.xml if Maven is used
17+
COPY pom.xml .
18+
# Execute the maven package process
19+
RUN mvn package || exit
20+
21+
FROM alpine:3.15
22+
23+
# Create a user
24+
RUN adduser --disabled-password --home /home/sherlock --gecos '' sherlock
25+
26+
RUN apk add --no-cache --upgrade bash
27+
RUN apk add --update openjdk17
28+
29+
# Change into the home directory
30+
WORKDIR /home/sherlock
31+
32+
# Copy the compiled JAR file from the first stage into the second stage
33+
# Syntax: COPY --from=STAGE_ID SOURCE_PATH TARGET_PATH
34+
WORKDIR /home/sherlock/holmes
35+
COPY --from=0 /home/user/target/diffdetective-*-jar-with-dependencies.jar ./DiffDetective.jar
36+
WORKDIR /home/sherlock
37+
RUN mkdir results
38+
39+
# Copy the setup
40+
COPY docs holmes/docs
41+
42+
# Copy the docker resources
43+
COPY docker/* ./
44+
COPY replication/thesis-es/docker/* ./
45+
RUN mkdir DiffDetectiveMining
46+
47+
# Adjust permissions
48+
RUN chown sherlock:sherlock /home/sherlock -R
49+
RUN chmod +x execute.sh
50+
RUN chmod +x entrypoint.sh
51+
RUN chmod +x fix-perms.sh
52+
53+
# Set the entrypoint
54+
ENTRYPOINT ["./entrypoint.sh", "./execute.sh"]
55+
56+
# Set the user
57+
USER sherlock

replication/thesis-es/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
![Maven](https://github.com/VariantSync/DiffDetective/actions/workflows/maven.yml/badge.svg)
2+
[![Documentation](https://img.shields.io/badge/Documentation-Read-purple)][documentation]
3+
[![Install](https://img.shields.io/badge/Install-Instructions-blue)](INSTALL.md)
4+
[![GitHubPages](https://img.shields.io/badge/GitHub%20Pages-online-blue.svg?style=flat)][website]
5+
[![License](https://img.shields.io/badge/License-GNU%20LGPLv3-blue)](../../LICENSE.LGPL3)
6+
7+
# Unparsing Experiment
8+
This is an experiment for the bachelor thesis by Eugen Shulimov which tests the unparser for variation trees and diffs.
9+
10+
### Prerequisite
11+
All following commands assume that working directory of your terminal is the `thesis-es` directory. Please switch directories, if this is not the case:
12+
```shell
13+
cd DiffDetective/replication/thesis-es
14+
```
15+
16+
### Build the Docker container
17+
Start the docker deamon.
18+
Clone this repository.
19+
Open a terminal and navigate to the root directory of this repository.
20+
To build the Docker container you can run the `build` script corresponding to your operating system.
21+
#### Windows:
22+
`.\build.bat`
23+
#### Linux/Mac (bash):
24+
`./build.sh`
25+
26+
### Start the experiment
27+
To execute the experiment you can run the `execute`script corresponding to your operating system.
28+
29+
#### Windows:
30+
`.\execute.bat
31+
#### Linux/Mac (bash):
32+
`./execute.sh
33+
34+
> If you want to stop the execution, you can call the provided script for stopping the container in a separate terminal.
35+
> When restarted, the execution will continue processing by restarting at the last unfinished repository.
36+
> #### Windows:
37+
> `.\stop-execution.bat`
38+
> #### Linux/Mac (bash):
39+
> `./stop-execution.sh`
40+
41+
You might see warnings or errors reported from SLF4J like `Failed to load class "org.slf4j.impl.StaticLoggerBinder"` which you can safely ignore.
42+
43+
### View the results in the [results][resultsdir] directory
44+
All raw results are stored in the [results][resultsdir] directory.
45+
46+
[documentation]: https://variantsync.github.io/DiffDetective/docs/javadoc/
47+
[website]: https://variantsync.github.io/DiffDetective/
48+
49+
[resultsdir]: results

replication/thesis-es/build.bat

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@echo off
2+
setlocal
3+
4+
set "targetSubPath=thesis-es"
5+
6+
rem Get the current directory
7+
for %%A in ("%CD%") do set "currentDir=%%~nxA"
8+
9+
rem Check if the current directory ends with the target sub-path
10+
11+
if "%currentDir:~-9%"=="%targetSubPath%" (
12+
cd ..\..
13+
docker build -t diff-detective-unparse -f replication\thesis-es\Dockerfile .
14+
@pause
15+
) else (
16+
echo error: the script must be run from inside the thesis-es directory, i.e., DiffDetective\replication\%targetSubPath%
17+
)
18+
endlocal
19+

replication/thesis-es/build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
# We have to switch to the root directory of the project and build the Docker image from there,
4+
# because Docker only allows access to the files in the current file system subtree (i.e., no access to ancestors).
5+
# We have to do this to get access to 'src', 'docker', 'local-maven-repo', etc.
6+
# For resiliency against different working directories during execution of this
7+
# script we calculate the correct path using the special bash variable
8+
# BASH_SOURCE.
9+
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit
10+
11+
docker build -t diff-detective-unparse -f replication/thesis-es/Dockerfile .
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Docker Files
2+
3+
This directory contains the files that are required to run the Docker container.
4+
5+
## Execution
6+
The [`execute.sh`](execute.sh) script can be adjusted to run the program that should be executed by the Docker container.

0 commit comments

Comments
 (0)