mirror of
https://github.com/zotero/zotero.git
synced 2026-08-28 05:25:31 +00:00
After a full build, dir_build saves a manifest of build/ files to staging/.build-manifest. On subsequent runs, if all changed files are ones that build.sh copies into omni.ja unmodified (chrome/, components/, resource/, and test/ when tests are staged), zip just those files into the staged omni.ja instead of rebuilding, taking rebuilds from ~15 seconds to ~0.3 seconds on an M1 Mac. Files are prescreened by size and mtime so that only changed files need to be hashed. Zotero .ftl files are also updated at their localization/<locale>/ paths, and test files are also copied to the staged tests/ directory. Any other change triggers an automatic full rebuild: files transformed by build.sh (defaults/, chrome.manifest, version, translators/, styles/, mozilla .ftl files, CSL locales), removed files, changes to build inputs in app/ (detected via a size/mtime fingerprint, with xulrunner runtimes covered by the hash-* files written by fetch_xulrunner), or requesting tests or devtools that the staged build doesn't include. Other changes: - dir_build no longer takes -q and always skips omni.ja compression and optimization, which only matter for distribution builds made via build.sh. Use -f (dir_build or build_and_run) to force a full rebuild. - build_and_run now always rebuilds. -r is deprecated, and -n skips the rebuild and just launches the app. - build_and_run no longer passes -purgecaches. Startup caches are invalidated automatically when the BuildID changes, which now happens whenever omni.ja is modified (including via add_omni_file), so relaunching an unchanged build can use the startup cache. - build_and_run and runtests.sh invoke js-build directly instead of via 'npm run', which saves ~270ms of npm overhead per build. - The Word integration dylib is now ad-hoc-signed by dir_build, and only on full rebuilds, since incremental updates don't invalidate the existing signature. This also covers test builds, which were never signed before. - dir_build removes broken symlinks left in build/ when source files are deleted, which previously broke rsync in prepare_build.
55 lines
1.1 KiB
Bash
Executable file
55 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
#
|
|
# Zip a file directly into app/omni.ja in staging/
|
|
#
|
|
# Zip paths are relative to the current directory, so this should be run from
|
|
# the client build/ directory
|
|
#
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
. "$ROOT_DIR/config.sh"
|
|
|
|
function usage {
|
|
cat >&2 <<DONE
|
|
Usage: $0 path/to/file
|
|
DONE
|
|
exit 1
|
|
}
|
|
|
|
if [ -z "${1:-}" ]; then
|
|
usage
|
|
fi
|
|
|
|
files="$@"
|
|
|
|
for file in $files; do
|
|
if [ ! -f "$file" ]; then
|
|
echo "Error: $file not found!"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
mac_path="$STAGE_DIR/Zotero.app/Contents/Resources"
|
|
win_path="$STAGE_DIR/Zotero_win-x64"
|
|
linux_path="$STAGE_DIR/Zotero_linux-x86_64"
|
|
|
|
added=0
|
|
build_id=$(date +%Y%m%d%H%M%S)
|
|
for path in "$mac_path" "$win_path" "$linux_path"; do
|
|
if [ -d "$path" ]; then
|
|
echo "$path/app/omni.ja"
|
|
echo "Updating $(basename $(dirname $(dirname $path)))"
|
|
zip "$path/app/omni.ja" $files
|
|
# Bump BuildID so that startup caches are invalidated
|
|
perl -pi -e "s/^BuildID=.*/BuildID=$build_id/" "$path/app/application.ini"
|
|
added=1
|
|
fi
|
|
done
|
|
|
|
if [ $added -eq 0 ]; then
|
|
echo "No directories found in staging!"
|
|
exit 1
|
|
fi
|