mirror of
https://github.com/flutter/packages.git
synced 2025-05-31 05:30:36 +08:00
[flutter_plugin_tools] Remove UWP (#5432)
This commit is contained in:
@ -37,8 +37,7 @@ const String _flutterBuildTypeIOS = 'ios';
|
||||
const String _flutterBuildTypeLinux = 'linux';
|
||||
const String _flutterBuildTypeMacOS = 'macos';
|
||||
const String _flutterBuildTypeWeb = 'web';
|
||||
const String _flutterBuildTypeWin32 = 'windows';
|
||||
const String _flutterBuildTypeWinUwp = 'winuwp';
|
||||
const String _flutterBuildTypeWindows = 'windows';
|
||||
|
||||
/// A command to build the example applications for packages.
|
||||
class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
@ -52,7 +51,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
argParser.addFlag(platformMacOS);
|
||||
argParser.addFlag(platformWeb);
|
||||
argParser.addFlag(platformWindows);
|
||||
argParser.addFlag(platformWinUwp);
|
||||
argParser.addFlag(platformIOS);
|
||||
argParser.addFlag(_platformFlagApk);
|
||||
argParser.addOption(
|
||||
@ -93,16 +91,9 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
flutterBuildType: _flutterBuildTypeWeb,
|
||||
),
|
||||
platformWindows: const _PlatformDetails(
|
||||
'Win32',
|
||||
'Windows',
|
||||
pluginPlatform: platformWindows,
|
||||
pluginPlatformVariant: platformVariantWin32,
|
||||
flutterBuildType: _flutterBuildTypeWin32,
|
||||
),
|
||||
platformWinUwp: const _PlatformDetails(
|
||||
'UWP',
|
||||
pluginPlatform: platformWindows,
|
||||
pluginPlatformVariant: platformVariantWinUwp,
|
||||
flutterBuildType: _flutterBuildTypeWinUwp,
|
||||
flutterBuildType: _flutterBuildTypeWindows,
|
||||
),
|
||||
};
|
||||
|
||||
@ -146,9 +137,8 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
// no package-level platform information for non-plugin packages.
|
||||
final Set<_PlatformDetails> buildPlatforms = isPlugin
|
||||
? requestedPlatforms
|
||||
.where((_PlatformDetails platform) => pluginSupportsPlatform(
|
||||
platform.pluginPlatform, package,
|
||||
variant: platform.pluginPlatformVariant))
|
||||
.where((_PlatformDetails platform) =>
|
||||
pluginSupportsPlatform(platform.pluginPlatform, package))
|
||||
.toSet()
|
||||
: requestedPlatforms.toSet();
|
||||
|
||||
@ -280,22 +270,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
}) async {
|
||||
final String enableExperiment = getStringArg(kEnableExperiment);
|
||||
|
||||
// The UWP template is not yet stable, so the UWP directory
|
||||
// needs to be created on the fly with 'flutter create .'
|
||||
Directory? temporaryPlatformDirectory;
|
||||
if (flutterBuildType == _flutterBuildTypeWinUwp) {
|
||||
final Directory uwpDirectory = example.directory.childDirectory('winuwp');
|
||||
if (!uwpDirectory.existsSync()) {
|
||||
print('Creating temporary winuwp folder');
|
||||
final int exitCode = await processRunner.runAndStream(flutterCommand,
|
||||
<String>['create', '--platforms=$platformWinUwp', '.'],
|
||||
workingDir: example.directory);
|
||||
if (exitCode == 0) {
|
||||
temporaryPlatformDirectory = uwpDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
@ -308,13 +282,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
],
|
||||
workingDir: example.directory,
|
||||
);
|
||||
|
||||
if (temporaryPlatformDirectory != null &&
|
||||
temporaryPlatformDirectory.existsSync()) {
|
||||
print('Cleaning up ${temporaryPlatformDirectory.path}');
|
||||
temporaryPlatformDirectory.deleteSync(recursive: true);
|
||||
}
|
||||
|
||||
return exitCode == 0;
|
||||
}
|
||||
}
|
||||
@ -324,7 +291,6 @@ class _PlatformDetails {
|
||||
const _PlatformDetails(
|
||||
this.label, {
|
||||
required this.pluginPlatform,
|
||||
this.pluginPlatformVariant,
|
||||
required this.flutterBuildType,
|
||||
this.extraBuildFlags = const <String>[],
|
||||
});
|
||||
@ -335,10 +301,6 @@ class _PlatformDetails {
|
||||
/// The key in a pubspec's platform: entry.
|
||||
final String pluginPlatform;
|
||||
|
||||
/// The supportedVariants key under a plugin's [pluginPlatform] entry, if
|
||||
/// applicable.
|
||||
final String? pluginPlatformVariant;
|
||||
|
||||
/// The `flutter build` build type.
|
||||
final String flutterBuildType;
|
||||
|
||||
|
@ -26,27 +26,8 @@ const String platformMacOS = 'macos';
|
||||
const String platformWeb = 'web';
|
||||
|
||||
/// Key for windows platform.
|
||||
///
|
||||
/// Note that this corresponds to the Win32 variant for flutter commands like
|
||||
/// `build` and `run`, but is a general platform containing all Windows
|
||||
/// variants for purposes of the `platform` section of a plugin pubspec).
|
||||
const String platformWindows = 'windows';
|
||||
|
||||
/// Key for WinUWP platform.
|
||||
///
|
||||
/// Note that UWP is a platform for the purposes of flutter commands like
|
||||
/// `build` and `run`, but a variant of the `windows` platform for the purposes
|
||||
/// of plugin pubspecs).
|
||||
const String platformWinUwp = 'winuwp';
|
||||
|
||||
/// Key for Win32 variant of the Windows platform.
|
||||
const String platformVariantWin32 = 'win32';
|
||||
|
||||
/// Key for UWP variant of the Windows platform.
|
||||
///
|
||||
/// See the note on [platformWinUwp].
|
||||
const String platformVariantWinUwp = 'uwp';
|
||||
|
||||
/// Key for enable experiment.
|
||||
const String kEnableExperiment = 'enable-experiment';
|
||||
|
||||
|
@ -37,7 +37,6 @@ bool pluginSupportsPlatform(
|
||||
String platform,
|
||||
RepositoryPackage plugin, {
|
||||
PlatformSupport? requiredMode,
|
||||
String? variant,
|
||||
}) {
|
||||
assert(platform == platformIOS ||
|
||||
platform == platformAndroid ||
|
||||
@ -61,26 +60,6 @@ bool pluginSupportsPlatform(
|
||||
}
|
||||
}
|
||||
|
||||
// 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>{
|
||||
platformWindows: platformVariantWin32,
|
||||
};
|
||||
if (variant != defaultVariants[platform]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,7 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
argParser.addFlag(platformWeb,
|
||||
help: 'Runs the web implementation of the examples');
|
||||
argParser.addFlag(platformWindows,
|
||||
help: 'Runs the Windows (Win32) implementation of the examples');
|
||||
argParser.addFlag(platformWinUwp,
|
||||
help:
|
||||
'Runs the UWP implementation of the examples [currently a no-op]');
|
||||
help: 'Runs the Windows implementation of the examples');
|
||||
argParser.addOption(
|
||||
kEnableExperiment,
|
||||
defaultsTo: '',
|
||||
@ -70,7 +67,6 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
platformMacOS,
|
||||
platformWeb,
|
||||
platformWindows,
|
||||
platformWinUwp,
|
||||
];
|
||||
final int platformCount = platformSwitches
|
||||
.where((String platform) => getBoolArg(platform))
|
||||
@ -85,10 +81,6 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
throw ToolExit(_exitNoPlatformFlags);
|
||||
}
|
||||
|
||||
if (getBoolArg(platformWinUwp)) {
|
||||
logWarning('Driving UWP applications is not yet supported');
|
||||
}
|
||||
|
||||
String? androidDevice;
|
||||
if (getBoolArg(platformAndroid)) {
|
||||
final List<String> devices = await _getDevicesForPlatform('android');
|
||||
@ -126,9 +118,6 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
],
|
||||
if (getBoolArg(platformWindows))
|
||||
platformWindows: <String>['-d', 'windows'],
|
||||
// TODO(stuartmorgan): Check these flags once drive supports UWP:
|
||||
// https://github.com/flutter/flutter/issues/82821
|
||||
if (getBoolArg(platformWinUwp)) platformWinUwp: <String>['-d', 'winuwp'],
|
||||
};
|
||||
}
|
||||
|
||||
@ -146,16 +135,7 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
for (final MapEntry<String, List<String>> entry
|
||||
in _targetDeviceFlags.entries) {
|
||||
final String platform = entry.key;
|
||||
String? variant;
|
||||
if (platform == platformWindows) {
|
||||
variant = platformVariantWin32;
|
||||
} else if (platform == platformWinUwp) {
|
||||
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)) {
|
||||
if (pluginSupportsPlatform(platform, package)) {
|
||||
deviceFlags.addAll(entry.value);
|
||||
} else {
|
||||
print('Skipping unsupported platform ${entry.key}...');
|
||||
|
Reference in New Issue
Block a user