diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d04c783d..935b9106 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: java-version: "17" - uses: subosito/flutter-action@v2 with: - channel: "stable" + flutter-version-file: pubspec.yaml cache: true - name: Cache Gradle uses: actions/cache@v4 @@ -37,7 +37,7 @@ jobs: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 with: - channel: "stable" + flutter-version-file: pubspec.yaml cache: true - run: flutter pub get - run: flutter build ios --release --no-codesign --no-pub @@ -122,7 +122,7 @@ jobs: mkdir -p build flutter --version flutter --version --machine > build/flutter-version.json - jq -e --arg revision "$FLUTTER_REVISION" '.frameworkVersion == "3.47.4" and .frameworkRevision == $revision' build/flutter-version.json + jq -e --arg revision "$FLUTTER_REVISION" --arg version "$(jq -r '.flutter.version' scripts/appimage-tools.json)" '.frameworkVersion == $version and .frameworkRevision == $revision' build/flutter-version.json - name: Install Linux build deps run: | sudo apt-get update @@ -183,7 +183,7 @@ jobs: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 with: - channel: "stable" + flutter-version-file: pubspec.yaml cache: true - run: flutter pub get - run: flutter build macos --release --no-pub @@ -194,7 +194,7 @@ jobs: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 with: - channel: "stable" + flutter-version-file: pubspec.yaml cache: true - run: flutter pub get - run: flutter build web --release --no-pub diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c3926c9b..73f32589 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,9 +15,7 @@ jobs: - name: Setup Flutter uses: subosito/flutter-action@v2 with: - channel: 'stable' - # Match local development version which provides Dart 3.11.0 - flutter-version: '3.41.2' + flutter-version-file: pubspec.yaml - name: Setup Bun uses: oven-sh/setup-bun@v2 diff --git a/.github/workflows/flutter_dart.yml b/.github/workflows/flutter_dart.yml index 117eb4f0..93fdd230 100644 --- a/.github/workflows/flutter_dart.yml +++ b/.github/workflows/flutter_dart.yml @@ -16,7 +16,16 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - channel: stable + flutter-version-file: pubspec.yaml + + - name: Check Flutter pins agree + run: | + pubspec=$(sed -n 's/^ flutter: *//p' pubspec.yaml) + appimage=$(jq -r '.flutter.version' scripts/appimage-tools.json) + if [ "$pubspec" != "$appimage" ]; then + echo "pubspec.yaml pins Flutter $pubspec but scripts/appimage-tools.json pins $appimage" >&2 + exit 1 + fi - name: Install dependencies run: flutter pub get diff --git a/CLAUDE.md b/CLAUDE.md index 9cad1ca8..108a1194 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -22,7 +22,7 @@ MESHCORE_BUILD_APPIMAGE=0 flutter build linux --release bash scripts/appimage/test_packaging.sh ``` -The versioned web build uses `dart run build_pipe:build` (also `bun run build`). Web deployment pins Flutter 3.41.2; Linux packaging uses the SDK pin in `scripts/appimage-tools.json`; other CI jobs track stable. Read `pubspec.yaml` for current app version and dependencies rather than copying them into this guide. +The versioned web build uses `dart run build_pipe:build` (also `bun run build`). `pubspec.yaml` pins an exact Flutter release (`environment.flutter`); `flutter pub get` refuses other versions and every CI job reads it via `flutter-version-file`. Linux packaging uses the matching pin in `scripts/appimage-tools.json`, and CI fails if the two differ. The Nix shell does not provide Flutter; use the pinned SDK on PATH. Read `pubspec.yaml` for current app version and dependencies rather than copying them into this guide. Linux Release installs generate architecture-matched AppImages using linuxdeploy/GTK and appimagetool: x86_64 on x64 and AArch64 on ARM64. Tools and runtime download automatically with pinned SHA-256 checksums. `MESHCORE_BUILD_APPIMAGE=0` skips packaging at install time, without a CMake cache reset. Debug/Profile are unchanged. Nix-linked x64 bundles and hosts with glibc newer than the pinned baseline trigger an isolated Ubuntu rebuild through an available Podman/Docker engine. Rootless Podman uses `--userns=keep-id` for host-owned bind mounts; see [Linux AppImage](README.md#linux-appimage) for prerequisites, cache/offline behavior and limitations. Preserve binary/data/lib adjacency and nested native assets when changing packaging. diff --git a/README.md b/README.md index dc07feb1..09ebdabb 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ See the [user documentation](documentation/README.md), [connection guide](docume ### Architecture -- **Framework**: Flutter (web deployment pins 3.41.2); Dart SDK constraint `^3.9.2` +- **Framework**: Flutter, pinned to an exact release in `pubspec.yaml` (`environment.flutter`); Dart SDK constraint `^3.9.2` - **State Management**: Provider pattern with ChangeNotifier - **BLE Protocol**: Nordic UART Service (NUS) over Bluetooth Low Energy - **Storage**: JSON in SharedPreferences for messages and contacts; files for models, images, and map caches @@ -125,7 +125,7 @@ The matrix describes implemented functionality, not a guarantee that every featu ### Prerequisites -- Flutter SDK; web deployment currently pins 3.41.2. The Dart SDK constraint is `^3.9.2` (see `pubspec.yaml`). +- Flutter SDK at exactly the version in `pubspec.yaml` under `environment.flutter`. `flutter pub get` refuses any other version; run `flutter upgrade` or check out that release. - Android Studio / Xcode (for mobile development) - A MeshCore-compatible LoRa device @@ -184,8 +184,8 @@ downloads must also be available. A packaging failure fails the enabled build, without publishing a stale image as a new artifact. GitHub Actions builds ARM64 on a native `ubuntu-24.04-arm` runner. Flutter's -Linux release SDK archive is x64-only, so that job bootstraps Flutter 3.47.4 -from its pinned source revision. Flutter does not support x64-to-ARM64 Linux +Linux release SDK archive is x64-only, so that job bootstraps the pinned Flutter +release from its source revision in `scripts/appimage-tools.json`. Flutter does not support x64-to-ARM64 Linux cross-builds; use an ARM64 Linux host to build the ARM64 bundle locally. The ARM64 AppImage is CI-built and hardware validation on a Raspberry Pi 5 is still needed for graphics, BLE, USB and inference behavior. @@ -223,8 +223,10 @@ flutter build linux --debug flutter build linux --profile ``` -The lockfile currently supplies Flutter 3.47.4 and its matching Dart SDK. The -app requires Flutter 3.41.2 or newer. The Linux shell provides wrapped Clang +The shell does not provide Flutter, because `pubspec.yaml` pins an exact +release that nixpkgs may not package yet. Put that Flutter SDK on PATH before +entering the shell; the shell warns when it is missing or the wrong version. +The Linux shell provides wrapped Clang compilers, native headers and libraries, and Sysprof capture development files. Android SDK warnings do not prevent Linux builds. diff --git a/flake.nix b/flake.nix index 528c3d87..29c24b1d 100644 --- a/flake.nix +++ b/flake.nix @@ -22,9 +22,6 @@ ]; buildInputs = with pkgs; [ - # Flutter and Dart - flutter - # Java (required for Android development) jdk17 @@ -50,6 +47,14 @@ shellHook = '' echo "MeshCore Flutter Development Environment" + # Flutter itself is not provided here: pubspec.yaml pins an exact + # release that nixpkgs may not have yet. Use that SDK from PATH. + required_flutter=$(sed -n 's/^ flutter: *//p' pubspec.yaml 2>/dev/null) + if ! command -v flutter >/dev/null; then + echo "WARNING: flutter not on PATH; install Flutter $required_flutter" + elif ! flutter --version 2>/dev/null | grep -q "^Flutter $required_flutter "; then + echo "WARNING: this project requires Flutter $required_flutter; found $(flutter --version 2>/dev/null | head -1)" + fi export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [pkgs.gtk3 pkgs.glib pkgs.sysprof pkgs.libdatrie]}:$LD_LIBRARY_PATH" # Setup Android SDK in home directory (standard location) diff --git a/pubspec.yaml b/pubspec.yaml index 8658a30a..b330e368 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,6 +20,10 @@ version: 99.0.2+27 environment: sdk: ^3.9.2 + # Everyone builds with this exact Flutter release; pub get refuses others. + # CI reads it via flutter-version-file. Keep scripts/appimage-tools.json in + # step when changing it. + flutter: 3.47.9 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/scripts/appimage-tools.json b/scripts/appimage-tools.json index 82ebbad4..3e14cc57 100644 --- a/scripts/appimage-tools.json +++ b/scripts/appimage-tools.json @@ -2,10 +2,10 @@ "ubuntu": "ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852", "glibc": "2.39", "flutter": { - "version": "3.47.4", - "source_revision": "9584c6713b324636289d067944a46fd6b49df14b", - "url": "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.47.4-stable.tar.xz", - "sha256": "5b45f0ceda99b9bebdc873e7e69f6450aeb4c30f454b505e2e62fc9255a907d3" + "version": "3.47.9", + "source_revision": "c197ca5199e9ee5661e865596c9c07294dfab51c", + "url": "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.47.9-stable.tar.xz", + "sha256": "25ed8c3c29d51a7353f2a944310b478af8214920639524b19c50a19e6c044c5a" }, "tools": { "gtk": { diff --git a/scripts/appimage/test_packaging.sh b/scripts/appimage/test_packaging.sh index 0d6f930b..5b7d8d51 100644 --- a/scripts/appimage/test_packaging.sh +++ b/scripts/appimage/test_packaging.sh @@ -38,7 +38,7 @@ bash "$project/scripts/build_appimage.sh" "$project" /missing "$temporary/output assert_fails bash "$project/scripts/build_appimage.sh" \ "$project" /missing "$temporary/output" Release riscv64 # shellcheck disable=SC2218 -jq -e '.flutter.source_revision == "9584c6713b324636289d067944a46fd6b49df14b" and +jq -e '.flutter.source_revision == "c197ca5199e9ee5661e865596c9c07294dfab51c" and (.tools.x86_64.linuxdeploy.sha256 | length == 64) and (.tools.aarch64.linuxdeploy.sha256 | length == 64) and (.tools.aarch64.appimagetool.sha256 | length == 64) and @@ -87,7 +87,7 @@ cp "$project/scripts/appimage/Dockerfile" "$temporary/project/scripts/appimage/" # shellcheck disable=SC2329 jq() { case "$*" in - *'.flutter.version'*) printf '3.47.4\n' ;; + *'.flutter.version'*) printf '3.47.9\n' ;; *'.ubuntu'*) printf 'ubuntu:24.04\n' ;; *) return 1 ;; esac