Skip to content

Commit 22035c8

Browse files
vashworthsuryaKommana2662
authored andcommitted
Split SwiftPM plugin into multiple products (flutter#193521)
Fixes flutter#193093. ## 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 in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [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]. 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](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 [flutter/website]: https://github.com/flutter/website [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 37492e0 commit 22035c8

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

‎packages/flutter_tools/lib/src/commands/build_swift_package.dart‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,7 @@ class FlutterNativeIntegrationSwiftPackage {
19081908
manifest: nativeToolsPackage.childFile('Package.swift'),
19091909
name: _kFlutterNativeTools,
19101910
platforms: <SwiftPackageSupportedPlatform>[],
1911-
products: [_pluginTool.product, _assembleTool.product, _prebuildTool.product],
1911+
products: [..._pluginTool.products, _assembleTool.product, _prebuildTool.product],
19121912
dependencies: [],
19131913
targets: [
19141914
SwiftPackageTarget.defaultTarget(name: _kFlutterToolHelper),
@@ -2009,13 +2009,15 @@ class FlutterNativeIntegrationSwiftPackage {
20092009
}
20102010
}
20112011

2012-
({SwiftPackageProduct product, List<SwiftPackageTarget> targets}) get _pluginTool {
2013-
final product = SwiftPackageProduct.plugin(
2014-
name: 'FlutterBuildModePlugin',
2015-
targets: BuildSwiftPackage.availableBuildModes
2016-
.map((mode) => 'Switch to ${mode.uppercaseName} Mode')
2017-
.toList(),
2018-
);
2012+
({List<SwiftPackageProduct> products, List<SwiftPackageTarget> targets}) get _pluginTool {
2013+
final List<SwiftPackageProduct> products = BuildSwiftPackage.availableBuildModes
2014+
.map(
2015+
(mode) => SwiftPackageProduct.plugin(
2016+
name: 'FlutterBuildMode${mode.uppercaseName}Plugin',
2017+
targets: ['Switch to ${mode.uppercaseName} Mode'],
2018+
),
2019+
)
2020+
.toList();
20192021
final targets = <SwiftPackageTarget>[
20202022
SwiftPackageTarget.executableTarget(
20212023
name: _kFlutterPluginTool,
@@ -2034,7 +2036,7 @@ class FlutterNativeIntegrationSwiftPackage {
20342036
),
20352037
),
20362038
];
2037-
return (product: product, targets: targets);
2039+
return (products: products, targets: targets);
20382040
}
20392041

20402042
({SwiftPackageProduct product, SwiftPackageTarget target}) get _assembleTool {

‎packages/flutter_tools/test/commands.shard/hermetic/build_swift_package_test.dart‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,7 +3015,9 @@ import PackageDescription
30153015
let package = Package(
30163016
name: "FlutterNativeTools",
30173017
products: [
3018-
.plugin(name: "FlutterBuildModePlugin", targets: ["Switch to Debug Mode", "Switch to Profile Mode", "Switch to Release Mode"]),
3018+
.plugin(name: "FlutterBuildModeDebugPlugin", targets: ["Switch to Debug Mode"]),
3019+
.plugin(name: "FlutterBuildModeProfilePlugin", targets: ["Switch to Profile Mode"]),
3020+
.plugin(name: "FlutterBuildModeReleasePlugin", targets: ["Switch to Release Mode"]),
30193021
.executable(name: "flutter-assemble-tool", targets: ["FlutterAssembleTool"]),
30203022
.executable(name: "flutter-prebuild-tool", targets: ["FlutterPrebuildTool"])
30213023
],
@@ -3257,7 +3259,9 @@ import PackageDescription
32573259
let package = Package(
32583260
name: "FlutterNativeTools",
32593261
products: [
3260-
.plugin(name: "FlutterBuildModePlugin", targets: ["Switch to Debug Mode", "Switch to Profile Mode", "Switch to Release Mode"]),
3262+
.plugin(name: "FlutterBuildModeDebugPlugin", targets: ["Switch to Debug Mode"]),
3263+
.plugin(name: "FlutterBuildModeProfilePlugin", targets: ["Switch to Profile Mode"]),
3264+
.plugin(name: "FlutterBuildModeReleasePlugin", targets: ["Switch to Release Mode"]),
32613265
.executable(name: "flutter-assemble-tool", targets: ["FlutterAssembleTool"]),
32623266
.executable(name: "flutter-prebuild-tool", targets: ["FlutterPrebuildTool"])
32633267
],

0 commit comments

Comments
 (0)