Skip to content

Commit 49a2024

Browse files
committed
Make build-jar.sh idempotent
1 parent 9ebbe4e commit 49a2024

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

build-jar.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ if command -v nix-build &>/dev/null
66
then
77
echo "Using Nix to build the DiffDetective demo jar."
88
nix-build &&
9-
cp result/share/java/DiffDetective-Demo.jar . &&
9+
cp -f result/share/java/DiffDetective-Demo.jar . &&
10+
chmod u+w DiffDetective-Demo.jar &&
1011
echo "The jar has been built successfully. You can find it in $(realpath DiffDetective-Demo.jar)" &&
1112
echo "You might want to remove the 'result' link ('rm result') to allow the Nix garbage collector to reclaim some space."
1213
elif command -v docker &>/dev/null
@@ -31,7 +32,7 @@ then
3132
fi
3233

3334
docker build . --tag diffdetective-demo:1.0.0 &&
34-
docker run --volume "$(realpath .):/output:rw" diffdetective-demo:1.0.0 /bin/cp /DiffDetective/share/java/DiffDetective-Demo.jar /output
35+
docker run --volume "$PWD:/output:rw" diffdetective-demo:1.0.0 /bin/cp /DiffDetective/share/java/DiffDetective-Demo.jar /output
3536

3637
if [ "$?" -eq 0 ]
3738
then

0 commit comments

Comments
 (0)