Skip to content

Allow building projects lacking Runner.xcworkspace - #186239

Merged
auto-submit[bot] merged 13 commits into
flutter:masterfrom
chika3742:build-without-xcworkspace
Jul 23, 2026
Merged

Allow building projects lacking Runner.xcworkspace#186239
auto-submit[bot] merged 13 commits into
flutter:masterfrom
chika3742:build-without-xcworkspace

Conversation

@chika3742

@chika3742 chika3742 commented May 8, 2026

Copy link
Copy Markdown
Contributor

Related: #185924

I have ensured that Flutter commands do not throw errors even in projects without Runner.xcworkspace, such as those that have migrated to SwiftPM.

Some migration processes checked for the existence of a workspace, but these do not read or write to the workspace directory and function correctly even if it is absent. While the exact intent is unclear, it is likely that they were checking whether Cocoapods was included in the project.

Also, it was causing an error in buildXcodeProject by not passing scheme and BUILD_DIR as arguments when the workspace did not exist .

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

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.

@github-actions github-actions Bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. team-ios Owned by iOS platform team team-macos Owned by the macOS platform team labels May 8, 2026
@chika3742 chika3742 changed the title Remove xcworkspace checks and pass scheme and BUILD_DIR Allow building projects lacking Runner.xcworkspace May 8, 2026
@chika3742
chika3742 marked this pull request as ready for review May 8, 2026 11:30
@chika3742
chika3742 requested review from a team as code owners May 8, 2026 11:30

@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 removes the requirement for an Xcode workspace during LLDB initialization and Swift Package Manager migrations, allowing these processes to succeed with only the project file. Corresponding tests have been updated to reflect this change. Feedback suggests refactoring the construction of xcodebuild arguments in mac.dart to use a more idiomatic single addAll call with collection-if and spread operators to improve readability.

Comment on lines +395 to +406
buildCommands.addAll(<String>[
'-workspace',
workspacePath.basename,
'-scheme',
scheme,
if (buildAction !=
XcodeBuildAction.archive) // dSYM files aren't copied to the archive if BUILD_DIR is set.
'BUILD_DIR=${globals.fs.path.absolute(buildDirectoryPath)}',
]);
}
buildCommands.addAll(<String>[
'-scheme',
scheme,
if (buildAction !=
XcodeBuildAction.archive) // dSYM files aren't copied to the archive if BUILD_DIR is set.
'BUILD_DIR=${globals.fs.path.absolute(buildDirectoryPath)}',
]);

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 logic for adding xcodebuild arguments can be simplified and made more idiomatic by using a single addAll call with collection-if and spread operators. This improves readability by grouping all build-related flags together.

  buildCommands.addAll(<String>[
    if (workspacePath != null) ...<String>[
      '-workspace',
      workspacePath.basename,
    ],
    '-scheme',
    scheme,
    if (buildAction !=
        XcodeBuildAction.archive) // dSYM files aren't copied to the archive if BUILD_DIR is set.
      'BUILD_DIR=${globals.fs.path.absolute(buildDirectoryPath)}',
  ]);
References
  1. Optimize for readability: Code is read more often than it is written. (link)

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.

I think my code has better readability because this checks a variable declared just before.

@LouiseHsu LouiseHsu added the CICD Run CI/CD label May 12, 2026
@LongCatIsLooong
LongCatIsLooong requested a review from vashworth May 14, 2026 21:36
@github-actions github-actions Bot removed the CICD Run CI/CD label May 15, 2026
@chika3742
chika3742 force-pushed the build-without-xcworkspace branch from 998c635 to 3fc09f0 Compare May 25, 2026 08:29

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

Overall this looks okay, but we wouldn't want it to regress. For example, it's long been an requirement, so someone might add code in the future under that assumption. I think at the very least this will need an integration test.

@github-actions github-actions Bot added platform-macos Building on or for macOS specifically a: desktop Running on desktop labels Jun 7, 2026
@chika3742
chika3742 force-pushed the build-without-xcworkspace branch from b338180 to 6fa9bf4 Compare June 7, 2026 12:14
@chika3742

Copy link
Copy Markdown
Contributor Author

@vashworth I have added integration tests. Also, I have updated the code so that macOS projects can be built without xcworkspace as well. Thank you for your review.

@vashworth
vashworth self-requested a review June 10, 2026 20:28
@vashworth vashworth added the CICD Run CI/CD label Jun 11, 2026
vashworth
vashworth previously approved these changes Jun 23, 2026
@okorohelijah

Copy link
Copy Markdown
Contributor

@hellohuanlin from triage

hellohuanlin
hellohuanlin previously approved these changes Jul 16, 2026

@hellohuanlin hellohuanlin 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 after minor nits

if (xcodeWorkspace != null) ...<String>['-workspace', xcodeWorkspace.path] else ...<String>[
'-project',
xcodeProject.path,
],

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.

the auto-formatter makes this a bit ugly (i misread it on first try). can you make the -workspace and -project path the consistent format?

bool verbose = false,
bool simulator = false,
bool customNaming = false,
bool noWorkspace = false,

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.

Avoid negative flags (hasWorkspace rather than noWorkspace)

