53 lines
1.7 KiB
Bash
Executable File
53 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# Builds self-contained copies of the logger and the recorder for one runtime
|
|
# id into one folder, dist/nonemm-<rid>, and archives it: a zip for Windows, a
|
|
# tar.gz for the rest. The two programs share the runtime and the Avalonia
|
|
# files, so the second publish only adds what the first lacks. The target
|
|
# machine needs no .NET install. Use publish-windows.sh or publish-linux.sh, or
|
|
# pass the runtime id, for example win-arm64 (the bridge and XMMT.ocx are 32
|
|
# bit x86 either way). When an archive from an earlier run exists, a second
|
|
# archive, dist/nonemm-<rid>-update, holds only the files that are new or
|
|
# changed since then, for unpacking over the old install.
|
|
rid="${1:?usage: publish.sh <runtime id>}"
|
|
cd "$(dirname "$0")" || exit 1
|
|
name="nonemm-$rid"
|
|
out="dist/$name"
|
|
mkdir -p dist
|
|
rm -rf "$out"
|
|
|
|
case "$rid" in
|
|
win-*) extension=zip ;;
|
|
*) extension=tar.gz ;;
|
|
esac
|
|
archive="dist/$name.$extension"
|
|
update="dist/$name-update.$extension"
|
|
|
|
# the full archive is replaced below, so keep the old one to compare against
|
|
previous=""
|
|
if [ -f "$archive" ]; then
|
|
previous="dist/$name.previous.$extension"
|
|
cp "$archive" "$previous" || exit 1
|
|
fi
|
|
|
|
for project in Nonemm.App Nonemm.Recorder.App; do
|
|
./build.sh publish "src/$project" -c Release -r "$rid" --self-contained -o "$out" || exit 1
|
|
done
|
|
rm -f "$out"/*.pdb
|
|
|
|
case "$extension" in
|
|
zip)
|
|
python3 -c 'import shutil, sys; shutil.make_archive(sys.argv[1], "zip", "dist", sys.argv[2])' \
|
|
"$out" "$name" || exit 1
|
|
;;
|
|
*)
|
|
tar -C dist -czf "$archive" "$name" || exit 1
|
|
;;
|
|
esac
|
|
echo "$archive"
|
|
|
|
rm -f "$update"
|
|
if [ -n "$previous" ]; then
|
|
python3 "$(dirname "$0")/publish-update.py" "$previous" "$out" "$update" || exit 1
|
|
rm -f "$previous"
|
|
fi
|