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 @@ -44,7 +44,7 @@ Next, build DiffDetective and install it on your system so that you can access i
mvn install
```

To add DiffDetective as a dependency to your own project, add the following snippet to the pom.xml of your Maven project, but make sure to pick the right version number. You can find the version number of DiffDetective at the top of the pom.xml file of DiffDetective.
To add DiffDetective as a dependency to your own project, add the following snippet to the pom.xml of your Maven project, but make sure to pick the right version number. The current version number can be obtained by running `scripts/version.sh`

```xml
<dependency>
Expand Down
8 changes: 6 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
doCheck ? true,
buildGitHubPages ? true,
}:
pkgs.stdenv.mkDerivation rec {
pkgs.stdenvNoCC.mkDerivation rec {
pname = "DiffDetective";
version = "2.2.0";
# 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"));
src = with pkgs.lib.fileset;
toSource {
root = ./.;
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<groupId>org.variantsync</groupId>
<artifactId>diffdetective</artifactId>
<!-- The DiffDetective version, needs to be the first version tag in this file. -->
<version>2.2.0</version>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion replication/esecfse22/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ WORKDIR /home/sherlock
# Copy the compiled JAR file from the first stage into the second stage
# Syntax: COPY --from=STAGE_ID SOURCE_PATH TARGET_PATH
WORKDIR /home/sherlock/holmes
COPY --from=0 /home/user/target/diffdetective-2.2.0-jar-with-dependencies.jar ./DiffDetective.jar
COPY --from=0 /home/user/target/diffdetective-*-jar-with-dependencies.jar ./DiffDetective.jar
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if simplifying our workspace is worth introducing potential bugs here. As you mentioned, this will break in case there are multiple built versions, right? Maybe we could have two (instead of one) version files: the pom.xml, and a version.txt (or so) which is a file that contains just the version number as plain text. We can then use this version file in all the shell scripts. Just an idea.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfiles are not at risk for this problem because they build DiffDetective with a fresh target folder hence there will never be a second jar. The .sh scripts I changed are problematic.

An alternative would be to create a script which "parses" the pom.xml and outputs the version. Then we could use that script in the other scripts. Note that this would be a very lax parser because I want to avoid introducing a dependency on something like xq for developer machines.

# extracts the first version tag in pom.xml
sed -n '/<version/ {s/.*version>\(.*\)<\/version.*/\1/; p; q}' pom.xml

Adding a second "version" file kind of defeats the purpose in my opinion.

I also tested the Dockerfile right now to verify my claim: It doesn't actually build! The most relevant errors show that there is some Java version mismatch:

54.79 [ERROR] /home/user/src/main/java/org/variantsync/diffdetective/variation/diff/Projection.java:[10,39] cannot access org.variantsync.functjonal.list.FilteredMappedListView
54.79 [ERROR]   bad class file: /root/.m2/repository/org/variantsync/functjonal/1.0-SNAPSHOT/functjonal-1.0-SNAPSHOT.jar(/org/variantsync/functjonal/list/FilteredMappedListView.class)
54.79 [ERROR]     class file has wrong version 63.0, should be 61.0
54.79 [ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.

The last Functjonal update was in 3ceefb4. What motivated this commit?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the most important thing here is to end with a robust solution that does not easily break. If we have to overcomplicate things and make everything more fragile, I am fine with just having a bit of extra work when incrementing the version number: put the burden on the developer, not the user.

Apart from that, your sed solution looks good. It should be robust enough if reused within the other scripts.

It's bad news that the Docker file breaks. We should fix this asap on main because that is what FSE reviewers see. Could you have a look at it? Should we have the docker file build functjonal by itself? It seems I messed up with rebuilding the new version of functjonal. It is probably enough to build functjonal anew with an older version of Java. (The motivation for 3ceefb4 was exactly to fix this error. Previously, I had rebuild functjonal to introduce some new feature I needed somewhere but the jar was build with an even newer version.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could repeat this error with the Dockerfile in replication/esecfse22.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in #137

WORKDIR /home/sherlock
RUN mkdir results

Expand Down
2 changes: 1 addition & 1 deletion replication/splc23-views/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ WORKDIR /home/sherlock
# Copy the compiled JAR file from the first stage into the second stage
# Syntax: COPY --from=STAGE_ID SOURCE_PATH TARGET_PATH
WORKDIR /home/sherlock/holmes
COPY --from=0 /home/user/target/diffdetective-2.2.0-jar-with-dependencies.jar ./DiffDetective.jar
COPY --from=0 /home/user/target/diffdetective-*-jar-with-dependencies.jar ./DiffDetective.jar
WORKDIR /home/sherlock

# Copy the setup
Expand Down
8 changes: 6 additions & 2 deletions scripts/genUltimateResults.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
resultsdir=$1
#!/usr/bin/env bash

java -cp "target/diffdetective-2.2.0-jar-with-dependencies.jar" org.variantsync.diffdetective.tablegen.MiningResultAccumulator $resultsdir $resultsdir
resultsdir="$1"

cd "$(dirname "${BASH_SOURCE[0]}")/.." || exit 1

java -cp "target/diffdetective-$(./scripts/version.sh)-jar-with-dependencies.jar" org.variantsync.diffdetective.tablegen.MiningResultAccumulator "$resultsdir" "$resultsdir" &&
echo "genUltimateResults.sh DONE"
6 changes: 5 additions & 1 deletion scripts/runValidation.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
java -cp "target/diffdetective-2.2.0-jar-with-dependencies.jar" org.variantsync.diffdetective.validation.EditClassValidation
#!/usr/bin/env bash

cd "$(dirname "${BASH_SOURCE[0]}")/.." || exit 1

java -cp "target/diffdetective-$(./scripts/version.sh)-jar-with-dependencies.jar" org.variantsync.diffdetective.validation.EditClassValidation &&
echo "runValidation.sh DONE"
6 changes: 5 additions & 1 deletion scripts/runViewFeasibilityStudy.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
java -cp "target/diffdetective-2.2.0-jar-with-dependencies.jar" org.variantsync.diffdetective.experiments.views.Main "docs/datasets/views.md"
#!/usr/bin/env bash

cd "$(dirname "${BASH_SOURCE[0]}")/.." || exit 1

java -cp "target/diffdetective-$(./scripts/version.sh)-jar-with-dependencies.jar" org.variantsync.diffdetective.experiments.views.Main "docs/datasets/views.md" &&
echo "runValidation.sh DONE"
6 changes: 6 additions & 0 deletions scripts/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

cd "$(dirname "${BASH_SOURCE[0]}")/.."

# extracts the first version tag in pom.xml
sed -n '/<version/ {s/.*version>\(.*\)<\/version.*/\1/; p; q}' pom.xml