Files
breeze/scripts/build-apps.sh
T
waozi ef0de86e02
Cloudflare Pages / Build and verify the site (push) Successful in 3m29s
Integrate Breeze desktop, Android, and app updates
Use the verified dependency lock across native hosts and bundled apps. Preserve saved styles, local app reactivation, and offline packages while integrating the latest practice, Habits, Lumi, and figure preview updates.
2026-11-20 02:24:34 -03:00

92 lines
4.5 KiB
Bash
Executable File

#!/bin/sh
# Each app is compiled independently and included for offline use.
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
cd "$root"
# Asset preparation replaces shared directories. Keep simultaneous native,
# package and test builds from removing resources another bundle is reading.
mkdir -p build
exec 9>build/apps-build.lock
flock 9
ziran=${1:-build/packages/ziran/build/bin/ziran}
# Package flags select the same development or locked graph as Make.
bundle() {
# shellcheck disable=SC2086
"$ziran" bundle --project --offline ${PACKAGE_FLAGS:-} "$@"
}
controller=${3:-build/apps-ui/apps.zx}
output=${2:-build/apps}
python3 scripts/check-package-versions.py
python3 tests/font_glyph_coverage_test.py
python3 tests/locale_translated_test.py
python3 tests/locale_used_keys_test.py
python3 tests/lumi_guide_narration_test.py "$ziran"
python3 scripts/generate-package-versions.py
python3 scripts/animation_inventory.py --check
python3 scripts/prepare-package-assets.py --apps-controller "$controller"
if [ ! -s "$controller" ]; then
echo 'Root Apps requires the reviewed Apps controller bundle; run make apps' >&2
exit 1
fi
python3 scripts/release_notes.py CHANGELOG.md build/package-assets/inbe/assets/app/release-notes.json
python3 scripts/practice_content.py "$ziran"
# Bundles are embedded by directory, so staging starts empty: a renamed or
# removed bundle, or one in an older format, must not ride along.
mkdir -p "$output"
rm -f "$output"/*.zx "$output"/*.zib
rm -rf build/bundled-apps build/entity
mkdir -p build/bundled-apps
entity_dir="$root/build/packages/entity"
mkdir -p build/entity
entity_id=$(python3 -c 'import json; print(json.load(open("ziran.lock"))["root"]["dependencies"]["entity"])')
bundle --root . --define KRYON_HOSTED_UI \
--entry "${entity_id}_entity:Main" -o build/entity/entity.zx "$entity_dir/src/entity.zi"
# Entity's images are supplied once by the root package below. Its hosted
# child uses those same asset paths; embedding a second copy bloats every APK.
for feature in lists habits practices diary lumi leaderboard; do
source=$feature
entry=$feature
if [ "$feature" = practices ]; then source=practice; entry=practice; fi
locale_args=
if [ "$feature" = diary ]; then locale_args="--asset-dir locales=build/package-assets/diary/locales"; fi
# Practices already belongs to the root manifest. Passing its source
# folder again would register the same modules as generated modules.
set -- --module-path "apps/$source"
if [ "$feature" = practices ]; then set --; fi
# shellcheck disable=SC2086
bundle --root . "$@" $locale_args \
--define KRYON_HOSTED_UI \
--asset-dir "assets=build/package-assets/$feature/assets" \
--entry "$entry:Main" -o "$output/$feature.zx" \
"apps/$source/$source.zi"
done
# Keep the historical shipped set and add complete packages below 1 decimal MB.
# Optional apps remain outside cells/ and never change saved app selections.
python3 scripts/small_app_bundling.py --bundles "$output"
# The package folder keeps its historical name cells/ for released hosts.
# shellcheck disable=SC2086
bundle --root . --module-path apps/inbe \
--define KRYON_HOSTED_UI --entry inbe:Main \
--asset-dir "assets=build/package-assets/inbe/assets" \
--asset-dir "styles=build/package-assets/inbe/styles" \
--asset-dir "themes=build/package-assets/inbe/themes" \
--asset-dir "locales=build/package-assets/inbe/locales" \
--asset-dir "icons=build/package-assets/inbe/icons" \
--asset-dir "assets/entity=$entity_dir/assets/entity" --asset-dir "assets/entity/bundles=build/entity" \
--asset-dir "cells=build/bundled-apps" -o build/inbe.zx apps/inbe/inbe.zi
# shellcheck disable=SC2086
bundle --root . --module-path apps/inbe \
--define KRYON_HOSTED_UI --entry inbe:Main \
--asset-dir "assets=build/package-assets/inbe/assets" \
--asset-dir "styles=build/package-assets/inbe/styles" \
--asset-dir "themes=build/package-assets/inbe/themes" \
--asset-dir "locales=build/package-assets/inbe/locales" \
--asset-dir "icons=build/package-assets/inbe/icons" \
--asset-dir "assets/entity=$entity_dir/assets/entity" --asset-dir "assets/entity/bundles=build/entity" \
--asset-dir "cells=$output" -o build/inbe-full.zx apps/inbe/inbe.zi
# Successful, byte-identical root bundles must also satisfy Make's timestamp
# checks. The app bundles above are created fresh in their staging directory.
test -s build/inbe.zx && test -s build/inbe-full.zx || exit 1
touch build/inbe.zx build/inbe-full.zx