diff --git a/docs/cells.md b/docs/cells.md index b22747d11..fb30e3adc 100644 --- a/docs/cells.md +++ b/docs/cells.md @@ -247,8 +247,8 @@ keeps its full four-character, 30 fps timeline while storing identical PNGs once. Character regeneration losslessly compresses the PNGs and regenerates `sun_salutation_inventory.zi`; builds check that this table is current. The compression step requires Python `zopfli`, while ordinary builds use the -committed PNGs. `packaging/size-budgets.json` bounds the app package, native -libraries, Linux binary and release APKs. Android releases include a smaller +committed PNGs. `packaging/size-budgets.json` bounds the app package, +Linux binary and release APKs. Android releases include a smaller APK for each CPU architecture as well as the universal APK. The native library exports only the NativeActivity and JNI loading entries; registered JNI methods stay internal. This follows the Android NDK diff --git a/docs/fdroid.md b/docs/fdroid.md index e4930f1e1..09e0ae099 100644 --- a/docs/fdroid.md +++ b/docs/fdroid.md @@ -42,15 +42,14 @@ F-Droid build cannot accidentally rely on a bundle left by a desktop build. The reviewed Apps controller now lives once in APK assets, beside the main app package, rather than being embedded in every CPU library. The Android asset reader retains each package independently across Activity replacement. -Archive checks require both shared packages and keep the native size budgets. +Archive checks require both shared packages. -The native-library budget is an Inbe regression guard against duplicated -assets, not a F-Droid security limit. A later x86 clean build reached 6.40 MB -because unused runtime code and repeated native code remained in the library. -Android release builds now size-optimize static dependencies, discard unused +The former 5.50 MB per-native-library budget was an Inbe regression guard, +not a F-Droid or Android requirement. It has been removed at the owner's +request. Shared-package checks and overall delivered-size budgets still run. +Android release builds size-optimize static dependencies, discard unused runtime sections, optimize across app modules, and safely merge identical code -and strings. The 5.50 MB budget, all four architectures, artwork, and scanner -checks remain in place. +and strings. All four architectures, artwork and scanner checks remain in place. The upstream F-Droid entry must use the full commit of a successfully published release and its corresponding `inbe-VERSION-fdroid.apk` binary. diff --git a/packaging/size-budgets.json b/packaging/size-budgets.json index 3c9aee0ab..a166c2201 100644 --- a/packaging/size-budgets.json +++ b/packaging/size-budgets.json @@ -2,7 +2,6 @@ "apk_single_abi_bytes": 47000000, "apk_universal_bytes": 55000000, "bundle_payload_bytes": 55000000, - "native_library_bytes": 5500000, "app_package_bytes": 48000000, "linux_binary_bytes": 52000000 } diff --git a/scripts/check-package-size.py b/scripts/check-package-size.py index 0f66db697..9a3ef45b5 100644 --- a/scripts/check-package-size.py +++ b/scripts/check-package-size.py @@ -36,10 +36,6 @@ def check(path, budgets): and entry.filename.endswith("/libmain.so")] if not libraries: raise ValueError("Missing native application libraries") - for library in libraries: - within(library.filename, library.file_size, budgets["native_library_bytes"]) - # A portable package header may occur as a tiny reader constant; - # embedding megabytes of images is caught by the library budget. if bundle: size = sum(entry.compress_size for entry in files if entry.filename.startswith("base/")) diff --git a/tests/package_size_test.py b/tests/package_size_test.py index 8ab889c9e..6cb3102e3 100644 --- a/tests/package_size_test.py +++ b/tests/package_size_test.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Reject asset duplication and native-library growth in real ZIP inventories.""" +"""Check shared assets and delivered package sizes in real ZIP inventories.""" import importlib.util from pathlib import Path import tempfile @@ -14,7 +14,7 @@ SPEC.loader.exec_module(MODULE) class PackageSizeTest(unittest.TestCase): def check_archive(self, entries, suffix=".apk", **limits): - budgets = dict.fromkeys(("app_package_bytes", "native_library_bytes", + budgets = dict.fromkeys(("app_package_bytes", "apk_single_abi_bytes", "apk_universal_bytes", "bundle_payload_bytes"), 10000) budgets.update(limits) @@ -40,12 +40,20 @@ class PackageSizeTest(unittest.TestCase): with self.assertRaisesRegex(ValueError, "exactly one shared"): self.check_archive({"assets/inbe.zib": b"package", "assets/copy/inbe.zib": b"package"}) - def test_native_asset_bloat_fails(self): - with self.assertRaisesRegex(ValueError, "libmain.so"): + def test_native_library_has_no_individual_size_limit(self): + for suffix in (".apk", ".aab"): + with self.subTest(suffix=suffix): + prefix = "base/" if suffix == ".aab" else "" + self.assertIn("one shared package", self.check_archive({ + prefix + "assets/inbe.zib": b"package", + prefix + "assets/apps.zib": b"controller", + prefix + "lib/x86/libmain.so": b"x" * 5_600_000, + }, suffix=suffix)) + + def test_missing_native_library_fails(self): + with self.assertRaisesRegex(ValueError, "Missing native application libraries"): self.check_archive({"assets/inbe.zib": b"package", - "assets/apps.zib": b"controller", - "lib/arm64-v8a/libmain.so": b"image" * 100}, - native_library_bytes=100) + "assets/apps.zib": b"controller"}) def test_bundle_checks_delivered_payload_without_crash_symbols(self): self.assertIn("one shared package", self.check_archive({