Enable macOS XCTest support (#4043)

- Adds macOS support to the `xctest` tool command
- Adds logic to the tool to check for packages that delegate their implementations
  to another package, so they can be skipped when running native unit tests
  - Updates the tool's unit test utility for writing pubspecs to be able to make
    delegated federated implementation references to test it
- Adds initial unit tests to the non-deprecated macOS plugins
- Enables macOS XCTesting in CI

macOS portion of https://github.com/flutter/flutter/issues/82445
This commit is contained in:
stuartmorgan
2021-06-10 14:50:20 -07:00
committed by GitHub
parent b98034dd76
commit cb92e5d416
12 changed files with 956 additions and 549 deletions

View File

@ -15,17 +15,17 @@ class DriveExamplesCommand extends PluginCommand {
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
}) : super(packagesDir, processRunner: processRunner) {
argParser.addFlag(kAndroid,
argParser.addFlag(kPlatformFlagAndroid,
help: 'Runs the Android implementation of the examples');
argParser.addFlag(kIos,
argParser.addFlag(kPlatformFlagIos,
help: 'Runs the iOS implementation of the examples');
argParser.addFlag(kLinux,
argParser.addFlag(kPlatformFlagLinux,
help: 'Runs the Linux implementation of the examples');
argParser.addFlag(kMacos,
argParser.addFlag(kPlatformFlagMacos,
help: 'Runs the macOS implementation of the examples');
argParser.addFlag(kWeb,
argParser.addFlag(kPlatformFlagWeb,
help: 'Runs the web implementation of the examples');
argParser.addFlag(kWindows,
argParser.addFlag(kPlatformFlagWindows,
help: 'Runs the Windows implementation of the examples');
argParser.addOption(
kEnableExperiment,
@ -52,10 +52,10 @@ class DriveExamplesCommand extends PluginCommand {
Future<void> run() async {
final List<String> failingTests = <String>[];
final List<String> pluginsWithoutTests = <String>[];
final bool isLinux = getBoolArg(kLinux);
final bool isMacos = getBoolArg(kMacos);
final bool isWeb = getBoolArg(kWeb);
final bool isWindows = getBoolArg(kWindows);
final bool isLinux = getBoolArg(kPlatformFlagLinux);
final bool isMacos = getBoolArg(kPlatformFlagMacos);
final bool isWeb = getBoolArg(kPlatformFlagWeb);
final bool isWindows = getBoolArg(kPlatformFlagWindows);
await for (final Directory plugin in getPlugins()) {
final String pluginName = plugin.basename;
if (pluginName.endsWith('_platform_interface') &&
@ -219,12 +219,12 @@ Tried searching for the following:
Future<bool> _pluginSupportedOnCurrentPlatform(
FileSystemEntity plugin) async {
final bool isAndroid = getBoolArg(kAndroid);
final bool isIOS = getBoolArg(kIos);
final bool isLinux = getBoolArg(kLinux);
final bool isMacos = getBoolArg(kMacos);
final bool isWeb = getBoolArg(kWeb);
final bool isWindows = getBoolArg(kWindows);
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);
if (isAndroid) {
return isAndroidPlugin(plugin);
}