Skip to content

[CP-beta][ios26]Do not report error for Info.plist key not found#173438

Merged
auto-submit[bot] merged 1 commit into
flutter:flutter-3.35-candidate.0from
flutteractionsbot:cp-beta-c4b0be1a6c37603fe0c6d9f34623edc3cf873c42
Aug 7, 2025
Merged

[CP-beta][ios26]Do not report error for Info.plist key not found#173438
auto-submit[bot] merged 1 commit into
flutter:flutter-3.35-candidate.0from
flutteractionsbot:cp-beta-c4b0be1a6c37603fe0c6d9f34623edc3cf873c42

Conversation

@flutteractionsbot

@flutteractionsbot flutteractionsbot commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

This pull request is created by automatic cherry pick workflow
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.

Issue Link:

What is the link to the issue this cherry-pick is addressing?

#172627

Changelog Description:

Explain this cherry pick in one line that is accessible to most Flutter developers. See best practices for examples

Prevents a non-fatal error from causing Xcode compilation failures on macOS 26.

Impact Description:

What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)

Building iOS flutter apps may crash with Xcode 26.

Workaround:

Is there a workaround for this issue?

Add NSBonjourServices and NSLocalNetworkUsageDescription settings to your iOS app's Info.plist.

Risk:

What is the risk level of this cherry-pick?

  • Low
  • Medium
  • High

Test Coverage:

Are you confident that your fix is well-tested by automated tests?

  • Yes
  • No

Validation Steps:

What are the steps to validate that this fix works?

  1. flutter create a new app on macOS 26 beta
  2. Install Xcode 26 beta 5
  3. flutter run

In xcode_backend's `runSync` function, there's a flag parameter
`allowFail`. The purpose of this flag is that, when enabled, even if
command fails, we should not fail Xcode.

However, the current implementation has a bug, that even when `allowFail
= true`, we still prefix `"error:"` string to `stderr`, which causes
Xcode compilation error.

Before macOS 26, plutil used `stdout` rather than `stderr`, so the bug
was not surfaced. On macOS 26, pltuil uses `stderr` instead (which makes
sense), so the bug is surfaced now.

Note: even if plutil doesn't change behavior on macOS 26, if I randomly
come across this code, I'd still fix the logic error.

*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#172627

*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.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] 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

---------

Co-authored-by: Jenn Magder <magder@google.com>
@flutteractionsbot flutteractionsbot added the cp: review Cherry-picks in the review queue label Aug 7, 2025
@flutteractionsbot flutteractionsbot requested a review from a team as a code owner August 7, 2025 20:43
@flutteractionsbot flutteractionsbot added the cp: review Cherry-picks in the review queue label Aug 7, 2025
@flutteractionsbot

Copy link
Copy Markdown
Contributor Author

@jmagman please fill out the PR description above, afterwards the release team will review this request.

@flutter-dashboard

Copy link
Copy Markdown

This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

@github-actions github-actions Bot added tool Affects the "flutter" command-line tool. See also t: labels. team-ios Owned by iOS platform team labels Aug 7, 2025

@vashworth vashworth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request prevents Xcode build failures when plutil reports a missing key in Info.plist, which is a behavior change in newer macOS versions. The change correctly uses the allowFail flag to suppress build errors in this case. The logic is sound, and the change is well-tested with new unit and integration tests. I've only found a minor opportunity to reduce code duplication in the new unit tests for better maintainability.

Comment on lines +394 to +403
final Directory buildDir = fileSystem.directory('/path/to/builds')
..createSync(recursive: true);
final File infoPlist = buildDir.childFile('Info.plist')..createSync();
final context = TestContext(
<String>['test_vm_service_bonjour_service'],
<String, String>{
'CONFIGURATION': 'Debug',
'BUILT_PRODUCTS_DIR': buildDir.path,
'INFOPLIST_PATH': 'Info.plist',
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's some duplicated setup code between this test and the next one ('Missing NSLocalNetworkUsageDescription in Info.plist should not fail Xcode compilation'). To improve maintainability and adhere to the DRY (Don't Repeat Yourself) principle, you could extract the common setup into a setUp function within the group. This aligns with the style guide's principles of optimizing for readability and avoiding duplication.1

For example:

group('test_vm_service_bonjour_service', () {
  late Directory buildDir;
  late File infoPlist;

  setUp(() {
    buildDir = fileSystem.directory('/path/to/builds')..createSync(recursive: true);
    infoPlist = buildDir.childFile('Info.plist')..createSync();
  });

  // ... existing tests ...

  test('Missing NSBonjourServices key in Info.plist should not fail Xcode compilation', () {
    final context = TestContext(
      <String>['test_vm_service_bonjour_service'],
      <String, String>{
        'CONFIGURATION': 'Debug',
        'BUILT_PRODUCTS_DIR': buildDir.path,
        'INFOPLIST_PATH': 'Info.plist',
      },
      // ... rest of the test where infoPlist.path is used for FakeCommands
    );
    // ...
  });

  // ... and so on for the other test.
});

Style Guide References

Footnotes

  1. The style guide recommends optimizing for readability and avoiding duplication. Refactoring duplicated test setup into a setUp block improves both readability and maintainability by removing repeated code. (link)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this is not the time to DRY up this test, FYI @vashworth.

@justinmc justinmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CPLGTM 👍

Comment on lines +394 to +403
final Directory buildDir = fileSystem.directory('/path/to/builds')
..createSync(recursive: true);
final File infoPlist = buildDir.childFile('Info.plist')..createSync();
final context = TestContext(
<String>['test_vm_service_bonjour_service'],
<String, String>{
'CONFIGURATION': 'Debug',
'BUILT_PRODUCTS_DIR': buildDir.path,
'INFOPLIST_PATH': 'Info.plist',
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this is not the time to DRY up this test, FYI @vashworth.

@justinmc justinmc added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 7, 2025
@auto-submit auto-submit Bot merged commit 40aecd7 into flutter:flutter-3.35-candidate.0 Aug 7, 2025
141 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App cp: review Cherry-picks in the review queue team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants