forked from firka/flutter
[SwiftPM] Update .flutter-plugin-dependencies format (#158138)
In the future, it will be possible for Swift Package Manager to be enabled on one but not all platforms (see https://github.com/flutter/flutter/issues/151567#issuecomment-2455941279). This updates the `.flutter-plugin-dependencies` file format to separate iOS's and macOS's SwiftPM enablement. For now, these platforms will always have the same value. This `.flutter-plugin-dependencies` file is read by our CocoaPods scripts to determine whether we should use CocoaPods or not to inject plugins. Part of https://github.com/flutter/flutter/issues/151567
This commit is contained in:
@@ -210,7 +210,7 @@ public class DummyPluginAClass {
|
||||
final String flutterPluginsDependenciesFileContent = flutterPluginsDependenciesFile.readAsStringSync();
|
||||
|
||||
final Map<String, dynamic> jsonContent = json.decode(flutterPluginsDependenciesFileContent) as Map<String, dynamic>;
|
||||
final bool swiftPackageManagerEnabled = jsonContent['swift_package_manager_enabled'] as bool? ?? false;
|
||||
final Map<String, dynamic>? swiftPackageManagerJson = jsonContent['swift_package_manager_enabled'] as Map<String, dynamic>?;
|
||||
|
||||
// Verify the dependencyGraph object is valid. The rest of the contents of this file are not relevant to the
|
||||
// dependency graph and are tested by unit tests.
|
||||
@@ -304,6 +304,18 @@ public class DummyPluginAClass {
|
||||
return TaskResult.failure('Failed to build plugin A example iOS app');
|
||||
}
|
||||
|
||||
final bool? swiftPackageManagerEnabled = swiftPackageManagerJson?['ios'] as bool?;
|
||||
if (swiftPackageManagerEnabled == null) {
|
||||
return TaskResult.failure(
|
||||
'${flutterPluginsDependenciesFile.path} is missing the '
|
||||
'"swift_package_manager_enabled" > "ios" property.\n'
|
||||
'\n'
|
||||
'.flutter_plugin_dependencies content:\n'
|
||||
'\n'
|
||||
'$flutterPluginsDependenciesFileContent',
|
||||
);
|
||||
}
|
||||
|
||||
if (swiftPackageManagerEnabled) {
|
||||
// Check plugins are built statically if using SwiftPM.
|
||||
final String executable = path.join(appBundle.path, 'Runner');
|
||||
|
||||
Reference in New Issue
Block a user