From 761ff021fedc5be7d5a6812ee7811bd114c73cb5 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Sun, 8 Nov 2026 16:50:15 +0000 Subject: [PATCH] Keep generated Linux plugin registries out of build identity --- app/linux/.gitignore | 5 +++++ docs/notes/desktop-client-builds.md | 5 +++++ scripts/app_build.py | 3 ++- scripts/test_app_desktop_build.py | 10 ++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/linux/.gitignore b/app/linux/.gitignore index d3896c98..4bad9de2 100644 --- a/app/linux/.gitignore +++ b/app/linux/.gitignore @@ -1 +1,6 @@ flutter/ephemeral + +# Recreated from pubspec.lock by flutter pub get in every private build. +flutter/generated_plugin_registrant.cc +flutter/generated_plugin_registrant.h +flutter/generated_plugins.cmake diff --git a/docs/notes/desktop-client-builds.md b/docs/notes/desktop-client-builds.md index c97dbb71..32e0a86f 100644 --- a/docs/notes/desktop-client-builds.md +++ b/docs/notes/desktop-client-builds.md @@ -26,3 +26,8 @@ libraries. Logs: /tmp/pipelines-{linux,macos}-build.log and /tmp/pipelines-linux-linkage.log. No desktop UI/device interaction was run; these build checks do not establish runtime UI parity or public deployment. Final app-source integration requires rebuilding changed-source artifacts. + +Linux plugin registries are regenerated inside the private build from the tracked +pubspec/lockfile; they are ignored and excluded from source hashing so host +`flutter pub get` does not change the source key. A focused regression verifies +this while confirming a changed dependency lock still invalidates the build. diff --git a/scripts/app_build.py b/scripts/app_build.py index 61120bc4..d050ca1a 100644 --- a/scripts/app_build.py +++ b/scripts/app_build.py @@ -70,7 +70,8 @@ def digest(kind, app=APP, extra=()): paths = [root] if root.is_file() else sorted(p for p in root.rglob("*") if p.is_file()) if root.is_dir() else [] for path in paths: relative = path.relative_to(app) - if SKIPPED.intersection(relative.parts): + if SKIPPED.intersection(relative.parts) or (relative.parts[:2] == ("linux", "flutter") and relative.name in { + "generated_plugin_registrant.cc", "generated_plugin_registrant.h", "generated_plugins.cmake"}): continue hasher.update(b"\0path\0" + str(relative).encode() + b"\0") hasher.update(path.read_bytes()) diff --git a/scripts/test_app_desktop_build.py b/scripts/test_app_desktop_build.py index 3af49e31..8b737e23 100644 --- a/scripts/test_app_desktop_build.py +++ b/scripts/test_app_desktop_build.py @@ -110,6 +110,16 @@ class DesktopBuildTests(unittest.TestCase): (generated / "local-path").write_text("machine-specific generated value") self.assertEqual(macos, core.digest("macos", self.app)) + def test_pub_get_generated_linux_registries_do_not_change_source_key(self): + before = core.digest("linux", self.app) + directory = self.app / "linux/flutter" + directory.mkdir() + for name in ("generated_plugin_registrant.cc", "generated_plugin_registrant.h", "generated_plugins.cmake"): + (directory / name).write_text("generated from locked dependencies") + self.assertEqual(before, core.digest("linux", self.app)) + (self.app / "pubspec.lock").write_text("changed dependency lock") + self.assertNotEqual(before, core.digest("linux", self.app)) + @patch.object(desktop.platform, "system", return_value="Darwin") def test_native_macos_preserves_framework_symlinks_and_reuses_build(self, _): bundle, archive = self.build("macos", flutter="/fixture/flutter")