Skip to content

Commit edbc5ca

Browse files
authored
[ios26]fix host engine compile error (flutter#174723)
## What it does This adds `-plugin-path` flag to `swiftc` cmd to fix a compile error related to missing swift plugin. The plugin is under `mac_host_toolchain_path`, which is only available on macs. However, we only build mac host engine on macs, so we are good. ## About unit test This swiftc.py file currently has no test coverage, but it should - I filed flutter#174843. However, given there's a big fire (flutter#174513) going on, and we are approaching iOS 26 release, I have to prioritize that one. I will manually verify the solution. *List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.* Fixes flutter#172155 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent 135f367 commit edbc5ca

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

engine/src/build/toolchain/darwin/swiftc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,14 @@ def invoke_swift_compiler(args, extras_args, build_cache_dir, output_file_map):
444444
args.file_prefix_map,
445445
])
446446

447+
# Since iOS/macOS 26, building host engine requires setting -plugin-path for the `testing` plugin under XcodeDefault.xctoolchain.
448+
testing_plugin_path = os.path.join(args.mac_host_toolchain_path, 'usr/lib/swift/host/plugins/testing')
449+
if os.path.isdir(testing_plugin_path):
450+
swiftc_args.extend([
451+
'-plugin-path',
452+
testing_plugin_path,
453+
])
454+
447455
swift_toolchain_path = args.swift_toolchain_path
448456
if not swift_toolchain_path:
449457
swift_toolchain_path = os.path.join(os.path.dirname(args.sdk_path),
@@ -586,6 +594,10 @@ def main(args):
586594
default='',
587595
help='path to the Swift toolchain to use')
588596

597+
parser.add_argument('--mac-host-toolchain-path',
598+
default='',
599+
help='path to the mac host toolchain to use')
600+
589601
parser.add_argument('--whole-module-optimization',
590602
default=False,
591603
action='store_true',

engine/src/build/toolchain/mac/BUILD.gn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ template("mac_toolchain") {
283283
rebase_path(swift_toolchain_path, root_build_dir)
284284
}
285285

286+
if (mac_host_toolchain_path != "") {
287+
_extra_flags += " --mac-host-toolchain-path " +
288+
rebase_path(mac_host_toolchain_path, root_build_dir)
289+
}
290+
286291
if (swift_whole_module_optimization) {
287292
_extra_flags += " --whole-module-optimization"
288293
}

0 commit comments

Comments
 (0)