Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit c09ef58

Browse files
[flutter_plugin_tools] Remove UWP (#5432)
1 parent ac3167f commit c09ef58

11 files changed

+12
-332
lines changed

.ci/scripts/build_examples_uwp.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

.ci/targets/uwp_build_and_platform_tests.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

script/tool/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- `license-check` now ignores submodules.
66
- Allows `make-deps-path-based` to skip packages it has alredy rewritten, so
77
that running multiple times won't fail after the first time.
8+
- Removes UWP support, since Flutter has dropped support for UWP.
89

910
## 0.8.2+1
1011

script/tool/lib/src/build_examples_command.dart

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ const String _flutterBuildTypeIOS = 'ios';
3737
const String _flutterBuildTypeLinux = 'linux';
3838
const String _flutterBuildTypeMacOS = 'macos';
3939
const String _flutterBuildTypeWeb = 'web';
40-
const String _flutterBuildTypeWin32 = 'windows';
41-
const String _flutterBuildTypeWinUwp = 'winuwp';
40+
const String _flutterBuildTypeWindows = 'windows';
4241

4342
/// A command to build the example applications for packages.
4443
class BuildExamplesCommand extends PackageLoopingCommand {
@@ -52,7 +51,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
5251
argParser.addFlag(platformMacOS);
5352
argParser.addFlag(platformWeb);
5453
argParser.addFlag(platformWindows);
55-
argParser.addFlag(platformWinUwp);
5654
argParser.addFlag(platformIOS);
5755
argParser.addFlag(_platformFlagApk);
5856
argParser.addOption(
@@ -93,16 +91,9 @@ class BuildExamplesCommand extends PackageLoopingCommand {
9391
flutterBuildType: _flutterBuildTypeWeb,
9492
),
9593
platformWindows: const _PlatformDetails(
96-
'Win32',
94+
'Windows',
9795
pluginPlatform: platformWindows,
98-
pluginPlatformVariant: platformVariantWin32,
99-
flutterBuildType: _flutterBuildTypeWin32,
100-
),
101-
platformWinUwp: const _PlatformDetails(
102-
'UWP',
103-
pluginPlatform: platformWindows,
104-
pluginPlatformVariant: platformVariantWinUwp,
105-
flutterBuildType: _flutterBuildTypeWinUwp,
96+
flutterBuildType: _flutterBuildTypeWindows,
10697
),
10798
};
10899

@@ -146,9 +137,8 @@ class BuildExamplesCommand extends PackageLoopingCommand {
146137
// no package-level platform information for non-plugin packages.
147138
final Set<_PlatformDetails> buildPlatforms = isPlugin
148139
? requestedPlatforms
149-
.where((_PlatformDetails platform) => pluginSupportsPlatform(
150-
platform.pluginPlatform, package,
151-
variant: platform.pluginPlatformVariant))
140+
.where((_PlatformDetails platform) =>
141+
pluginSupportsPlatform(platform.pluginPlatform, package))
152142
.toSet()
153143
: requestedPlatforms.toSet();
154144

@@ -280,22 +270,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
280270
}) async {
281271
final String enableExperiment = getStringArg(kEnableExperiment);
282272

283-
// The UWP template is not yet stable, so the UWP directory
284-
// needs to be created on the fly with 'flutter create .'
285-
Directory? temporaryPlatformDirectory;
286-
if (flutterBuildType == _flutterBuildTypeWinUwp) {
287-
final Directory uwpDirectory = example.directory.childDirectory('winuwp');
288-
if (!uwpDirectory.existsSync()) {
289-
print('Creating temporary winuwp folder');
290-
final int exitCode = await processRunner.runAndStream(flutterCommand,
291-
<String>['create', '--platforms=$platformWinUwp', '.'],
292-
workingDir: example.directory);
293-
if (exitCode == 0) {
294-
temporaryPlatformDirectory = uwpDirectory;
295-
}
296-
}
297-
}
298-
299273
final int exitCode = await processRunner.runAndStream(
300274
flutterCommand,
301275
<String>[
@@ -308,13 +282,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
308282
],
309283
workingDir: example.directory,
310284
);
311-
312-
if (temporaryPlatformDirectory != null &&
313-
temporaryPlatformDirectory.existsSync()) {
314-
print('Cleaning up ${temporaryPlatformDirectory.path}');
315-
temporaryPlatformDirectory.deleteSync(recursive: true);
316-
}
317-
318285
return exitCode == 0;
319286
}
320287
}
@@ -324,7 +291,6 @@ class _PlatformDetails {
324291
const _PlatformDetails(
325292
this.label, {
326293
required this.pluginPlatform,
327-
this.pluginPlatformVariant,
328294
required this.flutterBuildType,
329295
this.extraBuildFlags = const <String>[],
330296
});
@@ -335,10 +301,6 @@ class _PlatformDetails {
335301
/// The key in a pubspec's platform: entry.
336302
final String pluginPlatform;
337303

338-
/// The supportedVariants key under a plugin's [pluginPlatform] entry, if
339-
/// applicable.
340-
final String? pluginPlatformVariant;
341-
342304
/// The `flutter build` build type.
343305
final String flutterBuildType;
344306

script/tool/lib/src/common/core.dart

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,8 @@ const String platformMacOS = 'macos';
2626
const String platformWeb = 'web';
2727

2828
/// Key for windows platform.
29-
///
30-
/// Note that this corresponds to the Win32 variant for flutter commands like
31-
/// `build` and `run`, but is a general platform containing all Windows
32-
/// variants for purposes of the `platform` section of a plugin pubspec).
3329
const String platformWindows = 'windows';
3430

35-
/// Key for WinUWP platform.
36-
///
37-
/// Note that UWP is a platform for the purposes of flutter commands like
38-
/// `build` and `run`, but a variant of the `windows` platform for the purposes
39-
/// of plugin pubspecs).
40-
const String platformWinUwp = 'winuwp';
41-
42-
/// Key for Win32 variant of the Windows platform.
43-
const String platformVariantWin32 = 'win32';
44-
45-
/// Key for UWP variant of the Windows platform.
46-
///
47-
/// See the note on [platformWinUwp].
48-
const String platformVariantWinUwp = 'uwp';
49-
5031
/// Key for enable experiment.
5132
const String kEnableExperiment = 'enable-experiment';
5233

script/tool/lib/src/common/plugin_utils.dart

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ bool pluginSupportsPlatform(
3737
String platform,
3838
RepositoryPackage plugin, {
3939
PlatformSupport? requiredMode,
40-
String? variant,
4140
}) {
4241
assert(platform == platformIOS ||
4342
platform == platformAndroid ||
@@ -61,26 +60,6 @@ bool pluginSupportsPlatform(
6160
}
6261
}
6362

64-
// If a variant is specified, check for that variant.
65-
if (variant != null) {
66-
const String variantsKey = 'supportedVariants';
67-
if (platformEntry.containsKey(variantsKey)) {
68-
if (!(platformEntry['supportedVariants']! as YamlList)
69-
.contains(variant)) {
70-
return false;
71-
}
72-
} else {
73-
// Platforms with variants have a default variant when unspecified for
74-
// backward compatibility. Must match the flutter tool logic.
75-
const Map<String, String> defaultVariants = <String, String>{
76-
platformWindows: platformVariantWin32,
77-
};
78-
if (variant != defaultVariants[platform]) {
79-
return false;
80-
}
81-
}
82-
}
83-
8463
return true;
8564
}
8665

script/tool/lib/src/drive_examples_command.dart

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ class DriveExamplesCommand extends PackageLoopingCommand {
3636
argParser.addFlag(platformWeb,
3737
help: 'Runs the web implementation of the examples');
3838
argParser.addFlag(platformWindows,
39-
help: 'Runs the Windows (Win32) implementation of the examples');
40-
argParser.addFlag(platformWinUwp,
41-
help:
42-
'Runs the UWP implementation of the examples [currently a no-op]');
39+
help: 'Runs the Windows implementation of the examples');
4340
argParser.addOption(
4441
kEnableExperiment,
4542
defaultsTo: '',
@@ -70,7 +67,6 @@ class DriveExamplesCommand extends PackageLoopingCommand {
7067
platformMacOS,
7168
platformWeb,
7269
platformWindows,
73-
platformWinUwp,
7470
];
7571
final int platformCount = platformSwitches
7672
.where((String platform) => getBoolArg(platform))
@@ -85,10 +81,6 @@ class DriveExamplesCommand extends PackageLoopingCommand {
8581
throw ToolExit(_exitNoPlatformFlags);
8682
}
8783

88-
if (getBoolArg(platformWinUwp)) {
89-
logWarning('Driving UWP applications is not yet supported');
90-
}
91-
9284
String? androidDevice;
9385
if (getBoolArg(platformAndroid)) {
9486
final List<String> devices = await _getDevicesForPlatform('android');
@@ -126,9 +118,6 @@ class DriveExamplesCommand extends PackageLoopingCommand {
126118
],
127119
if (getBoolArg(platformWindows))
128120
platformWindows: <String>['-d', 'windows'],
129-
// TODO(stuartmorgan): Check these flags once drive supports UWP:
130-
// https://github.com/flutter/flutter/issues/82821
131-
if (getBoolArg(platformWinUwp)) platformWinUwp: <String>['-d', 'winuwp'],
132121
};
133122
}
134123

@@ -146,16 +135,7 @@ class DriveExamplesCommand extends PackageLoopingCommand {
146135
for (final MapEntry<String, List<String>> entry
147136
in _targetDeviceFlags.entries) {
148137
final String platform = entry.key;
149-
String? variant;
150-
if (platform == platformWindows) {
151-
variant = platformVariantWin32;
152-
} else if (platform == platformWinUwp) {
153-
variant = platformVariantWinUwp;
154-
// TODO(stuartmorgan): Remove this once drive supports UWP.
155-
// https://github.com/flutter/flutter/issues/82821
156-
return PackageResult.skip('Drive does not yet support UWP');
157-
}
158-
if (pluginSupportsPlatform(platform, package, variant: variant)) {
138+
if (pluginSupportsPlatform(platform, package)) {
159139
deviceFlags.addAll(entry.value);
160140
} else {
161141
print('Skipping unsupported platform ${entry.key}...');

script/tool/test/build_examples_command_test.dart

Lines changed: 4 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ void main() {
313313
});
314314

315315
test(
316-
'building for win32 when plugin is not set up for Windows results in no-op',
316+
'building for Windows when plugin is not set up for Windows results in no-op',
317317
() async {
318318
mockPlatform.isWindows = true;
319319
createFakePlugin('plugin', packagesDir);
@@ -325,7 +325,7 @@ void main() {
325325
output,
326326
containsAllInOrder(<Matcher>[
327327
contains('Running for plugin'),
328-
contains('Win32 is not supported by this plugin'),
328+
contains('Windows is not supported by this plugin'),
329329
]),
330330
);
331331

@@ -334,7 +334,7 @@ void main() {
334334
expect(processRunner.recordedCalls, orderedEquals(<ProcessCall>[]));
335335
});
336336

337-
test('building for win32', () async {
337+
test('building for Windows', () async {
338338
mockPlatform.isWindows = true;
339339
final Directory pluginDirectory = createFakePlugin('plugin', packagesDir,
340340
platformSupport: <String, PlatformDetails>{
@@ -350,7 +350,7 @@ void main() {
350350
expect(
351351
output,
352352
containsAllInOrder(<String>[
353-
'\nBUILDING plugin/example for Win32 (windows)',
353+
'\nBUILDING plugin/example for Windows',
354354
]),
355355
);
356356

@@ -364,88 +364,6 @@ void main() {
364364
]));
365365
});
366366

367-
test('building for UWP when plugin does not support UWP is a no-op',
368-
() async {
369-
createFakePlugin('plugin', packagesDir);
370-
371-
final List<String> output = await runCapturingPrint(
372-
runner, <String>['build-examples', '--winuwp']);
373-
374-
expect(
375-
output,
376-
containsAllInOrder(<Matcher>[
377-
contains('Running for plugin'),
378-
contains('UWP is not supported by this plugin'),
379-
]),
380-
);
381-
382-
// Output should be empty since running build-examples --macos with no macos
383-
// implementation is a no-op.
384-
expect(processRunner.recordedCalls, orderedEquals(<ProcessCall>[]));
385-
});
386-
387-
test('building for UWP', () async {
388-
final Directory pluginDirectory =
389-
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
390-
'example/test',
391-
], platformSupport: <String, PlatformDetails>{
392-
platformWindows: const PlatformDetails(PlatformSupport.federated,
393-
variants: <String>[platformVariantWinUwp]),
394-
});
395-
396-
final Directory pluginExampleDirectory =
397-
pluginDirectory.childDirectory('example');
398-
399-
final List<String> output = await runCapturingPrint(
400-
runner, <String>['build-examples', '--winuwp']);
401-
402-
expect(
403-
output,
404-
containsAllInOrder(<Matcher>[
405-
contains('BUILDING plugin/example for UWP (winuwp)'),
406-
]),
407-
);
408-
409-
expect(
410-
processRunner.recordedCalls,
411-
containsAll(<ProcessCall>[
412-
ProcessCall(getFlutterCommand(mockPlatform),
413-
const <String>['build', 'winuwp'], pluginExampleDirectory.path),
414-
]));
415-
});
416-
417-
test('building for UWP creates a folder if necessary', () async {
418-
final Directory pluginDirectory =
419-
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
420-
'example/test',
421-
], platformSupport: <String, PlatformDetails>{
422-
platformWindows: const PlatformDetails(PlatformSupport.federated,
423-
variants: <String>[platformVariantWinUwp]),
424-
});
425-
426-
final Directory pluginExampleDirectory =
427-
pluginDirectory.childDirectory('example');
428-
429-
final List<String> output = await runCapturingPrint(
430-
runner, <String>['build-examples', '--winuwp']);
431-
432-
expect(
433-
output,
434-
contains('Creating temporary winuwp folder'),
435-
);
436-
437-
expect(
438-
processRunner.recordedCalls,
439-
orderedEquals(<ProcessCall>[
440-
ProcessCall(
441-
getFlutterCommand(mockPlatform),
442-
const <String>['create', '--platforms=winuwp', '.'],
443-
pluginExampleDirectory.path),
444-
ProcessCall(getFlutterCommand(mockPlatform),
445-
const <String>['build', 'winuwp'], pluginExampleDirectory.path),
446-
]));
447-
});
448-
449367
test(
450368
'building for Android when plugin is not set up for Android results in no-op',
451369
() async {

0 commit comments

Comments
 (0)