Skip to content

Commit 7e85411

Browse files
committed
Incorporate the build-jar.sh script into INSTALL.md
1 parent 49a2024 commit 7e85411

1 file changed

Lines changed: 35 additions & 28 deletions

File tree

INSTALL.md

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ You may build and run the demo _either_ manually _or_ by using Docker _or_ Nix.
66
We hence recommend the manual setup because it enables you to use DiffDetective in any of your own Maven projects.**
77

88
The Nix and Docker setups build the demo to a runnable jar file.
9-
We also provide scripts for running the Demo from within Nix and Docker but we do not recommend using them because the demo launches a graphical user interface which frequently causes problems when run from within Nix or Docker (see Troubleshooting section at the bottom of this file).
9+
We also provide scripts for running the Demo using Nix dependencies and inside Docker but we do not recommend the complete Docker setup because the demo launches a graphical user interface which frequently causes problems when inside of Docker (see Troubleshooting section at the bottom of this file).
1010
We hence recommend (1) to build either manually or with Nix or with Docker and (2) to run the produced jar file manually.
1111
(Windows users should _not_ use the Nix setup except if they are experts on WSL2, XServers, and Nix (see [REQUIREMENTS.md](REQUIREMENTS.md)).)
1212

@@ -15,7 +15,7 @@ Once you decided for a setup (Manual/Docker/Nix), check the requirements needed
1515
>In case you encounter problems during the setup, you may have a look at the _Troubleshooting_ section at the bottom of this file.
1616
1717

18-
## Manual Setup
18+
## Manual Build
1919

