[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:
stuartmorgan
2021-08-26 15:07:33 -04:00
committed by GitHub
parent e7ef3168bf
commit dcf97f741f
14 changed files with 590 additions and 245 deletions

View File

@ -127,8 +127,8 @@ void main() {
'example/test_driver/integration_test.dart',
'example/integration_test/foo_test.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformIos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformIos: const PlatformDetails(PlatformSupport.inline),
},
);
@ -192,9 +192,9 @@ void main() {
'example/test_driver/plugin_test.dart',
'example/test_driver/plugin.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.inline,
kPlatformIos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.inline),
kPlatformIos: const PlatformDetails(PlatformSupport.inline),
},
);
@ -242,9 +242,9 @@ void main() {
extraFiles: <String>[
'example/test_driver/plugin_test.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.inline,
kPlatformIos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.inline),
kPlatformIos: const PlatformDetails(PlatformSupport.inline),
},
);
@ -275,9 +275,9 @@ void main() {
extraFiles: <String>[
'example/lib/main.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.inline,
kPlatformIos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.inline),
kPlatformIos: const PlatformDetails(PlatformSupport.inline),
},
);
@ -311,9 +311,9 @@ void main() {
'example/integration_test/foo_test.dart',
'example/integration_test/ignore_me.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.inline,
kPlatformIos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.inline),
kPlatformIos: const PlatformDetails(PlatformSupport.inline),
},
);
@ -397,8 +397,8 @@ void main() {
'example/test_driver/plugin_test.dart',
'example/test_driver/plugin.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformLinux: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformLinux: const PlatformDetails(PlatformSupport.inline),
},
);
@ -470,8 +470,8 @@ void main() {
'example/test_driver/plugin.dart',
'example/macos/macos.swift',
],
platformSupport: <String, PlatformSupport>{
kPlatformMacos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformMacos: const PlatformDetails(PlatformSupport.inline),
},
);
@ -541,8 +541,8 @@ void main() {
'example/test_driver/plugin_test.dart',
'example/test_driver/plugin.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformWeb: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformWeb: const PlatformDetails(PlatformSupport.inline),
},
);
@ -615,8 +615,8 @@ void main() {
'example/test_driver/plugin_test.dart',
'example/test_driver/plugin.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformWindows: PlatformSupport.inline
platformSupport: <String, PlatformDetails>{
kPlatformWindows: const PlatformDetails(PlatformSupport.inline),
},
);
@ -654,6 +654,40 @@ void main() {
]));
});
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>{
kPlatformWindows: 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',
@ -662,8 +696,8 @@ void main() {
'example/test_driver/plugin_test.dart',
'example/test_driver/plugin.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.inline),
},
);
@ -712,8 +746,8 @@ void main() {
'example/test_driver/plugin_test.dart',
'example/test_driver/plugin.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformMacos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformMacos: const PlatformDetails(PlatformSupport.inline),
},
);
@ -745,8 +779,8 @@ void main() {
'example/test_driver/plugin_test.dart',
'example/test_driver/plugin.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformMacos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformMacos: const PlatformDetails(PlatformSupport.inline),
},
);
@ -800,9 +834,9 @@ void main() {
'example/test_driver/plugin_test.dart',
'example/test_driver/plugin.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.inline,
kPlatformIos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.inline),
kPlatformIos: const PlatformDetails(PlatformSupport.inline),
},
);
@ -842,8 +876,8 @@ void main() {
'plugin',
packagesDir,
examples: <String>[],
platformSupport: <String, PlatformSupport>{
kPlatformWeb: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformWeb: const PlatformDetails(PlatformSupport.inline),
},
);
@ -874,8 +908,8 @@ void main() {
'example/integration_test/bar_test.dart',
'example/integration_test/foo_test.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformWeb: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformWeb: const PlatformDetails(PlatformSupport.inline),
},
);
@ -906,8 +940,8 @@ void main() {
extraFiles: <String>[
'example/test_driver/integration_test.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformWeb: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformWeb: const PlatformDetails(PlatformSupport.inline),
},
);
@ -942,8 +976,8 @@ void main() {
'example/integration_test/bar_test.dart',
'example/integration_test/foo_test.dart',
],
platformSupport: <String, PlatformSupport>{
kPlatformMacos: PlatformSupport.inline,
platformSupport: <String, PlatformDetails>{
kPlatformMacos: const PlatformDetails(PlatformSupport.inline),
},
);