@chika3742
chika3742 dismissed stale reviews from hellohuanlin and vashworth via 047bdc0 July 17, 2026 01:47
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Jul 17, 2026
@hellohuanlin hellohuanlin added the CICD Run CI/CD label Jul 17, 2026
@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 23, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 23, 2026
@auto-submit

auto-submit Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/186239, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 23, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Jul 23, 2026
Merged via the queue into flutter:master with commit f3ece63 Jul 23, 2026
31 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 23, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jul 24, 2026
flutter/flutter@2a2a79d...b65f4d9

2026-07-24 jason-simmons@users.noreply.github.com Add dart_runtime_service_vm_aot.dart.snapshot to the snapshot list in the macOS code signing configuration (flutter/flutter#189981)
2026-07-24 engine-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from wLST_A-xfOeGT_5mj... to E8hJ1AfK8CtGtaES0... (flutter/flutter#189956)
2026-07-23 chingjun@google.com Consolidate AndroidArch and DarwinArch into CpuArch (flutter/flutter#189315)
2026-07-23 engine-flutter-autoroll@skia.org Roll Dart SDK from 9258584f98b8 to e3fc57eae9eb (7 revisions) (flutter/flutter#189949)
2026-07-23 jason-simmons@users.noreply.github.com [flutter_tools] Do not always wait for the full timeout when running Spotlight to locate Android Studio on macOS (flutter/flutter#189952)
2026-07-23 engine-flutter-autoroll@skia.org Roll Skia from 1d8bf9270d8c to 6e9c4687c001 (15 revisions) (flutter/flutter#189954)
2026-07-23 jason-simmons@users.noreply.github.com [flutter_tools] Initialize Cache.flutterRoot at the start of the upgrade_test suite (flutter/flutter#189937)
2026-07-23 faheemabbas766@gmail.com Parse AndroidX property in gradle.properties (flutter/flutter#188372)
2026-07-23 60122246+xiaowei-guan@users.noreply.github.com [Impeller]Use the IO context for OpenGL program setup (flutter/flutter#185723)
2026-07-23 43089218+chika3742@users.noreply.github.com Allow building projects lacking Runner.xcworkspace (flutter/flutter#186239)
2026-07-23 bkonyi@google.com [flutter_tools] Invalidate WebEntrypointTarget when plugin set changes (flutter/flutter#189460)
2026-07-23 srawlins@google.com Bump devtools_shared to 13.1.0 (flutter/flutter#189507)
2026-07-23 matt.boetger@gmail.com forceNdkDownload should skip configuring cmake when ndk-build is used (flutter/flutter#187201)
2026-07-23 jason-simmons@users.noreply.github.com Disable execution order shuffling for the flutter_tools upgrade_test suite (flutter/flutter#189920)
2026-07-23 matej.knopp@gmail.com Move WindowManager outside of WidgetsApp (flutter/flutter#188866)
2026-07-23 engine-flutter-autoroll@skia.org Roll Skia from 3424966b8a2b to 1d8bf9270d8c (3 revisions) (flutter/flutter#189901)
2026-07-23 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from GswhlPRO-D1qSNclx... to 9org0yL3yZkp80x5S... (flutter/flutter#189898)
2026-07-23 116356835+AbdeMohlbi@users.noreply.github.com Remove outdated logs that were added to track #172636 (flutter/flutter#189282)
2026-07-23 engine-flutter-autoroll@skia.org Roll Skia from 5e183e5aeac5 to 3424966b8a2b (33 revisions) (flutter/flutter#189890)
2026-07-23 srawlins@google.com [examples] Use super parameters in missed spots (flutter/flutter#186194)
2026-07-23 bkonyi@google.com [flutter_tools] Bound Spotlight mdfind execution with timeout on macOS (flutter/flutter#189461)
2026-07-23 codedoctor@linwood.dev Fix non primary buttons not being captured on windows (flutter/flutter#188394)
2026-07-22 matt.boetger@gmail.com Listen to log reader before VM Service and make delay configurable (flutter/flutter#187202)
2026-07-22 engine-flutter-autoroll@skia.org Roll Dart SDK from 1e65011ee004 to 9258584f98b8 (7 revisions) (flutter/flutter#189883)
2026-07-22 30870216+gaaclarke@users.noreply.github.com Adds skill for generating engine diffs for new releases. (flutter/flutter#189869)
2026-07-22 chris@bracken.jp [ios,macos] Add Swift Sourcekit LSP support (flutter/flutter#189761)
2026-07-22 chris@bracken.jp [iOS] Mark DisplayLinkManager.shared and init() @mainactor (flutter/flutter#189815)
2026-07-22 97480502+b-luk@users.noreply.github.com Fix `Rect::ExpandToMinTransformedSize` to return the input rectangle when no expansion is needed, and remove 1-pixel roundrect to rect simplification (flutter/flutter#189808)
2026-07-22 15619084+vashworth@users.noreply.github.com Skip emulator.getEmulators test (flutter/flutter#189879)
2026-07-22 codedoctor@linwood.dev Fix null terminator in input truncates clipboard (flutter/flutter#188652)

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 bmparr@google.com,stuartmorgan@google.com 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
@ievdokdm ievdokdm assigned ievdokdm and unassigned ievdokdm Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD platform-ios iOS applications specifically platform-macos Building on or for macOS specifically team-ios Owned by iOS platform team team-macos Owned by the macOS 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.

7 participants