zotero/app/scripts/build_and_run
Dan Stillman 5204a47e9b Switch command-line flags to kebab case without "Zotero" prefix
- -ZoteroDebug → -debug
- -ZoteroDebugText → -debug-text
- -ZoteroSkipBundledFiles → -skip-bundled-files
- -skipFeedUpdates → -skip-feed-updates

Test flags:

- -ZoteroTest → -test (already existed)
- -ZoteroAutomatedTest → -automated-test
- -ZoteroTestTimeout → -test-timeout
- -makeTestData → -make-test-data
- -startAtTestFile → -start-at-test-file
- -stopAtTestFile → -stop-at-test-file

The old -Zotero* names still work but log a deprecation warning.
2026-11-04 10:36:16 -05:00

98 lines
1.9 KiB
Bash
Executable file

#!/bin/bash -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
ROOT_DIR="$(dirname $APP_ROOT_DIR)"
# Set ZOTERO_PROFILE environment variable to choose profile
profile_args=()
if [ -n "${ZOTERO_PROFILE:-}" ]; then
profile_args=(-p "$ZOTERO_PROFILE")
fi
FORCE_FULL=0
NO_REBUILD=0
SKIP_BUNDLED_FILES=0
DEBUGGER=0
while getopts "rfnbd" opt; do
case $opt in
r)
# Deprecated -- rebuilding is now the default
echo "-r is deprecated -- rebuilding is now the default (use -n to skip)" >&2
;;
f)
FORCE_FULL=1
;;
n)
NO_REBUILD=1
;;
b)
SKIP_BUNDLED_FILES=1
;;
d)
DEBUGGER=1
;;
\?)
exit 1
;;
esac
done
# Remove options from $@
shift $((OPTIND-1))
if [ $NO_REBUILD -eq 0 ]; then
PARAMS=""
if [ $DEBUGGER -eq 1 ]; then
PARAMS="-t"
fi
if [ $FORCE_FULL -eq 1 ]; then
PARAMS="$PARAMS -f"
fi
# Check if build watch is running
# If not, run now
if ! ps u | grep js-build/build.js | grep -v grep > /dev/null; then
echo "Running JS build process"
echo
cd $ROOT_DIR
# TEMP: --openssl-legacy-provider avoids a build error in pdf.js
NODE_OPTIONS=--openssl-legacy-provider node js-build/build.js
echo
fi
"$SCRIPT_DIR/dir_build" $PARAMS
fi
PARAMS=""
if [ $SKIP_BUNDLED_FILES -eq 1 ]; then
PARAMS="$PARAMS -skip-bundled-files"
fi
if [ $DEBUGGER -eq 1 ]; then
PARAMS="$PARAMS -jsdebugger"
else
PARAMS="$PARAMS -jsconsole"
fi
if [ "`uname`" = "Darwin" ]; then
command="Zotero.app/Contents/MacOS/zotero"
elif [ "`uname`" = "Linux" ]; then
if [[ "`uname -m`" = "aarch64" ]]; then
command="Zotero_linux-arm64/zotero"
else
command="Zotero_linux-x86_64/zotero"
fi
elif [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
command="Zotero_win-x64/zotero.exe"
else
echo "Unknown platform" >&2
exit 1
fi
echo
"$APP_ROOT_DIR/staging/$command" "${profile_args[@]}" -debug-text $PARAMS "$@"