Skip to content

Parse scheme file with XML parser for SwiftPM migrator#184525

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
vashworth:scheme_parse_xml
Apr 6, 2026
Merged

Parse scheme file with XML parser for SwiftPM migrator#184525
auto-submit[bot] merged 2 commits into
flutter:masterfrom
vashworth:scheme_parse_xml

Conversation

@vashworth

Copy link
Copy Markdown
Contributor

Make scheme parsing more forgiving of whitespace differences.

Fixes #183029.

Pre-launch Checklist

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. 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.

@vashworth vashworth requested a review from bkonyi April 2, 2026 16:37
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 2, 2026
@vashworth vashworth added the CICD Run CI/CD label Apr 2, 2026

@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 transitions the SwiftPackageManagerIntegrationMigration from line-based string manipulation to XML parsing for updating Xcode schemes. It also updates the migration detection criteria and includes a new test case for varied XML spacing. The review feedback highlights the necessity of XML-escaping attribute values like BuildableName, BlueprintName, and ReferencedContainer when they are re-inserted into string templates to prevent the generation of malformed XML.

if (buildableNameAttr == null) {
throw Exception('Failed to parse ${schemeFile.basename}: Could not find BuildableName.');
}
final buildableName = 'BuildableName = "$buildableNameAttr"';

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

The buildableNameAttr value obtained from getAttribute is already decoded. When injecting it back into a string-based XML template, special characters like & or " must be re-encoded to ensure the resulting XML is valid. If a target name contains a double quote, it will break the XML structure.

Suggested change
final buildableName = 'BuildableName = "$buildableNameAttr"';
final buildableName = 'BuildableName = "${buildableNameAttr.replaceAll('&', '&').replaceAll('"', '"')}"';

if (blueprintNameAttr == null) {
throw Exception('Failed to parse ${schemeFile.basename}: Could not find BlueprintName.');
}
final blueprintName = 'BlueprintName = "$blueprintNameAttr"';

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

Similar to buildableNameAttr, the blueprintNameAttr value should be XML-escaped before being placed into the template to prevent generating invalid XML if the target name contains special characters.

Suggested change
final blueprintName = 'BlueprintName = "$blueprintNameAttr"';
final blueprintName = 'BlueprintName = "${blueprintNameAttr.replaceAll('&', '&').replaceAll('"', '"')}"';

'Failed to parse ${schemeFile.basename}: Could not find ReferencedContainer.',
);
}
final referencedContainer = 'ReferencedContainer = "$referencedContainerAttr"';

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

The referencedContainerAttr value should be XML-escaped to ensure the generated XML remains valid even if the container path contains special characters.

Suggested change
final referencedContainer = 'ReferencedContainer = "$referencedContainerAttr"';
final referencedContainer = 'ReferencedContainer = "${referencedContainerAttr.replaceAll('&', '&').replaceAll('"', '"')}"';

$buildableName
$blueprintName
$referencedContainer
$referencedContainer>

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.

Should this be />?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, it's closed in the next line with </BuildableReference>

@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 6, 2026
@vashworth vashworth added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Apr 6, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Apr 6, 2026
Merged via the queue into flutter:master with commit bf14796 Apr 6, 2026
141 of 142 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 6, 2026
@Renzo-Olivares Renzo-Olivares added the revert Autorevert PR (with "Reason for revert:" comment) label Apr 6, 2026
@auto-submit

auto-submit Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

A reason for requesting a revert of flutter/flutter/184525 could
not be found or the reason was not properly formatted. Begin a comment with 'Reason for revert:' to tell the bot why
this issue is being reverted.

@auto-submit auto-submit Bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Apr 6, 2026
@Renzo-Olivares

Copy link
Copy Markdown
Contributor

Reason for revert: tree breakage.

@Renzo-Olivares Renzo-Olivares added revert Autorevert PR (with "Reason for revert:" comment) and removed revert Autorevert PR (with "Reason for revert:" comment) labels Apr 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Apr 7, 2026
flutter/flutter@9cd60b5...a0924c7

2026-04-07 [email protected] Reland "[data_assets] Cleanup tests" (flutter/flutter#184714)
2026-04-07 [email protected] Use the WindowRegistry in the multiple_windows example app (flutter/flutter#184579)
2026-04-07 [email protected] Introduce command to build a swift package for SwiftPM add to app integration (flutter/flutter#184660)
2026-04-07 [email protected] Have `flutter create` create a pubspec.lock to ensure pinned versions are being used. (flutter/flutter#175352)
2026-04-07 [email protected] [widgets/raw_menu_anchor.dart] Always call onClose and onCloseRequested on descendants before parent. (flutter/flutter#182357)
2026-04-07 [email protected] `WindowsPlugin` should not crash when ffiPlugin enabled (flutter/flutter#184695)
2026-04-06 [email protected] Use full goto.google.com hostname for go/ links (flutter/flutter#184679)
2026-04-06 [email protected] Apply rect clipping to surface views (flutter/flutter#184471)
2026-04-06 [email protected] [A11y] Allow percentage strings like "50%" as `SemanticsValue` for `ProgressIndicator` (flutter/flutter#183670)
2026-04-06 [email protected] Fix invisible accessibility element before scroll view (flutter/flutter#184155)
2026-04-06 [email protected] Roll Skia from 163dfdf500c7 to e264d870a380 (2 revisions) (flutter/flutter#184674)
2026-04-06 [email protected] Keep last character obscured when toggling obscureText (flutter/flutter#183488)
2026-04-06 [email protected] Parse scheme file with XML parser for SwiftPM migrator (flutter/flutter#184525)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
mbcorona pushed a commit to mbcorona/flutter that referenced this pull request Apr 15, 2026
Make scheme parsing more forgiving of whitespace differences.

Fixes flutter#183029.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swift Package Manager error

3 participants