2020
Follow the setup instructions on the [DiffDetective website](https://variantsync.github.io/DiffDetective/) for building and installing DiffDetective with Maven (and _not_ with Nix).
2121
These instructions make you clone the repo and install it.
@@ -38,18 +38,24 @@ java -jar target/diffdetectivedemo-1.0.0-jar-with-dependencies.jar
3838
The expected output and behavior of the jar file is explained below in the section _Expected Output_.
3939
Make sure that you are at the top level of this repository in the terminal (i.e, the directory containing this INSTALL.md file).
4040

41-
## Docker Setup
41+
## Automatic Build
4242

43-
Check the requirements needed for the Docker setup in the [REQUIREMENTS.md](REQUIREMENTS.md) file.
43+
We provide two methods for automatically building this demo:
44+
- a [Docker](https://www.docker.com/get-started) build, and
45+
- a [Nix](https://nixos.org/download/) build.
46+
47+
### Starting the docker deamon
4448

45-
### Start the docker deamon
49+
If you want to use Docker to build the jar for you, Docker needs to be installed and running.
50+
Check the requirements needed for the Docker setup in the [REQUIREMENTS.md](REQUIREMENTS.md) file.
51+
You may also need to start the Docker daemon before any Docker commands can be run.
4652

4753
- **On Linux**: Typically, the docker deamon runs automatically, so there is nothing to do. Otherwise, run `sudo systemctl start docker`.
4854
- **On Windows**: Open the search bar using the 'Windows Key' and search for 'Docker' or 'Docker Desktop'.
4955

5056
More detailed instructions on starting the deamon are given [here](https://docs.docker.com/config/daemon/start/) on the docker website.
5157

52-
### Docker Setup on Windows
58+
### Docker Build on Windows
5359

5460
Open a terminal (preferably Windows PowerShell) and navigate to the repository's directory (the directory containing this `INSTALL.md`).
5561
Then, create the docker image
@@ -62,9 +68,13 @@ docker images
6268
```
6369
and checking that an image called `diffdetective-demo` is listed.
6470

65-
**TODO: HOW TO PRODUCE THE JAR FILE HERE?**
71+
To extract the built jar you can run
72+
```shell
73+
docker run --volume "$PWD:/output:rw" diffdetective-demo:1.0.0 /bin/cp /DiffDetective/share/java/DiffDetective-Demo.jar /output
74+
```
75+
and execute it using
6676
````shell
67-
java -jar PATH/TO/JAR
77+
java -jar DiffDetective-Demo.jar
6878
````
6979

7080
> **Experimental:**
@@ -75,47 +85,44 @@ java -jar PATH/TO/JAR
7585
> You may get some font errors, which you can ignore (see Troubleshooting below).
7686
> The parameters `--net=host` and `-e DISPLAY=host.docker.internal:0` are required to launch graphical user interfaces from within Docker.
7787
78-
### Docker Setup on Linux
88+
### Nix or Docker Build on Linux
7989
80-
You can use the `docker.sh` script to build and execute the Demo using [Docker](https://www.docker.com/get-started) as described below.
81-
You might require elevated privileges to execute Docker commands (e.g., `sudo ./docker.sh build` or adding the user to the `docker` or `wheel` group).
90+
You can use the `build-jar.sh` script to build the Demo jar using [Nix](https://nixos.org/download/) or [Docker](https://www.docker.com/get-started).
91+
The `build-jar.sh` script will automatically choose the build method depending on the available software (Nix or Docker, in that order).
92+
You might require elevated privileges to execute Docker commands (e.g., `sudo ./build-jar.sh` or adding the user to the `docker` or `wheel` group).
8293
See Docker's [post-installation steps](https://docs.docker.com/engine/install/linux-postinstall/) for more information.
83-
Also, it is best to install required software (e.g., Docker, Maven) using your distro's package manager if it is available.
94+
Also, it is best to install required software (e.g., Nix, Docker, Maven) using your distro's package manager if it is available.
8495
8596
Clone and navigate to this repository (the directory containing this `INSTALL.md`).
86-
Then, simply build the image using the provided script:
97+
Then, simply build the jar using the provided script:
8798
```shell
88-
./docker.sh build
99+
./build-jar.sh
89100
```
90101
91-
This will automatically build the Docker container using Nix if Nix is installed on your system.
92-
93-
**TODO: HOW TO PRODUCE THE JAR FILE HERE?**
102+
The jar can then be executed with
94103
````shell
95-
java -jar PATH/TO/JAR
104+
java -jar DiffDetective-Demo.jar
96105
````
97106
107+
### Complete Docker Setup on Linux
108+
98109
> **Experimental:**
99-
> Alternatively, once the image has been build, you can start the demo with
110+
> You can build and start a demo Docker container with
100111
> ```shell
112+
> ./docker.sh build
101113
> ./docker.sh demo
102114
> ```
103115
104-
## Nix Setup
105-
106-
Nix can be used to reproducibly build both, a standalone derivation and a docker container.
107-
Nix aids in reproducible builds whereas Docker aids in reproducible execution.
116+
### Nix Build
108117
118+
Nix can be used to reproducibly this DiffDetective demo.
109119
To use Nix, you need to have [Nix](https://nixos.org/download/) installed on your system.
110-
See [REQUIREMENTS.md](REQUIREMENTS.md) for instructions on how to install Nix and optionally also Docker.
111-
112-
### Standalone Build
120+
See [REQUIREMENTS.md](REQUIREMENTS.md) for instructions on how to install Nix.
113121
114122
> Notice for Windows users:
115123
> You must run the following commands from within a WSL2 terminal.
116124
> Also, make sure to clone this repository to a directory within WSL and _not_ to a Windows directory.
117125
> Otherwise, the Nix setup might fail due to incompatibilities with the file system.
118-
> Moreover, if you would like to have access to the demo's GUI, you need an XServer installed (see [REQUIREMENTS.md](REQUIREMENTS.md)).
119126
120127
> Notice for Nix flake users:
121128
> If you have flakes enabled, you can just use `nix run github:VariantSync/DiffDetective-Demo` to run the demo instead of the following instructions.
@@ -131,7 +138,7 @@ You can run it manually with Java (requires Java 17 or higher):
131138
```shell
132139
java -jar result/share/java/DiffDetective-Demo.jar
133140
```
134-
or alternatively via nix:
141+
or alternatively with the provided wrapper script:
135142
```shell
136143
./result/bin/DiffDetective-Demo
137144
```

0 commit comments

Comments
 (0)