- Notifications
You must be signed in to change notification settings - Fork9.7k
[flutter_plugin_tool] Add support for building UWP plugins#4047
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
507f06daca220d5a93a36903c64227ec174c414de1e50ac6cdfc85ef7422daa2bc437de9966ca04d5917139004b06c5c854ce61580fd7eb3ca8b34449caa9b258781bd715988File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -28,8 +28,12 @@ enum PlatformSupport { | ||
| /// | ||
| /// If [requiredMode] is provided, the plugin must have the given type of | ||
| /// implementation in order to return true. | ||
| bool pluginSupportsPlatform( | ||
| String platform, | ||
| RepositoryPackage package, { | ||
| PlatformSupport? requiredMode, | ||
| String? variant, | ||
| }) { | ||
| assert(platform == kPlatformIos || | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Should this be updated to include ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. The latter; from the standpoint of a plugin, UWP isn't a platform. (But see my other comment; I think I could avoid this kind of confusion with a generic platform class.) Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Agreed; the backward compatibility makes this a bit of a pain. As you say, modelling this with classes might result in better readability than with logic in various bits of the tool. Agree that approach is worth exploring. | ||
| platform == kPlatformAndroid || | ||
| platform == kPlatformWeb || | ||
| @@ -65,9 +69,34 @@ bool pluginSupportsPlatform(String platform, RepositoryPackage package, | ||
| } | ||
| // If the platform entry is present, then it supports the platform. Check | ||
| // for required mode if specified. | ||
| if (requiredMode != null) { | ||
| final bool federated = platformEntry.containsKey('default_package'); | ||
| if (federated != (requiredMode == PlatformSupport.federated)) { | ||
| return false; | ||
| } | ||
| } | ||
| // If a variant is specified, check for that variant. | ||
| if (variant != null) { | ||
| const String variantsKey = 'supportedVariants'; | ||
| if (platformEntry.containsKey(variantsKey)) { | ||
| if (!(platformEntry['supportedVariants']! as YamlList) | ||
| .contains(variant)) { | ||
| return false; | ||
| } | ||
| } else { | ||
| // Platforms with variants have a default variant when unspecified for | ||
| // backward compatibility. Must match the flutter tool logic. | ||
| const Map<String, String> defaultVariants = <String, String>{ | ||
| kPlatformWindows: platformVariantWin32, | ||
| }; | ||
| if (variant != defaultVariants[platform]) { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return true; | ||
| } on FileSystemException { | ||
| return false; | ||
| } on YamlException { | ||
Uh oh!
There was an error while loading.Please reload this page.