mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
![]() This PR adds initial support for Swift Package Manager (SPM). Users must opt in. Only compatible with Xcode 15+. Fixes https://github.com/flutter/flutter/issues/146369. ## Included Features This PR includes the following features: * Enabling SPM via config `flutter config --enable-swift-package-manager` * Disabling SPM via config (will disable for all projects) `flutter config --no-enable-swift-package-manager` * Disabling SPM via pubspec.yaml (will disable for the specific project) ``` flutter: disable-swift-package-manager: true ``` * Migrating existing apps to add SPM integration if using a Flutter plugin with a Package.swift * Generates a Swift Package (named `FlutterGeneratedPluginSwiftPackage`) that handles Flutter SPM-compatible plugin dependencies. Generated package is added to the Xcode project. * Error parsing of common errors that may occur due to using CocoaPods and Swift Package Manager together * Tool will print warnings when using all Swift Package plugins and encourage you to remove CocoaPods This PR also converts `integration_test` and `integration_test_macos` plugins to be both Swift Packages and CocoaPod Pods. ## How it Works The Flutter CLI will generate a Swift Package called `FlutterGeneratedPluginSwiftPackage`, which will have local dependencies on all Swift Package compatible Flutter plugins. The `FlutterGeneratedPluginSwiftPackage` package will be added to the Xcode project via altering of the `project.pbxproj`. In addition, a "Pre-action" script will be added via altering of the `Runner.xcscheme`. This script will invoke the flutter tool to copy the Flutter/FlutterMacOS framework to the `BUILT_PRODUCTS_DIR` directory before the build starts. This is needed because plugins need to be linked to the Flutter framework and fortunately Swift Package Manager automatically uses `BUILT_PRODUCTS_DIR` as a framework search path. CocoaPods will continue to run and be used to support non-Swift Package compatible Flutter plugins. ## Not Included Features It does not include the following (will be added in future PRs): * Create plugin template * Create app template * Add-to-App integration |
||
---|---|---|
.. | ||
analyze_continuously_test.dart | ||
analyze_suggestion_test.dart | ||
analyze_test.dart | ||
android_analyze_test.dart | ||
assemble_test.dart | ||
attach_test.dart | ||
build_aar_test.dart | ||
build_darwin_framework_test.dart | ||
build_ios_test.dart | ||
build_ipa_test.dart | ||
build_linux_test.dart | ||
build_macos_test.dart | ||
build_test.dart | ||
build_web_test.dart | ||
build_windows_test.dart | ||
clean_test.dart | ||
config_test.dart | ||
create_usage_test.dart | ||
custom_devices_test.dart | ||
daemon_test.dart | ||
devices_test.dart | ||
doctor_test.dart | ||
downgrade_test.dart | ||
drive_test.dart | ||
flutter_web_platform_test.dart | ||
generate_localizations_test.dart | ||
http_host_validator_test.dart | ||
ide_config_test.dart | ||
install_test.dart | ||
ios_analyze_test.dart | ||
logs_test.dart | ||
precache_test.dart | ||
proxied_devices_test.dart | ||
proxy_validator_test.dart | ||
pub_test.dart | ||
run_test.dart | ||
screenshot_command_test.dart | ||
shell_completion_test.dart | ||
symbolize_test.dart | ||
test_test.dart | ||
update_packages_test.dart | ||
upgrade_test.dart |