)]}'
{
  "commit": "08d2a471fd10152bb7dbfbb9636cf8fa53e94b8b",
  "tree": "9987cf8cb16d8548b38c1a7d4dc5d39b06179b78",
  "parents": [
    "cc0c10e2d151dca49fa52638af98a7b3d597776f"
  ],
  "author": {
    "name": "Chris Bracken",
    "email": "chris@bracken.jp",
    "time": "Tue Aug 25 20:55:57 2026 +0000"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Aug 25 20:55:57 2026 +0000"
  },
  "message": "iOS,macOS: Compile Swift with opt flags in opt builds (#191622)\n\nWe never passed optimisation flags to `swiftc`, and the compiler\u0027s\ndefault is `-Onone`, so all of the Darwin embedders\u0027 Swift shipped\nunoptimised in profile and release, and `assert()`s triggered in\nshipping binaries, as seen in flutter/flutter#190909.\n\nThis updates our optimisation gn configs to set equivalent `swiftflags`\nalongside the `cflags` we already set. For iOS that means `-Osize` (to\nmatch `-Os` for Obj-C/C++). For macOS, that means `-O` (to match `-O2`\nfor Obj-C/C++, Swift just has -O, no -O2, -O3). For both, we set and\n`-Onone` for `:no_optimize`.\n\nWhen `is_debug` is true, we default to unopt. Swift `assert()` behaves\nlike `FML_DCHECK` (active in unopt, compiled out in opt builds) and we\nshould use `precondition()` where we\u0027d use `FML_CHECK` -- i.e. cases we\nwant to assert even in release builds.\n\nThe following dev-specific asserts are now compiled out from shipped\nengines:\n* `DisplayLinkManager.shared` main-thread check\n* `KeyboardInsetManager` vsync client internal-state check\n* `FlutterRunLoop.mainRunLoop` the guard check already triggers\n* `TraceScope.deinit` ensure `end()` was called\n\nThis also moves the main-thread check in\n`FlutterRunLoop.ensureMainLoopInitialized` to a `precondition`. Binding\nthe main run loop to the wrong thread silently leaves everything later\nscheduled on it running on the wrong thread so we should continue to\nblow up in all modes.\n\nThis change chops 130272 bytes (0.79%) off `Flutter.framework` on\n`ios_release`.\n\nIssue: https://github.com/flutter/flutter/issues/191616\nRelated: https://github.com/flutter/flutter/issues/190909 (demonstrates\nexisting behaviour)\n\nNo new tests, since this is a compile config change: the build *is* the\ntest, along with not breaking the existing tests.\n\n\u003c!--\nThanks for filing a pull request!\nReviewers are typically assigned within a week of filing a request.\nTo learn more about code review, see our documentation on Tree Hygiene:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md\n--\u003e\n\n## Pre-launch Checklist\n\n- [X] I read the [Contributor Guide] and followed the process outlined\nthere for submitting PRs.\n- [X] I read the [AI contribution guidelines] and understand my\nresponsibilities, or I am not using AI tools.\n- [X] I read the [Tree Hygiene] wiki page, which explains my\nresponsibilities.\n- [X] I read and followed the [Flutter Style Guide], including [Features\nwe expect every widget to implement].\n- [X] I signed the [CLA].\n- [X] I listed at least one issue that this PR fixes in the description\nabove.\n- [X] I updated/added relevant documentation (doc comments with `///`).\n- [X] I added new tests to check the change I am making, or this PR is\n[test-exempt].\n- [X] I followed the [breaking change policy] and added [Data Driven\nFixes] where supported.\n- [X] All existing and new tests are passing.\n\nIf you need help, consider asking for advice on the #hackers-new channel\non [Discord].\n\nIf this change needs to override an active code freeze, provide a\ncomment explaining why. The code freeze workflow can be overridden by\ncode reviewers. See pinned issues for any active code freezes with\nguidance.\n\n**Note**: The Flutter team is currently trialing the use of [Gemini Code\nAssist for\nGitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).\nComments from the `gemini-code-assist` bot should not be taken as\nauthoritative feedback from the Flutter team. If you find its comments\nuseful you can update your code accordingly, but if you are unsure or\ndisagree with the feedback, please feel free to wait for a Flutter team\nmember\u0027s review for guidance on which automated comments should be\naddressed.\n\n\u003c!-- Links --\u003e\n[Contributor Guide]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview\n[AI contribution guidelines]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines\n[Tree Hygiene]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md\n[test-exempt]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests\n[Flutter Style Guide]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md\n[Features we expect every widget to implement]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement\n[CLA]: https://cla.developers.google.com/\n[flutter/tests]: https://github.com/flutter/tests\n[breaking change policy]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes\n[Discord]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md\n[Data Driven Fixes]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "0e95476b4b2f6e9493fe580f3ef53ae2b1461255",
      "old_mode": 33188,
      "old_path": "engine/src/build/config/compiler/BUILD.gn",
      "new_id": "02df4bfd5f29b5e04b8be7327fe4418a9e7a63ac",
      "new_mode": 33188,
      "new_path": "engine/src/build/config/compiler/BUILD.gn"
    },
    {
      "type": "modify",
      "old_id": "551b6da79682493f392626d24fe41140a4c9e2fa",
      "old_mode": 33188,
      "old_path": "engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterRunLoop.swift",
      "new_id": "ae6ff751221c8a8562e8ebf88c035ec57dd40dd4",
      "new_mode": 33188,
      "new_path": "engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterRunLoop.swift"
    }
  ]
}
