fix(#445): bundle native-assets DLLs (sqlite3, llamadart) into desktop builds

Clean Windows builds (incl. CI) shipped no sqlite3.dll, so drift could not open
its database ("Message storage unavailable"), and the llamadart translation libs
were stranded too. Root cause: the project moved to sqlite3 v3.x, which delivers
its native lib via Dart native assets, but (a) native assets was not enabled in
CI and (b) the stock windows/CMakeLists.txt guards the native-assets install
with a configure-time `if(EXISTS)` that is false on a clean build (native assets
are built AFTER cmake configures), so the install was silently skipped. Dev
machines only worked via leftover DLLs from prior builds.

Fixes:
- windows/CMakeLists.txt: defer the native-assets copy to install time (matches
  Linux's unconditional install), so a clean build bundles build/native_assets/
  windows/*.dll into the runner Release dir.
- build.yml + release-signed.yml: enable native assets (flutter config
  --enable-native-assets) in the windows/linux/macos jobs before build.

Verified on a clean local Windows build: Release now contains sqlite3.dll plus
the llama/ggml/mtmd set. Android (Gradle-delivered .so) and web (wasm) unchanged.

Citadel: meshcore-open-mkl
pull/450/head
Strycher 2 months ago
parent 6480034a63
commit f6ed3613eb

@ -72,6 +72,8 @@ jobs:
env:
GIPHY_API_KEY: ${{ secrets.GIPHY_API_KEY }}
run: jq -n --arg k "$GIPHY_API_KEY" '{GIPHY_API_KEY:$k}' > dart_defines.json
- name: Enable native assets (bundles sqlite3 + llamadart libs, #445)
run: flutter config --enable-native-assets
- run: flutter build linux --release --no-pub --dart-define-from-file=dart_defines.json
- name: Upload Linux bundle
uses: actions/upload-artifact@v4
@ -91,6 +93,8 @@ jobs:
cache: true
- run: flutter pub get
- run: dart run build_runner build --delete-conflicting-outputs
- name: Enable native assets (bundles sqlite3 + llamadart libs, #445)
run: flutter config --enable-native-assets
- run: flutter build macos --release --no-pub
web:
@ -134,6 +138,8 @@ jobs:
run: |
@{ GIPHY_API_KEY = $env:GIPHY_API_KEY } | ConvertTo-Json -Compress |
Set-Content -Path dart_defines.json -Encoding utf8 -NoNewline
- name: Enable native assets (bundles sqlite3 + llamadart libs, #445)
run: flutter config --enable-native-assets
- run: flutter build windows --release --no-pub --dart-define-from-file=dart_defines.json
- name: Upload Windows build
uses: actions/upload-artifact@v4

@ -206,6 +206,8 @@ jobs:
run: |
@{ GIPHY_API_KEY = $env:GIPHY_API_KEY } | ConvertTo-Json -Compress |
Set-Content -Path dart_defines.json -Encoding utf8 -NoNewline
- name: Enable native assets (bundles sqlite3 + llamadart libs, #445)
run: flutter config --enable-native-assets
- run: flutter build windows --release --no-pub --dart-define-from-file=dart_defines.json
- name: Zip Windows build
run: Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath offband-windows-x64.zip
@ -233,6 +235,8 @@ jobs:
env:
GIPHY_API_KEY: ${{ secrets.GIPHY_API_KEY }}
run: jq -n --arg k "$GIPHY_API_KEY" '{GIPHY_API_KEY:$k}' > dart_defines.json
- name: Enable native assets (bundles sqlite3 + llamadart libs, #445)
run: flutter config --enable-native-assets
- run: flutter build linux --release --no-pub --dart-define-from-file=dart_defines.json
- name: Tar Linux bundle
run: tar -czf offband-linux-x64.tar.gz -C build/linux/x64/release/bundle .

@ -87,13 +87,22 @@ if(PLUGIN_BUNDLED_LIBRARIES)
COMPONENT Runtime)
endif()
# Copy the native assets provided by the build.dart from all packages.
# Copy the native assets provided by build.dart hooks (e.g. sqlite3, llamadart)
# from all packages. The stock template guards this with a configure-time
# `if(EXISTS)`, but native assets are built AFTER cmake configures, so on a
# clean build the directory does not exist yet and the install is silently
# skipped, stranding sqlite3.dll / the llama libs (#445). Defer the existence
# check to install time so clean builds (and CI) bundle them.
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
if(EXISTS "${NATIVE_ASSETS_DIR}")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
install(CODE "
if(EXISTS \"${NATIVE_ASSETS_DIR}\")
file(GLOB _native_asset_libs \"${NATIVE_ASSETS_DIR}*\")
if(_native_asset_libs)
file(INSTALL DESTINATION \"${INSTALL_BUNDLE_LIB_DIR}\" TYPE FILE
FILES \${_native_asset_libs})
endif()
endif()
" COMPONENT Runtime)
# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.

Loading…
Cancel
Save

Powered by TurnKey Linux.