From 0f6e4e6190d1c128b8baadd2dee3b2a8923d3f86 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Fri, 24 May 2019 15:39:48 -0400 Subject: [PATCH] Add macosPrefix to the pubspec schema for plugins (#33287) Adds a new macosPrefix, which serves the same purpose as iosPrefix but for macOS plugins. It is not yet used by the tooling, but this allows for plugins to start to be written using it in preparation for tooling support for plugins. Part of #32718 --- packages/flutter_tools/lib/src/flutter_manifest.dart | 5 ++++- packages/flutter_tools/lib/src/plugins.dart | 5 +++++ packages/flutter_tools/schema/pubspec_yaml.json | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/flutter_tools/lib/src/flutter_manifest.dart b/packages/flutter_tools/lib/src/flutter_manifest.dart index a75748645e..6a23999885 100644 --- a/packages/flutter_tools/lib/src/flutter_manifest.dart +++ b/packages/flutter_tools/lib/src/flutter_manifest.dart @@ -371,7 +371,10 @@ void _validateFlutter(YamlMap yaml, List errors) { errors.add('The "androidPackage" must either be null or a string.'); } if (kvp.value['iosPrefix'] != null && kvp.value['iosPrefix'] is! String) { - errors.add('The "iosPrefix" must eithe rbe null or a string.'); + errors.add('The "iosPrefix" must either be null or a string.'); + } + if (kvp.value['macosPrefix'] != null && kvp.value['macosPrefix'] is! String) { + errors.add('The "macosPrefix" must either be null or a string.'); } if (kvp.value['pluginClass'] != null && kvp.value['pluginClass'] is! String) { errors.add('The "pluginClass" must either be null or a string..'); diff --git a/packages/flutter_tools/lib/src/plugins.dart b/packages/flutter_tools/lib/src/plugins.dart index 5d14fa7025..5f35e9ffcc 100644 --- a/packages/flutter_tools/lib/src/plugins.dart +++ b/packages/flutter_tools/lib/src/plugins.dart @@ -27,16 +27,19 @@ class Plugin { this.path, this.androidPackage, this.iosPrefix, + this.macosPrefix, this.pluginClass, }); factory Plugin.fromYaml(String name, String path, dynamic pluginYaml) { String androidPackage; String iosPrefix; + String macosPrefix; String pluginClass; if (pluginYaml != null) { androidPackage = pluginYaml['androidPackage']; iosPrefix = pluginYaml['iosPrefix'] ?? ''; + macosPrefix = pluginYaml['macosPrefix'] ?? ''; pluginClass = pluginYaml['pluginClass']; } return Plugin( @@ -44,6 +47,7 @@ class Plugin { path: path, androidPackage: androidPackage, iosPrefix: iosPrefix, + macosPrefix: macosPrefix, pluginClass: pluginClass, ); } @@ -52,6 +56,7 @@ class Plugin { final String path; final String androidPackage; final String iosPrefix; + final String macosPrefix; final String pluginClass; } diff --git a/packages/flutter_tools/schema/pubspec_yaml.json b/packages/flutter_tools/schema/pubspec_yaml.json index 632becee53..58d41f6982 100644 --- a/packages/flutter_tools/schema/pubspec_yaml.json +++ b/packages/flutter_tools/schema/pubspec_yaml.json @@ -58,6 +58,7 @@ "properties": { "androidPackage": { "type": "string" }, "iosPrefix": { "type": "string" }, + "macosPrefix": { "type": "string" }, "pluginClass": { "type": "string" } } }