mirror of
https://github.com/flutter/packages.git
synced 2025-08-24 19:42:17 +08:00
[flutter_plugin_tool] Add support for building UWP plugins (#4047)
This allows building UWP plugin examples with `build-examples --winuwp`. As with previous pre-stable-template desktop support, this avoids the issue of unstable app templates by running `flutter create` on the fly before trying to build, so a template that will bitrot doesn't need to be checked in. Also adds no-op "support" for `drive-examples --winuwp`, with warnings about it not doing anything. This is to handle the fact that the LUCI recipe is shared between Win32 and UWP, and didn't conditionalize `drive`. Rather than change that, then change it back later, this just adds the no-op support now (since changing the tooling is much easier than changing LUCI recipes currently). This required some supporting tool changes: - Adds the ability to check for the new platform variants in a pubspec - Adds the ability to write test pubspecs that include variants, for testing Part of https://github.com/flutter/flutter/issues/82817
This commit is contained in:
@ -36,7 +36,10 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
argParser.addFlag(kPlatformWeb,
|
||||
help: 'Runs the web implementation of the examples');
|
||||
argParser.addFlag(kPlatformWindows,
|
||||
help: 'Runs the Windows implementation of the examples');
|
||||
help: 'Runs the Windows (Win32) implementation of the examples');
|
||||
argParser.addFlag(kPlatformWinUwp,
|
||||
help:
|
||||
'Runs the UWP implementation of the examples [currently a no-op]');
|
||||
argParser.addOption(
|
||||
kEnableExperiment,
|
||||
defaultsTo: '',
|
||||
@ -67,6 +70,7 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
kPlatformMacos,
|
||||
kPlatformWeb,
|
||||
kPlatformWindows,
|
||||
kPlatformWinUwp,
|
||||
];
|
||||
final int platformCount = platformSwitches
|
||||
.where((String platform) => getBoolArg(platform))
|
||||
@ -81,6 +85,10 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
throw ToolExit(_exitNoPlatformFlags);
|
||||
}
|
||||
|
||||
if (getBoolArg(kPlatformWinUwp)) {
|
||||
logWarning('Driving UWP applications is not yet supported');
|
||||
}
|
||||
|
||||
String? androidDevice;
|
||||
if (getBoolArg(kPlatformAndroid)) {
|
||||
final List<String> devices = await _getDevicesForPlatform('android');
|
||||
@ -116,6 +124,10 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
],
|
||||
if (getBoolArg(kPlatformWindows))
|
||||
kPlatformWindows: <String>['-d', 'windows'],
|
||||
// TODO(stuartmorgan): Check these flags once drive supports UWP:
|
||||
// https://github.com/flutter/flutter/issues/82821
|
||||
if (getBoolArg(kPlatformWinUwp))
|
||||
kPlatformWinUwp: <String>['-d', 'winuwp'],
|
||||
};
|
||||
}
|
||||
|
||||
@ -132,7 +144,17 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
final List<String> deviceFlags = <String>[];
|
||||
for (final MapEntry<String, List<String>> entry
|
||||
in _targetDeviceFlags.entries) {
|
||||
if (pluginSupportsPlatform(entry.key, package)) {
|
||||
final String platform = entry.key;
|
||||
String? variant;
|
||||
if (platform == kPlatformWindows) {
|
||||
variant = platformVariantWin32;
|
||||
} else if (platform == kPlatformWinUwp) {
|
||||
variant = platformVariantWinUwp;
|
||||
// TODO(stuartmorgan): Remove this once drive supports UWP.
|
||||
// https://github.com/flutter/flutter/issues/82821
|
||||
return PackageResult.skip('Drive does not yet support UWP');
|
||||
}
|
||||
if (pluginSupportsPlatform(platform, package, variant: variant)) {
|
||||
deviceFlags.addAll(entry.value);
|
||||
} else {
|
||||
print('Skipping unsupported platform ${entry.key}...');
|
||||
|
Reference in New Issue
Block a user