Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create API cli and daemon releases as zip archives #6122

Merged
merged 9 commits into from
Apr 3, 2022
71 changes: 71 additions & 0 deletions cli/package/create-cli-dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#! /bin/bash

VERSION="$1"
if [[ -z "$VERSION" ]]; then
VERSION="SNAPSHOT"
fi

export BISQ_RELEASE_NAME="bisq-cli-$VERSION"
export BISQ_RELEASE_ZIP_NAME="$BISQ_RELEASE_NAME.zip"

export GRADLE_DIST_NAME="cli.tar"
export GRADLE_DIST_PATH="../build/distributions/$GRADLE_DIST_NAME"

arrangegradledist() {
# Arrange $BISQ_RELEASE_NAME directory structure to contain a runnable
# jar at the top-level, and a lib dir containing dependencies:
# .
# |
# |__ cli.jar
# |__ lib
# |__ |__ dep1.jar
# |__ |__ dep2.jar
# |__ |__ ...
# Copy the build's distribution tarball to this directory.
cp -v $GRADLE_DIST_PATH .
# Create a clean directory to hold the tarball's content.
rm -rf $BISQ_RELEASE_NAME
mkdir $BISQ_RELEASE_NAME
# Extract the tarball's content into $BISQ_RELEASE_NAME.
tar -xf $GRADLE_DIST_NAME -C $BISQ_RELEASE_NAME
cd $BISQ_RELEASE_NAME
# Rearrange $BISQ_RELEASE_NAME contents: move the lib directory up one level.
mv -v cli/lib .
# Rearrange $BISQ_RELEASE_NAME contents: remove the cli/bin and cli directories.
rm -rf cli
# Rearrange $BISQ_RELEASE_NAME contents: move the lib/cli.jar up one level.
mv -v lib/cli.jar .
}

writemanifest() {
# Make the cli.jar runnable, and define its dependencies in a MANIFEST.MF update.
echo "Main-Class: bisq.cli.CliMain" > manifest-update.txt
printf "Class-Path: " >> manifest-update.txt
for file in lib/*
do
# Each new line in the classpath must be preceded by two spaces.
printf " %s\n" "$file" >> manifest-update.txt
done
}

updatemanifest() {
# Append contents of to cli.jar's MANIFEST.MF.
jar uvfm cli.jar manifest-update.txt
}

ziprelease() {
cd ..
zip -r $BISQ_RELEASE_ZIP_NAME $BISQ_RELEASE_NAME/lib $BISQ_RELEASE_NAME/cli.jar
}

cleanup() {
rm -v ./$GRADLE_DIST_NAME
rm -r ./$BISQ_RELEASE_NAME
}

arrangegradledist
writemanifest
updatemanifest
ziprelease
cleanup

71 changes: 71 additions & 0 deletions daemon/package/create-daemon-dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#! /bin/bash

VERSION="$1"
if [[ -z "$VERSION" ]]; then
VERSION="SNAPSHOT"
fi

export BISQ_RELEASE_NAME="bisq-daemon-$VERSION"
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() {
# 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.
cp -v $GRADLE_DIST_PATH .
# Create a clean directory to hold the tarball's content.
rm -rf $BISQ_RELEASE_NAME
mkdir $BISQ_RELEASE_NAME
# Extract the tarball's content into $BISQ_RELEASE_NAME.
tar -xf $GRADLE_DIST_NAME -C $BISQ_RELEASE_NAME
cd $BISQ_RELEASE_NAME
# Rearrange $BISQ_RELEASE_NAME contents: move the lib directory up one level.
mv -v daemon/lib .
# Rearrange $BISQ_RELEASE_NAME contents: remove the daemon/bin and daemon directories.
rm -rf daemon
# Rearrange $BISQ_RELEASE_NAME contents: move the lib/daemon.jar up one level.
mv -v lib/daemon.jar .
}

writemanifest() {
# Make the daemon.jar runnable, and define its dependencies in a MANIFEST.MF update.
echo "Main-Class: bisq.daemon.app.BisqDaemonMain" > manifest-update.txt
printf "Class-Path: " >> manifest-update.txt
for file in lib/*
do
# Each new line in the classpath must be preceded by two spaces.
printf " %s\n" "$file" >> manifest-update.txt
done
}

updatemanifest() {
# Append contents of to daemon.jar's MANIFEST.MF.
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

26 changes: 26 additions & 0 deletions desktop/package/macosx/finalize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ rm -r $target_dir

mkdir -p $target_dir

# Save the current working dir (assumed to be "desktop"), and
# build the API daemon and cli distributions in the target dir.
script_working_directory=$(pwd)
# Copy the build's cli and daemon tarballs to target_dir.
cp -v ../cli/build/distributions/cli.tar $target_dir
cp -v ../daemon/build/distributions/daemon.tar $target_dir
# Copy the cli and daemon zip creation scripts to target_dir.
cp -v ../cli/package/create-cli-dist.sh $target_dir
cp -v ../daemon/package/create-daemon-dist.sh $target_dir
# Run the zip creation scripts in target_dir.
cd $target_dir
./create-cli-dist.sh $version
./create-daemon-dist.sh $version
# Clean up.
rm -v create-cli-dist.sh
rm -v create-daemon-dist.sh
# Done building cli and daemon zip files; return to the original current working directory.
cd "$script_working_directory"

# sig key mkarrer
cp "$target_dir/../../package/F379A1C6.asc" "$target_dir/"
# sig key cbeams
Expand Down Expand Up @@ -47,6 +66,9 @@ cp "$win64/$exe" "$target_dir/$exe64"
rpi="jar-lib-for-raspberry-pi-$version.zip"
cp "$macos/$rpi" "$target_dir/"

cli="bisq-cli-$version.zip"
daemon="bisq-daemon-$version.zip"

# create file with jar signatures
cat "$macos/desktop-$version-all-mac.jar.SHA-256" \
"$linux64/desktop-$version-all-linux.jar.SHA-256" \
Expand All @@ -64,13 +86,17 @@ gpg --digest-algo SHA256 --local-user $BISQ_GPG_USER --output $deb64.asc --detac
gpg --digest-algo SHA256 --local-user $BISQ_GPG_USER --output $rpm64.asc --detach-sig --armor $rpm64
gpg --digest-algo SHA256 --local-user $BISQ_GPG_USER --output $exe64.asc --detach-sig --armor $exe64
gpg --digest-algo SHA256 --local-user $BISQ_GPG_USER --output $rpi.asc --detach-sig --armor $rpi
gpg --digest-algo SHA256 --local-user $BISQ_GPG_USER --output $cli.asc --detach-sig --armor $cli
gpg --digest-algo SHA256 --local-user $BISQ_GPG_USER --output $daemon.asc --detach-sig --armor $daemon

echo Verify signatures
gpg --digest-algo SHA256 --verify $dmg{.asc*,}
gpg --digest-algo SHA256 --verify $deb64{.asc*,}
gpg --digest-algo SHA256 --verify $rpm64{.asc*,}
gpg --digest-algo SHA256 --verify $exe64{.asc*,}
gpg --digest-algo SHA256 --verify $rpi{.asc*,}
gpg --digest-algo SHA256 --verify $cli{.asc*,}
gpg --digest-algo SHA256 --verify $daemon{.asc*,}

mkdir $win64/$version
cp -r . $win64/$version
Expand Down