2022-03-26 17:28:39 +01:00
|
|
|
#! /bin/bash
|
|
|
|
|
2022-03-28 16:05:13 +02:00
|
|
|
VERSION="$1"
|
|
|
|
if [[ -z "$VERSION" ]]; then
|
|
|
|
VERSION="SNAPSHOT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
export BISQ_RELEASE_NAME="bisq-daemon-$VERSION"
|
2022-03-26 17:28:39 +01:00
|
|
|
export BISQ_RELEASE_ZIP_NAME="$BISQ_RELEASE_NAME.zip"
|
|
|
|
|
|
|
|
export GRADLE_DIST_NAME="daemon.tar"
|
|
|
|
export GRADLE_DIST_PATH="../build/distributions/$GRADLE_DIST_NAME"
|
|
|
|
|
|
|
|
arrangegradledist() {
|
2022-03-28 15:50:17 +02:00
|
|
|
# Arrange $BISQ_RELEASE_NAME directory structure to contain a runnable
|
|
|
|
# jar at the top-level, and a lib dir containing dependencies:
|
|
|
|
# .
|
|
|
|
# |
|
|
|
|
# |__ daemon.jar
|
|
|
|
# |__ lib
|
|
|
|
# |__ |__ dep1.jar
|
|
|
|
# |__ |__ dep2.jar
|
|
|
|
# |__ |__ ...
|
|
|
|
# Copy the build's distribution tarball to this directory.
|
2022-03-26 17:28:39 +01:00
|
|
|
cp -v $GRADLE_DIST_PATH .
|
2022-03-28 15:50:17 +02:00
|
|
|
# Create a clean directory to hold the tarball's content.
|
2022-03-26 17:28:39 +01:00
|
|
|
rm -rf $BISQ_RELEASE_NAME
|
|
|
|
mkdir $BISQ_RELEASE_NAME
|
2022-03-28 15:50:17 +02:00
|
|
|
# Extract the tarball's content into $BISQ_RELEASE_NAME.
|
|
|
|
tar -xf $GRADLE_DIST_NAME -C $BISQ_RELEASE_NAME
|
2022-03-26 17:28:39 +01:00
|
|
|
cd $BISQ_RELEASE_NAME
|
2022-03-28 15:50:17 +02:00
|
|
|
# Rearrange $BISQ_RELEASE_NAME contents: move the lib directory up one level.
|
2022-03-26 17:28:39 +01:00
|
|
|
mv -v daemon/lib .
|
2022-03-28 15:50:17 +02:00
|
|
|
# Rearrange $BISQ_RELEASE_NAME contents: remove the daemon/bin and daemon directories.
|
2022-03-26 17:28:39 +01:00
|
|
|
rm -rf daemon
|
2022-03-28 15:50:17 +02:00
|
|
|
# Rearrange $BISQ_RELEASE_NAME contents: move the lib/daemon.jar up one level.
|
2022-03-26 17:28:39 +01:00
|
|
|
mv -v lib/daemon.jar .
|
|
|
|
}
|
|
|
|
|
|
|
|
writemanifest() {
|
2022-03-28 15:50:17 +02:00
|
|
|
# Make the daemon.jar runnable, and define its dependencies in a MANIFEST.MF update.
|
2022-03-26 17:28:39 +01:00
|
|
|
echo "Main-Class: bisq.daemon.app.BisqDaemonMain" > manifest-update.txt
|
|
|
|
printf "Class-Path: " >> manifest-update.txt
|
|
|
|
for file in lib/*
|
|
|
|
do
|
2022-03-28 15:50:17 +02:00
|
|
|
# Each new line in the classpath must be preceded by two spaces.
|
2022-03-26 17:28:39 +01:00
|
|
|
printf " %s\n" "$file" >> manifest-update.txt
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
updatemanifest() {
|
2022-03-28 15:50:17 +02:00
|
|
|
# Append contents of to daemon.jar's MANIFEST.MF.
|
2022-03-26 17:28:39 +01:00
|
|
|
jar uvfm daemon.jar manifest-update.txt
|
|
|
|
}
|
|
|
|
|
|
|
|
ziprelease() {
|
|
|
|
cd ..
|
|
|
|
zip -r $BISQ_RELEASE_ZIP_NAME $BISQ_RELEASE_NAME/lib $BISQ_RELEASE_NAME/daemon.jar
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
rm -v ./$GRADLE_DIST_NAME
|
|
|
|
rm -r ./$BISQ_RELEASE_NAME
|
|
|
|
}
|
|
|
|
|
|
|
|
arrangegradledist
|
|
|
|
writemanifest
|
|
|
|
updatemanifest
|
|
|
|
ziprelease
|
|
|
|
cleanup
|
|
|
|
|