[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

@ -43,8 +43,8 @@ void main() {
final Directory pluginDir =
createFakePlugin('plugin1', packagesDir, extraFiles: <String>[
'example/android/gradlew',
], platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.inline
], platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.inline)
});
final Directory androidDir =
@ -74,8 +74,8 @@ void main() {
test('fails if gradlew is missing', () async {
createFakePlugin('plugin1', packagesDir,
platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.inline
platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.inline)
});
Error? commandError;
@ -96,8 +96,8 @@ void main() {
test('fails if linting finds issues', () async {
createFakePlugin('plugin1', packagesDir,
platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.inline
platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.inline)
});
processRunner.mockProcessesForExecutable['gradlew'] = <io.Process>[
@ -138,8 +138,8 @@ void main() {
test('skips non-inline plugins', () async {
createFakePlugin('plugin1', packagesDir,
platformSupport: <String, PlatformSupport>{
kPlatformAndroid: PlatformSupport.federated
platformSupport: <String, PlatformDetails>{
kPlatformAndroid: const PlatformDetails(PlatformSupport.federated)
});
final List<String> output =