[flutter_plugin_tool] Refactor createFakePlugin (#4064)

This commit is contained in:
stuartmorgan
2021-06-17 13:29:03 -07:00
committed by GitHub
parent 10486b0ceb
commit 81a6f66eee
21 changed files with 649 additions and 830 deletions

View File

@ -18,17 +18,17 @@ class DriveExamplesCommand extends PluginCommand {
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
}) : super(packagesDir, processRunner: processRunner) {
argParser.addFlag(kPlatformFlagAndroid,
argParser.addFlag(kPlatformAndroid,
help: 'Runs the Android implementation of the examples');
argParser.addFlag(kPlatformFlagIos,
argParser.addFlag(kPlatformIos,
help: 'Runs the iOS implementation of the examples');
argParser.addFlag(kPlatformFlagLinux,
argParser.addFlag(kPlatformLinux,
help: 'Runs the Linux implementation of the examples');
argParser.addFlag(kPlatformFlagMacos,
argParser.addFlag(kPlatformMacos,
help: 'Runs the macOS implementation of the examples');
argParser.addFlag(kPlatformFlagWeb,
argParser.addFlag(kPlatformWeb,
help: 'Runs the web implementation of the examples');
argParser.addFlag(kPlatformFlagWindows,
argParser.addFlag(kPlatformWindows,
help: 'Runs the Windows implementation of the examples');
argParser.addOption(
kEnableExperiment,
@ -55,10 +55,10 @@ class DriveExamplesCommand extends PluginCommand {
Future<void> run() async {
final List<String> failingTests = <String>[];
final List<String> pluginsWithoutTests = <String>[];
final bool isLinux = getBoolArg(kPlatformFlagLinux);
final bool isMacos = getBoolArg(kPlatformFlagMacos);
final bool isWeb = getBoolArg(kPlatformFlagWeb);
final bool isWindows = getBoolArg(kPlatformFlagWindows);
final bool isLinux = getBoolArg(kPlatformLinux);
final bool isMacos = getBoolArg(kPlatformMacos);
final bool isWeb = getBoolArg(kPlatformWeb);
final bool isWindows = getBoolArg(kPlatformWindows);
await for (final Directory plugin in getPlugins()) {
final String pluginName = plugin.basename;
if (pluginName.endsWith('_platform_interface') &&
@ -222,12 +222,12 @@ Tried searching for the following:
Future<bool> _pluginSupportedOnCurrentPlatform(
FileSystemEntity plugin) async {
final bool isAndroid = getBoolArg(kPlatformFlagAndroid);
final bool isIOS = getBoolArg(kPlatformFlagIos);
final bool isLinux = getBoolArg(kPlatformFlagLinux);
final bool isMacos = getBoolArg(kPlatformFlagMacos);
final bool isWeb = getBoolArg(kPlatformFlagWeb);
final bool isWindows = getBoolArg(kPlatformFlagWindows);
final bool isAndroid = getBoolArg(kPlatformAndroid);
final bool isIOS = getBoolArg(kPlatformIos);
final bool isLinux = getBoolArg(kPlatformLinux);
final bool isMacos = getBoolArg(kPlatformMacos);
final bool isWeb = getBoolArg(kPlatformWeb);
final bool isWindows = getBoolArg(kPlatformWindows);
if (isAndroid) {
return isAndroidPlugin(plugin);
}