[flutter_plugin_tools] Remove UWP (#5432)
diff --git a/.ci/scripts/build_examples_uwp.sh b/.ci/scripts/build_examples_uwp.sh
deleted file mode 100644
index 04b8256..0000000
--- a/.ci/scripts/build_examples_uwp.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-# Copyright 2013 The Flutter Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-dart ./script/tool/bin/flutter_plugin_tools.dart build-examples --winuwp \
- --packages-for-branch --log-timing
diff --git a/.ci/targets/uwp_build_and_platform_tests.yaml b/.ci/targets/uwp_build_and_platform_tests.yaml
deleted file mode 100644
index a7f0707..0000000
--- a/.ci/targets/uwp_build_and_platform_tests.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-tasks:
- - name: prepare tool
- script: .ci/scripts/prepare_tool.sh
- - name: build examples (UWP)
- script: .ci/scripts/build_examples_uwp.sh
diff --git a/script/tool/CHANGELOG.md b/script/tool/CHANGELOG.md
index 82a3115..7587ff3 100644
--- a/script/tool/CHANGELOG.md
+++ b/script/tool/CHANGELOG.md
@@ -5,6 +5,7 @@
- `license-check` now ignores submodules.
- Allows `make-deps-path-based` to skip packages it has alredy rewritten, so
that running multiple times won't fail after the first time.
+- Removes UWP support, since Flutter has dropped support for UWP.
## 0.8.2+1
diff --git a/script/tool/lib/src/build_examples_command.dart b/script/tool/lib/src/build_examples_command.dart
index b88cfe3..1aade35 100644
--- a/script/tool/lib/src/build_examples_command.dart
+++ b/script/tool/lib/src/build_examples_command.dart
@@ -37,8 +37,7 @@
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 @@
argParser.addFlag(platformMacOS);
argParser.addFlag(platformWeb);
argParser.addFlag(platformWindows);
- argParser.addFlag(platformWinUwp);
argParser.addFlag(platformIOS);
argParser.addFlag(_platformFlagApk);
argParser.addOption(
@@ -93,16 +91,9 @@
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 @@
// 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 @@
}) 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 @@
],
workingDir: example.directory,
);
-
- if (temporaryPlatformDirectory != null &&
- temporaryPlatformDirectory.existsSync()) {
- print('Cleaning up ${temporaryPlatformDirectory.path}');
- temporaryPlatformDirectory.deleteSync(recursive: true);
- }
-
return exitCode == 0;
}
}
@@ -324,7 +291,6 @@
const _PlatformDetails(
this.label, {
required this.pluginPlatform,
- this.pluginPlatformVariant,
required this.flutterBuildType,
this.extraBuildFlags = const <String>[],
});
@@ -335,10 +301,6 @@
/// 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;
diff --git a/script/tool/lib/src/common/core.dart b/script/tool/lib/src/common/core.dart
index 15a0d6f..de1cefd 100644
--- a/script/tool/lib/src/common/core.dart
+++ b/script/tool/lib/src/common/core.dart
@@ -26,27 +26,8 @@
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';
diff --git a/script/tool/lib/src/common/plugin_utils.dart b/script/tool/lib/src/common/plugin_utils.dart
index 081ce7f..94f294e 100644
--- a/script/tool/lib/src/common/plugin_utils.dart
+++ b/script/tool/lib/src/common/plugin_utils.dart
@@ -37,7 +37,6 @@
String platform,
RepositoryPackage plugin, {
PlatformSupport? requiredMode,
- String? variant,
}) {
assert(platform == platformIOS ||
platform == platformAndroid ||
@@ -61,26 +60,6 @@
}
}
- // 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;
}
diff --git a/script/tool/lib/src/drive_examples_command.dart b/script/tool/lib/src/drive_examples_command.dart
index d81153a..0e1efa8 100644
--- a/script/tool/lib/src/drive_examples_command.dart
+++ b/script/tool/lib/src/drive_examples_command.dart
@@ -36,10 +36,7 @@
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 @@
platformMacOS,
platformWeb,
platformWindows,
- platformWinUwp,
];
final int platformCount = platformSwitches
.where((String platform) => getBoolArg(platform))
@@ -85,10 +81,6 @@
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 @@
],
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 @@
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}...');
diff --git a/script/tool/test/build_examples_command_test.dart b/script/tool/test/build_examples_command_test.dart
index 29a8790..2bdb1bc 100644
--- a/script/tool/test/build_examples_command_test.dart
+++ b/script/tool/test/build_examples_command_test.dart
@@ -313,7 +313,7 @@
});
test(
- 'building for win32 when plugin is not set up for Windows results in no-op',
+ 'building for Windows when plugin is not set up for Windows results in no-op',
() async {
mockPlatform.isWindows = true;
createFakePlugin('plugin', packagesDir);
@@ -325,7 +325,7 @@
output,
containsAllInOrder(<Matcher>[
contains('Running for plugin'),
- contains('Win32 is not supported by this plugin'),
+ contains('Windows is not supported by this plugin'),
]),
);
@@ -334,7 +334,7 @@
expect(processRunner.recordedCalls, orderedEquals(<ProcessCall>[]));
});
- test('building for win32', () async {
+ test('building for Windows', () async {
mockPlatform.isWindows = true;
final Directory pluginDirectory = createFakePlugin('plugin', packagesDir,
platformSupport: <String, PlatformDetails>{
@@ -350,7 +350,7 @@
expect(
output,
containsAllInOrder(<String>[
- '\nBUILDING plugin/example for Win32 (windows)',
+ '\nBUILDING plugin/example for Windows',
]),
);
@@ -364,88 +364,6 @@
]));
});
- test('building for UWP when plugin does not support UWP is a no-op',
- () async {
- createFakePlugin('plugin', packagesDir);
-
- final List<String> output = await runCapturingPrint(
- runner, <String>['build-examples', '--winuwp']);
-
- expect(
- output,
- containsAllInOrder(<Matcher>[
- contains('Running for plugin'),
- contains('UWP is not supported by this plugin'),
- ]),
- );
-
- // Output should be empty since running build-examples --macos with no macos
- // implementation is a no-op.
- expect(processRunner.recordedCalls, orderedEquals(<ProcessCall>[]));
- });
-
- test('building for UWP', () async {
- final Directory pluginDirectory =
- createFakePlugin('plugin', packagesDir, extraFiles: <String>[
- 'example/test',
- ], platformSupport: <String, PlatformDetails>{
- platformWindows: const PlatformDetails(PlatformSupport.federated,
- variants: <String>[platformVariantWinUwp]),
- });
-
- final Directory pluginExampleDirectory =
- pluginDirectory.childDirectory('example');
-
- final List<String> output = await runCapturingPrint(
- runner, <String>['build-examples', '--winuwp']);
-
- expect(
- output,
- containsAllInOrder(<Matcher>[
- contains('BUILDING plugin/example for UWP (winuwp)'),
- ]),
- );
-
- expect(
- processRunner.recordedCalls,
- containsAll(<ProcessCall>[
- ProcessCall(getFlutterCommand(mockPlatform),
- const <String>['build', 'winuwp'], pluginExampleDirectory.path),
- ]));
- });
-
- test('building for UWP creates a folder if necessary', () async {
- final Directory pluginDirectory =
- createFakePlugin('plugin', packagesDir, extraFiles: <String>[
- 'example/test',
- ], platformSupport: <String, PlatformDetails>{
- platformWindows: const PlatformDetails(PlatformSupport.federated,
- variants: <String>[platformVariantWinUwp]),
- });
-
- final Directory pluginExampleDirectory =
- pluginDirectory.childDirectory('example');
-
- final List<String> output = await runCapturingPrint(
- runner, <String>['build-examples', '--winuwp']);
-
- expect(
- output,
- contains('Creating temporary winuwp folder'),
- );
-
- expect(
- processRunner.recordedCalls,
- orderedEquals(<ProcessCall>[
- ProcessCall(
- getFlutterCommand(mockPlatform),
- const <String>['create', '--platforms=winuwp', '.'],
- pluginExampleDirectory.path),
- ProcessCall(getFlutterCommand(mockPlatform),
- const <String>['build', 'winuwp'], pluginExampleDirectory.path),
- ]));
- });
-
test(
'building for Android when plugin is not set up for Android results in no-op',
() async {
diff --git a/script/tool/test/common/plugin_utils_test.dart b/script/tool/test/common/plugin_utils_test.dart
index cedd40a..af5cb7d 100644
--- a/script/tool/test/common/plugin_utils_test.dart
+++ b/script/tool/test/common/plugin_utils_test.dart
@@ -193,85 +193,6 @@
requiredMode: PlatformSupport.inline),
isFalse);
});
-
- test('windows without variants is only win32', () async {
- final RepositoryPackage plugin = RepositoryPackage(createFakePlugin(
- 'plugin',
- packagesDir,
- platformSupport: <String, PlatformDetails>{
- platformWindows: const PlatformDetails(PlatformSupport.inline),
- },
- ));
-
- expect(
- pluginSupportsPlatform(platformWindows, plugin,
- variant: platformVariantWin32),
- isTrue);
- expect(
- pluginSupportsPlatform(platformWindows, plugin,
- variant: platformVariantWinUwp),
- isFalse);
- });
-
- test('windows with both variants matches win32 and winuwp', () async {
- final RepositoryPackage plugin = RepositoryPackage(createFakePlugin(
- 'plugin', packagesDir,
- platformSupport: <String, PlatformDetails>{
- platformWindows: const PlatformDetails(
- PlatformSupport.federated,
- variants: <String>[platformVariantWin32, platformVariantWinUwp],
- ),
- }));
-
- expect(
- pluginSupportsPlatform(platformWindows, plugin,
- variant: platformVariantWin32),
- isTrue);
- expect(
- pluginSupportsPlatform(platformWindows, plugin,
- variant: platformVariantWinUwp),
- isTrue);
- });
-
- test('win32 plugin is only win32', () async {
- final RepositoryPackage plugin = RepositoryPackage(createFakePlugin(
- 'plugin', packagesDir,
- platformSupport: <String, PlatformDetails>{
- platformWindows: const PlatformDetails(
- PlatformSupport.federated,
- variants: <String>[platformVariantWin32],
- ),
- }));
-
- expect(
- pluginSupportsPlatform(platformWindows, plugin,
- variant: platformVariantWin32),
- isTrue);
- expect(
- pluginSupportsPlatform(platformWindows, plugin,
- variant: platformVariantWinUwp),
- isFalse);
- });
-
- test('winup plugin is only winuwp', () async {
- final RepositoryPackage plugin = RepositoryPackage(createFakePlugin(
- 'plugin',
- packagesDir,
- platformSupport: <String, PlatformDetails>{
- platformWindows: const PlatformDetails(PlatformSupport.federated,
- variants: <String>[platformVariantWinUwp]),
- },
- ));
-
- expect(
- pluginSupportsPlatform(platformWindows, plugin,
- variant: platformVariantWin32),
- isFalse);
- expect(
- pluginSupportsPlatform(platformWindows, plugin,
- variant: platformVariantWinUwp),
- isTrue);
- });
});
group('pluginHasNativeCodeForPlatform', () {
diff --git a/script/tool/test/drive_examples_command_test.dart b/script/tool/test/drive_examples_command_test.dart
index 9372c57..ac57eb7 100644
--- a/script/tool/test/drive_examples_command_test.dart
+++ b/script/tool/test/drive_examples_command_test.dart
@@ -708,40 +708,6 @@
]));
});
- test('driving UWP is a no-op', () async {
- createFakePlugin(
- 'plugin',
- packagesDir,
- extraFiles: <String>[
- 'example/test_driver/plugin_test.dart',
- 'example/test_driver/plugin.dart',
- ],
- platformSupport: <String, PlatformDetails>{
- platformWindows: const PlatformDetails(PlatformSupport.inline,
- variants: <String>[platformVariantWinUwp]),
- },
- );
-
- final List<String> output = await runCapturingPrint(runner, <String>[
- 'drive-examples',
- '--winuwp',
- ]);
-
- expect(
- output,
- containsAllInOrder(<Matcher>[
- contains('Driving UWP applications is not yet supported'),
- contains('Running for plugin'),
- contains('SKIPPING: Drive does not yet support UWP'),
- contains('No issues found!'),
- ]),
- );
-
- // Output should be empty since running drive-examples --windows on a
- // non-Windows plugin is a no-op.
- expect(processRunner.recordedCalls, <ProcessCall>[]);
- });
-
test('driving on an Android plugin', () async {
final Directory pluginDirectory = createFakePlugin(
'plugin',
diff --git a/script/tool/test/util.dart b/script/tool/test/util.dart
index fab4f39..2b1719e 100644
--- a/script/tool/test/util.dart
+++ b/script/tool/test/util.dart
@@ -47,7 +47,6 @@
class PlatformDetails {
const PlatformDetails(
this.type, {
- this.variants = const <String>[],
this.hasNativeCode = true,
this.hasDartCode = false,
});
@@ -55,9 +54,6 @@
/// The type of support for the platform.
final PlatformSupport type;
- /// Any 'supportVariants' to list in the pubspec.
- final List<String> variants;
-
/// Whether or not the plugin includes native code.
///
/// Ignored for web, which does not have native code.
@@ -293,18 +289,6 @@
entry = lines.join('\n') + '\n';
}
- // Add any variants.
- if (support.variants.isNotEmpty) {
- entry += '''
- supportedVariants:
-''';
- for (final String variant in support.variants) {
- entry += '''
- - $variant
-''';
- }
- }
-
return entry;
}