Fix macOS LiteRT-LM runtime packaging#196
Conversation
|
Chat app preview removed for |
There was a problem hiding this comment.
Pull request overview
This pull request updates LiteRT-LM native runtime packaging and loading behavior (especially on macOS) to match the upstream artifact changes in litert-lm-native@v0.13.1 (StreamProxy merged into the runtime), while also expanding native runtime selection config to support OS-level overrides.
Changes:
- Bump LiteRT-LM native runtime pin to
v0.13.1and remove standalone StreamProxy library expectations across hooks/tests. - Change macOS bundling strategy: keep LiteRT-LM dylibs in the hook cache and provide a prepare script that copies/signs upstream dylibs into
Contents/Frameworks/LiteRtLmRuntime. - Extend
llamadart_native_runtimesparsing to support OS-level keys (e.g.,ios,macos) with exact target keys taking precedence; add/adjust test coverage accordingly.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tool/macos_litert_lm_prepare_app.sh | Switches macOS app preparation from embedding frameworks to copying/signing upstream dylibs into LiteRtLmRuntime. |
| tool/macos_fair_litert_vs_llamadart.sh | Updates benchmark helper script to align with StreamProxy no longer being a standalone framework. |
| hook/build.dart | Updates LiteRT-LM artifact pin, required libraries, extraction filtering, and skips emitting macOS LiteRT-LM libraries as code assets. |
| lib/src/backends/litert_lm/litert_lm_runtime.dart | Updates loader logic to prefer app-local macOS libraries, updates iOS/macOS candidate lists, and loads StreamProxy symbols from the LiteRT-LM library. |
| lib/src/hook/native_bundle_config.dart | Adds OS-level platform key support + aliases, with exact bundle keys taking precedence. |
| README.md | Documents OS-level + exact-target overrides and updates pinned LiteRT-LM runtime version. |
| test/unit/tooling/macos_litert_lm_prepare_app_script_test.dart | Updates tests to validate the new LiteRtLmRuntime dylib copy behavior instead of frameworks. |
| test/unit/hook/native_bundle_config_test.dart | Adds coverage for OS-level platform map shapes and precedence rules. |
| test/unit/hook/build_hook_litert_lm_integration_test.dart | Updates integration expectations for new artifact layout and macOS caching behavior; removes StreamProxy expectations. |
| test/unit/hook/build_hook_integration_test.dart | Adds integration coverage for OS-level runtime selection and updates expected LiteRT-LM library lists. |
| test/unit/hook/build_hook_android_integration_test.dart | Removes StreamProxy expectations from Android LiteRT-LM bundle tests. |
| test/unit/hook/build_hook_linux_integration_test.dart | Removes StreamProxy expectations from Linux LiteRT-LM bundle tests. |
| test/unit/backends/litert_lm/litert_lm_runtime_test.dart | Updates runtime candidate/required-library assertions to match StreamProxy-merged artifacts and macOS library loading. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (code.targetOS == OS.macOS) { | ||
| log.info( | ||
| 'Keeping macOS LiteRT-LM libraries in the hook cache at ' | ||
| '${bundleDir.path}; the runtime loads them directly to avoid Flutter ' | ||
| 'rewriting upstream install names during app bundling.', | ||
| ); | ||
| return; |
4276c7b to
b2b05b4
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #196 +/- ##
==========================================
+ Coverage 80.57% 80.62% +0.04%
==========================================
Files 85 85
Lines 11392 11400 +8
==========================================
+ Hits 9179 9191 +12
+ Misses 2213 2209 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
f3bcc1b to
03ff9c5
Compare
|
@copilot review |
The review comment about the silent return has already been addressed in this PR. In commit |
03ff9c5 to
e6c20d9
Compare
|
Folded this into #198, which now targets main as the single Apple SPM/native-runtime PR. |
Summary
leehack/litert-lm-native@v0.13.1, where StreamProxy is merged into the LiteRT-LM artifacts instead of shipped as standalone libraries.Contents/Frameworks/LiteRtLmRuntimefor app bundles.llamadart_native_runtimesoverrides (ios,macos,android,linux,windows) with exact target keys taking precedence, and document the package-size config path.Validation
dart test test/unit/hook/build_hook_integration_test.dart test/unit/hook/build_hook_litert_lm_integration_test.dart test/unit/hook/native_bundle_config_test.dartdart test test/unit/backends/litert_lm/litert_lm_runtime_test.dart test/unit/tooling/macos_litert_lm_prepare_app_script_test.dartdart analyzeAdditional macOS runtime validation performed before the final parser/docs/hook-metadata extension:
dart run tool/macos_litert_lm_engine_smoke.dart .dart_tool/litert_lm_models/gemma-4-E2B-it.litertlm gpuflutter test --run-skipped -t local-only integration_test/litert_lm_chat_service_e2e_test.dart -d macos --dart-define=LITERT_LM_MODEL_URL=http://127.0.0.1:8765/gemma-4-E2B-it.litertlm --dart-define=LITERT_LM_E2E_BACKEND=cpuflutter test --run-skipped -t local-only integration_test/litert_lm_chat_service_e2e_test.dart -d macos --dart-define=LITERT_LM_MODEL_URL=http://127.0.0.1:8765/gemma-4-E2B-it.litertlm --dart-define=LITERT_LM_E2E_BACKEND=autocodesign --verify --deep --strict --verbose=2 build/macos/Build/Products/Debug/llamadart_chat_example.app