Skip to content

Conversation

@loic-sharma
Copy link
Member

@loic-sharma loic-sharma commented Jul 25, 2024

If Swift Package Manager is enabled, the tool generates a Swift package at <ios/macos>/Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage/. This Swift package is how the tool adds plugins to the Flutter project.

SwiftPM is strictly enforces platform versions: you cannot depend on a Swift package if its supported version is higher than your own.

On iOS, we use the project's minimum deployment version for the generated Swift package. If a plugin has a higher requirement, you'll need to update your project's minimum deployment version. The generated Swift package is automatically updated the next time you run the tool.

This updates macOS to do the same thing.

Fixes #146204

Pre-launch Checklist

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

@github-actions github-actions bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. a: desktop Running on desktop labels Jul 25, 2024
@loic-sharma loic-sharma changed the title Mac build settings Update minimum macOS version as needed in Swift package Jul 25, 2024
Comment on lines +113 to +130
final Directory xcodeProject = flutterProject.macos.xcodeProject;

// If the standard project exists, specify it to getInfo to handle the case where there are
// other Xcode projects in the macos/ directory. Otherwise pass no name, which will work
// regardless of the project name so long as there is exactly one project.
final String? xcodeProjectName = xcodeProject.existsSync() ? xcodeProject.basename : null;
final XcodeProjectInfo? projectInfo = await globals.xcodeProjectInterpreter?.getInfo(
xcodeProject.parent.path,
projectFilename: xcodeProjectName,
);
final String? scheme = projectInfo?.schemeFor(buildInfo);
if (scheme == null) {
projectInfo!.reportFlavorNotFoundAndExit();
}
final String? configuration = projectInfo?.buildConfigurationFor(buildInfo, scheme);
if (configuration == null) {
throwToolExit('Unable to find expected configuration in Xcode project.');
}
Copy link
Member Author

@loic-sharma loic-sharma Jul 25, 2024

Choose a reason for hiding this comment

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

Code above this comment is existing code that was moved up in this method.

Code below this comment is new code that grabs the project's deployment target and uses it to update the generated Swift package.

This mirrors the same logic for iOS.

if (project.usesSwiftPackageManager) {
final String? iosDeploymentTarget = buildSettings['IPHONEOS_DEPLOYMENT_TARGET'];
if (iosDeploymentTarget != null) {
SwiftPackageManager.updateMinimumDeployment(
platform: SupportedPlatform.ios,
project: project.ios,
deploymentTarget: iosDeploymentTarget,
);
}
}

(This comment was stolen shamelessly from Jenn)

configuration: configuration,
target: target,
deviceId: deviceId,
isMacOS: this is MacOSProject,
Copy link
Member Author

Choose a reason for hiding this comment

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

This method was moved from IosProject to the base class XcodeBasedProject so it can be used by the subclass MacOSProject.

The only change to this method was the addition of this line: isMacOS: this is MacOSProject,

this.environmentType = EnvironmentType.physical,
this.deviceId,
this.target,
this.isMacOS = false,
Copy link
Member

Choose a reason for hiding this comment

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

Might make sense to instead change environmentType to instead match an enum like xcodebuild -showsdks
iOS, iOS simulator, macOS, etc. I think EnvironmentType is only used for iOS right now so you could change that, but I may be wrong.

Copy link
Member Author

@loic-sharma loic-sharma Jul 26, 2024

Choose a reason for hiding this comment

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

Thanks for the suggestion, updated! I'm much happier with how this looks now :)

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

@loic-sharma loic-sharma marked this pull request as ready for review July 26, 2024 21:55
@loic-sharma
Copy link
Member Author

loic-sharma commented Jul 26, 2024

I verified that google_sign_in_ios migrated to SPM builds on macOS using this change.

@loic-sharma loic-sharma added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 26, 2024
@auto-submit auto-submit bot merged commit 40843e3 into flutter:master Jul 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 31, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Aug 1, 2024
Manual roll requested by [email protected]

flutter/flutter@031dc3d...4d12197

2024-07-26 [email protected] further shard Mac tool_integration_tests from 4 to 5 shards (flutter/flutter#152399)
2024-07-26 [email protected] Change flutter_build_with_compilation_error_test to check stdout or stderr (flutter/flutter#152404)
2024-07-26 [email protected] [cupertino/icons.dart] Replace ligature references with characters corresponding to codepoints (flutter/flutter#152387)
2024-07-26 [email protected] Update minimum macOS version as needed in Swift package (flutter/flutter#152347)
2024-07-26 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.14 to 3.25.15 (flutter/flutter#152401)
2024-07-26 49699333+dependabot[bot]@users.noreply.github.com Bump ossf/scorecard-action from 2.3.3 to 2.4.0 (flutter/flutter#152400)
2024-07-26 [email protected] Update text_painter.dart (flutter/flutter#152398)
2024-07-26 [email protected] Fix some tests that fail with Swift Package Manager enabled (flutter/flutter#152267)
2024-07-26 [email protected] Reland "Launch DDS from Dart SDK and prepare to serve DevTools from DDS (#146593)" (flutter/flutter#152386)
2024-07-26 [email protected] Make `DragGestureRecognizer` abstract methods public (flutter/flutter#151627)
2024-07-26 [email protected] Fix cursor position when Unicode Zs category is entered in TextField (flutter/flutter#152215)
2024-07-26 [email protected] Roll Flutter Engine from 354abf2800a0 to e28f8755e25b (2 revisions) (flutter/flutter#152388)

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
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
If Swift Package Manager is enabled, the tool generates a Swift package at `<ios/macos>/Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage/`. This Swift package is how the tool adds plugins to the Flutter project.

SwiftPM is strictly enforces platform versions: you cannot depend on a Swift package if its supported version is higher than your own.

On iOS, we use the project's minimum deployment version for the generated Swift package. If a plugin has a higher requirement, you'll need to update your project's minimum deployment version. The generated Swift package is automatically updated the next time you run the tool.

This updates macOS to do the same thing.

Fixes flutter#146204
auto-submit bot pushed a commit that referenced this pull request Aug 8, 2024
Fix the xcodebuild flags mixing up the iOS and watchOS simulators.

Confirmed this passed in CI on Xcode 16 beta 5: #152408

Fixes #152983
See also #152347
DBowen33 pushed a commit to DBowen33/flutter that referenced this pull request Aug 16, 2024
Fix the xcodebuild flags mixing up the iOS and watchOS simulators.

Confirmed this passed in CI on Xcode 16 beta 5: flutter#152408

Fixes flutter#152983
See also flutter#152347
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
If Swift Package Manager is enabled, the tool generates a Swift package at `<ios/macos>/Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage/`. This Swift package is how the tool adds plugins to the Flutter project.

SwiftPM is strictly enforces platform versions: you cannot depend on a Swift package if its supported version is higher than your own.

On iOS, we use the project's minimum deployment version for the generated Swift package. If a plugin has a higher requirement, you'll need to update your project's minimum deployment version. The generated Swift package is automatically updated the next time you run the tool.

This updates macOS to do the same thing.

Fixes flutter#146204
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
Fix the xcodebuild flags mixing up the iOS and watchOS simulators.

Confirmed this passed in CI on Xcode 16 beta 5: flutter#152408

Fixes flutter#152983
See also flutter#152347
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop autosubmit Merge PR when tree becomes green via auto submit App platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to get build settings for macOS Xcode project

2 participants