diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c1ba57..0b36277 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/release-signed.yml b/.github/workflows/release-signed.yml index fd8e32a..1529db2 100644 --- a/.github/workflows/release-signed.yml +++ b/.github/workflows/release-signed.yml @@ -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 . diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 25825ff..b40e3ff 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -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.