Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
23cea267
Unverified
Commit
23cea267
authored
Oct 01, 2021
by
stuartmorgan
Committed by
GitHub
Oct 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add dartPluginClass support for Android and iOS (#87991)
parent
0b38b9cb
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
388 additions
and
230 deletions
+388
-230
dart_plugin_registrant.dart
.../lib/src/build_system/targets/dart_plugin_registrant.dart
+8
-11
flutter_plugins.dart
packages/flutter_tools/lib/src/flutter_plugins.dart
+54
-14
platform_plugins.dart
packages/flutter_tools/lib/src/platform_plugins.dart
+70
-21
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+24
-33
android_plugin_test.dart
...flutter_tools/test/general.shard/android_plugin_test.dart
+34
-0
dart_plugin_registrant_test.dart
...ard/build_system/targets/dart_plugin_registrant_test.dart
+10
-13
dart_plugin_test.dart
...es/flutter_tools/test/general.shard/dart_plugin_test.dart
+117
-125
plugin_parsing_test.dart
...flutter_tools/test/general.shard/plugin_parsing_test.dart
+18
-13
plugins_test.dart
packages/flutter_tools/test/general.shard/plugins_test.dart
+53
-0
No files found.
packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart
View file @
23cea267
...
@@ -61,17 +61,14 @@ class DartPluginRegistrantTarget extends Target {
...
@@ -61,17 +61,14 @@ class DartPluginRegistrantTarget extends Target {
return
true
;
return
true
;
}
}
final
String
?
platformName
=
environment
.
defines
[
kTargetPlatform
];
final
String
?
platformName
=
environment
.
defines
[
kTargetPlatform
];
if
(
platformName
==
null
)
{
final
TargetPlatform
?
targetPlatform
=
platformName
==
null
?
null
return
true
;
:
getTargetPlatformForName
(
platformName
);
}
// TODO(stuartmorgan): Investigate removing this check entirely; ideally the
final
TargetPlatform
?
targetPlatform
=
getTargetPlatformForName
(
platformName
);
// source generation step shouldn't be platform dependent, and the generated
// TODO(egarciad): Support Android and iOS.
// code should just do the right thing on every platform.
// https://github.com/flutter/flutter/issues/52267
return
targetPlatform
==
TargetPlatform
.
fuchsia_arm64
||
return
targetPlatform
!=
TargetPlatform
.
darwin
&&
targetPlatform
==
TargetPlatform
.
fuchsia_x64
||
targetPlatform
!=
TargetPlatform
.
linux_x64
&&
targetPlatform
==
TargetPlatform
.
web_javascript
;
targetPlatform
!=
TargetPlatform
.
linux_arm64
&&
targetPlatform
!=
TargetPlatform
.
windows_x64
&&
targetPlatform
!=
TargetPlatform
.
windows_uwp_x64
;
}
}
@override
@override
...
...
packages/flutter_tools/lib/src/flutter_plugins.dart
View file @
23cea267
...
@@ -353,8 +353,9 @@ AndroidEmbeddingVersion _getAndroidEmbeddingVersion(FlutterProject project) {
...
@@ -353,8 +353,9 @@ AndroidEmbeddingVersion _getAndroidEmbeddingVersion(FlutterProject project) {
}
}
Future
<
void
>
_writeAndroidPluginRegistrant
(
FlutterProject
project
,
List
<
Plugin
>
plugins
)
async
{
Future
<
void
>
_writeAndroidPluginRegistrant
(
FlutterProject
project
,
List
<
Plugin
>
plugins
)
async
{
final
List
<
Plugin
>
nativePlugins
=
_filterNativePlugins
(
plugins
,
AndroidPlugin
.
kConfigKey
);
final
List
<
Map
<
String
,
Object
?>>
androidPlugins
=
final
List
<
Map
<
String
,
Object
?>>
androidPlugins
=
_extractPlatformMaps
(
p
lugins
,
AndroidPlugin
.
kConfigKey
);
_extractPlatformMaps
(
nativeP
lugins
,
AndroidPlugin
.
kConfigKey
);
final
Map
<
String
,
Object
>
templateContext
=
<
String
,
Object
>{
final
Map
<
String
,
Object
>
templateContext
=
<
String
,
Object
>{
'plugins'
:
androidPlugins
,
'plugins'
:
androidPlugins
,
...
@@ -676,9 +677,9 @@ const String _dartPluginRegisterWith = r'''
...
@@ -676,9 +677,9 @@ const String _dartPluginRegisterWith = r'''
}
}
''';
''';
// TODO(egarciad): Evaluate merging the web and
desktop
plugin registry templates.
// TODO(egarciad): Evaluate merging the web and
non-web
plugin registry templates.
// https://github.com/flutter/flutter/issues/80406
// https://github.com/flutter/flutter/issues/80406
const String _dartPluginRegistryFor
Desktop
Template = '''
const String _dartPluginRegistryFor
NonWeb
Template = '''
//
//
// Generated file. Do not edit.
// Generated file. Do not edit.
// This file is generated from template in file `flutter_tools/lib/src/flutter_plugins.dart`.
// This file is generated from template in file `flutter_tools/lib/src/flutter_plugins.dart`.
...
@@ -688,6 +689,12 @@ const String _dartPluginRegistryForDesktopTemplate = '''
...
@@ -688,6 +689,12 @@ const String _dartPluginRegistryForDesktopTemplate = '''
import
'{{mainEntrypoint}}'
as
entrypoint
;
import
'{{mainEntrypoint}}'
as
entrypoint
;
import
'dart:io'
;
// flutter_ignore: dart_io_import.
import
'dart:io'
;
// flutter_ignore: dart_io_import.
{{
#android
}}
import
'package:{{pluginName}}/{{pluginName}}.dart'
;
{{/
android
}}
{{
#ios
}}
import
'package:{{pluginName}}/{{pluginName}}.dart'
;
{{/
ios
}}
{{
#linux
}}
{{
#linux
}}
import
'package:{{pluginName}}/{{pluginName}}.dart'
;
import
'package:{{pluginName}}/{{pluginName}}.dart'
;
{{/
linux
}}
{{/
linux
}}
...
@@ -703,7 +710,15 @@ class _PluginRegistrant {
...
@@ -703,7 +710,15 @@ class _PluginRegistrant {
@pragma
(
'vm:entry-point'
)
@pragma
(
'vm:entry-point'
)
static
void
register
()
{
static
void
register
()
{
if
(
Platform
.
isLinux
)
{
if
(
Platform
.
isAndroid
)
{
{{
#android
}}
$_dartPluginRegisterWith
{{/
android
}}
}
else
if
(
Platform
.
isIOS
)
{
{{
#ios
}}
$_dartPluginRegisterWith
{{/
ios
}}
}
else
if
(
Platform
.
isLinux
)
{
{{
#linux
}}
{{
#linux
}}
$_dartPluginRegisterWith
$_dartPluginRegisterWith
{{/
linux
}}
{{/
linux
}}
...
@@ -733,7 +748,8 @@ void main(List<String> args) {
...
@@ -733,7 +748,8 @@ void main(List<String> args) {
''';
''';
Future<void> _writeIOSPluginRegistrant(FlutterProject project, List<Plugin> plugins) async {
Future<void> _writeIOSPluginRegistrant(FlutterProject project, List<Plugin> plugins) async {
final List<Map<String, Object?>> iosPlugins = _extractPlatformMaps(plugins, IOSPlugin.kConfigKey);
final List<Plugin> nativePlugins = _filterNativePlugins(plugins, IOSPlugin.kConfigKey);
final List<Map<String, Object?>> iosPlugins = _extractPlatformMaps(nativePlugins, IOSPlugin.kConfigKey);
final Map<String, Object> context = <String, Object>{
final Map<String, Object> context = <String, Object>{
'
os
': '
ios
',
'
os
': '
ios
',
'
deploymentTarget
': '
9.0
',
'
deploymentTarget
': '
9.0
',
...
@@ -1119,11 +1135,15 @@ bool hasPlugins(FlutterProject project) {
...
@@ -1119,11 +1135,15 @@ bool hasPlugins(FlutterProject project) {
/// * Else fail.
/// * Else fail.
///
///
/// For more details, https://flutter.dev/go/federated-plugins.
/// For more details, https://flutter.dev/go/federated-plugins.
// TODO(stuartmorgan): Expand implementation to apply to all implementations,
// not just Dart-only, per the federated plugin spec.
List
<
PluginInterfaceResolution
>
resolvePlatformImplementation
(
List
<
PluginInterfaceResolution
>
resolvePlatformImplementation
(
List
<
Plugin
>
plugins
,
{
List
<
Plugin
>
plugins
,
{
bool
throwOnPluginPubspecError
=
true
,
bool
throwOnPluginPubspecError
=
true
,
})
{
})
{
final
List
<
String
>
platforms
=
<
String
>[
final
List
<
String
>
platforms
=
<
String
>[
AndroidPlugin
.
kConfigKey
,
IOSPlugin
.
kConfigKey
,
LinuxPlugin
.
kConfigKey
,
LinuxPlugin
.
kConfigKey
,
MacOSPlugin
.
kConfigKey
,
MacOSPlugin
.
kConfigKey
,
WindowsPlugin
.
kConfigKey
,
WindowsPlugin
.
kConfigKey
,
...
@@ -1135,20 +1155,28 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
...
@@ -1135,20 +1155,28 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
for
(
final
Plugin
plugin
in
plugins
)
{
for
(
final
Plugin
plugin
in
plugins
)
{
for
(
final
String
platform
in
platforms
)
{
for
(
final
String
platform
in
platforms
)
{
// The plugin doesn't implement this platform.
if
(
plugin
.
platforms
[
platform
]
==
null
&&
if
(
plugin
.
platforms
[
platform
]
==
null
&&
plugin
.
defaultPackagePlatforms
[
platform
]
==
null
)
{
plugin
.
defaultPackagePlatforms
[
platform
]
==
null
)
{
// The plugin doesn't implement this platform.
continue
;
continue
;
}
}
// The plugin doesn't implement an interface, verify that it has a default implementation.
String
?
implementsPackage
=
plugin
.
implementsPackage
;
final
String
?
implementsPackage
=
plugin
.
implementsPackage
;
if
(
implementsPackage
==
null
||
implementsPackage
.
isEmpty
)
{
if
(
implementsPackage
==
null
||
implementsPackage
.
isEmpty
)
{
final
String
?
defaultImplementation
=
plugin
.
defaultPackagePlatforms
[
platform
];
final
String
?
defaultImplementation
=
plugin
.
defaultPackagePlatforms
[
platform
];
if
(
defaultImplementation
==
null
)
{
final
bool
hasInlineDartImplementation
=
plugin
.
pluginDartClassPlatforms
[
platform
]
!=
null
;
if
(
defaultImplementation
==
null
&&
!
hasInlineDartImplementation
)
{
if
(
throwOnPluginPubspecError
)
{
if
(
throwOnPluginPubspecError
)
{
globals
.
printError
(
globals
.
printError
(
"Plugin `
${plugin.name}
` doesn't implement a plugin interface, nor sets "
"Plugin `
${plugin.name}
` doesn't implement a plugin interface, nor does "
'a default implementation in pubspec.yaml.
\n\n
'
'it specify an implementation in pubspec.yaml.
\n\n
'
'To set an inline implementation, use:
\n
'
'flutter:
\n
'
' plugin:
\n
'
' platforms:
\n
'
'
$platform
:
\n
'
'
$kDartPluginClass
: <plugin-class>
\n
'
'
\n
'
'To set a default implementation, use:
\n
'
'To set a default implementation, use:
\n
'
'flutter:
\n
'
'flutter:
\n
'
' plugin:
\n
'
' plugin:
\n
'
...
@@ -1166,8 +1194,18 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
...
@@ -1166,8 +1194,18 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
didFindError
=
true
;
didFindError
=
true
;
continue
;
continue
;
}
}
defaultImplementations
[
'
$platform
/
${plugin.name}
'
]
=
defaultImplementation
;
if
(
defaultImplementation
!=
null
)
{
continue
;
defaultImplementations
[
'
$platform
/
${plugin.name}
'
]
=
defaultImplementation
;
continue
;
}
else
if
(
platform
!=
'linux'
&&
platform
!=
'macos'
&&
platform
!=
'windows'
)
{
// An interface package (i.e., one with no 'implements') with an
// inline implementation is its own default implementation.
// TODO(stuartmorgan): This should be true on desktop as well, but
// enabling that would be a breaking change for most existing
// Dart-only plugins. See https://github.com/flutter/flutter/issues/87862
implementsPackage
=
plugin
.
name
;
defaultImplementations
[
'
$platform
/
${plugin.name}
'
]
=
plugin
.
name
;
}
}
}
if
(
plugin
.
pluginDartClassPlatforms
[
platform
]
==
null
||
if
(
plugin
.
pluginDartClassPlatforms
[
platform
]
==
null
||
plugin
.
pluginDartClassPlatforms
[
platform
]
==
'none'
)
{
plugin
.
pluginDartClassPlatforms
[
platform
]
==
'none'
)
{
...
@@ -1249,6 +1287,8 @@ Future<void> generateMainDartWithPluginRegistrant(
...
@@ -1249,6 +1287,8 @@ Future<void> generateMainDartWithPluginRegistrant(
final
Map
<
String
,
Object
>
templateContext
=
<
String
,
Object
>{
final
Map
<
String
,
Object
>
templateContext
=
<
String
,
Object
>{
'mainEntrypoint'
:
currentMainUri
,
'mainEntrypoint'
:
currentMainUri
,
'dartLanguageVersion'
:
entrypointVersion
.
toString
(),
'dartLanguageVersion'
:
entrypointVersion
.
toString
(),
AndroidPlugin
.
kConfigKey
:
<
Object
?>[],
IOSPlugin
.
kConfigKey
:
<
Object
?>[],
LinuxPlugin
.
kConfigKey
:
<
Object
?>[],
LinuxPlugin
.
kConfigKey
:
<
Object
?>[],
MacOSPlugin
.
kConfigKey
:
<
Object
?>[],
MacOSPlugin
.
kConfigKey
:
<
Object
?>[],
WindowsPlugin
.
kConfigKey
:
<
Object
?>[],
WindowsPlugin
.
kConfigKey
:
<
Object
?>[],
...
@@ -1274,7 +1314,7 @@ Future<void> generateMainDartWithPluginRegistrant(
...
@@ -1274,7 +1314,7 @@ Future<void> generateMainDartWithPluginRegistrant(
}
}
try
{
try
{
_renderTemplateToFile
(
_renderTemplateToFile
(
_dartPluginRegistryFor
Desktop
Template
,
_dartPluginRegistryFor
NonWeb
Template
,
templateContext
,
templateContext
,
newMainDart
,
newMainDart
,
globals
.
templateRenderer
,
globals
.
templateRenderer
,
...
...
packages/flutter_tools/lib/src/platform_plugins.dart
View file @
23cea267
...
@@ -49,14 +49,22 @@ abstract class NativeOrDartPlugin {
...
@@ -49,14 +49,22 @@ abstract class NativeOrDartPlugin {
/// Contains parameters to template an Android plugin.
/// Contains parameters to template an Android plugin.
///
///
/// The required fields include: [name] of the plugin, [package] of the plugin and
/// The [name] of the plugin is required. Additionally, either:
/// the [pluginClass] that will be the entry point to the plugin's native code.
/// - [defaultPackage], or
class
AndroidPlugin
extends
PluginPlatform
{
/// - an implementation consisting of:
/// - the [package] and [pluginClass] that will be the entry point to the
/// plugin's native code, and/or
/// - the [dartPluginClass] that will be the entry point for the plugin's
/// Dart code
/// is required.
class
AndroidPlugin
extends
PluginPlatform
implements
NativeOrDartPlugin
{
AndroidPlugin
({
AndroidPlugin
({
required
this
.
name
,
required
this
.
name
,
required
this
.
package
,
required
this
.
pluginClass
,
required
this
.
pluginPath
,
required
this
.
pluginPath
,
this
.
package
,
this
.
pluginClass
,
this
.
dartPluginClass
,
this
.
defaultPackage
,
required
FileSystem
fileSystem
,
required
FileSystem
fileSystem
,
})
:
_fileSystem
=
fileSystem
;
})
:
_fileSystem
=
fileSystem
;
...
@@ -64,8 +72,10 @@ class AndroidPlugin extends PluginPlatform {
...
@@ -64,8 +72,10 @@ class AndroidPlugin extends PluginPlatform {
assert
(
validate
(
yaml
));
assert
(
validate
(
yaml
));
return
AndroidPlugin
(
return
AndroidPlugin
(
name:
name
,
name:
name
,
package:
yaml
[
'package'
]
as
String
,
package:
yaml
[
'package'
]
as
String
?,
pluginClass:
yaml
[
'pluginClass'
]
as
String
,
pluginClass:
yaml
[
kPluginClass
]
as
String
?,
dartPluginClass:
yaml
[
kDartPluginClass
]
as
String
?,
defaultPackage:
yaml
[
kDefaultPackage
]
as
String
?,
pluginPath:
pluginPath
,
pluginPath:
pluginPath
,
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
);
);
...
@@ -73,11 +83,16 @@ class AndroidPlugin extends PluginPlatform {
...
@@ -73,11 +83,16 @@ class AndroidPlugin extends PluginPlatform {
final
FileSystem
_fileSystem
;
final
FileSystem
_fileSystem
;
@override
bool
isNative
()
=>
pluginClass
!=
null
;
static
bool
validate
(
YamlMap
yaml
)
{
static
bool
validate
(
YamlMap
yaml
)
{
if
(
yaml
==
null
)
{
if
(
yaml
==
null
)
{
return
false
;
return
false
;
}
}
return
yaml
[
'package'
]
is
String
&&
yaml
[
'pluginClass'
]
is
String
;
return
(
yaml
[
'package'
]
is
String
&&
yaml
[
'pluginClass'
]
is
String
)||
yaml
[
kDartPluginClass
]
is
String
||
yaml
[
kDefaultPackage
]
is
String
;
}
}
static
const
String
kConfigKey
=
'android'
;
static
const
String
kConfigKey
=
'android'
;
...
@@ -86,10 +101,16 @@ class AndroidPlugin extends PluginPlatform {
...
@@ -86,10 +101,16 @@ class AndroidPlugin extends PluginPlatform {
final
String
name
;
final
String
name
;
/// The plugin package name defined in pubspec.yaml.
/// The plugin package name defined in pubspec.yaml.
final
String
package
;
final
String
?
package
;
/// The plugin main class defined in pubspec.yaml.
/// The native plugin main class defined in pubspec.yaml, if any.
final
String
pluginClass
;
final
String
?
pluginClass
;
/// The Dart plugin main class defined in pubspec.yaml, if any.
final
String
?
dartPluginClass
;
/// The default implementation package defined in pubspec.yaml, if any.
final
String
?
defaultPackage
;
/// The absolute path to the plugin in the pub cache.
/// The absolute path to the plugin in the pub cache.
final
String
pluginPath
;
final
String
pluginPath
;
...
@@ -98,8 +119,10 @@ class AndroidPlugin extends PluginPlatform {
...
@@ -98,8 +119,10 @@ class AndroidPlugin extends PluginPlatform {
Map
<
String
,
dynamic
>
toMap
()
{
Map
<
String
,
dynamic
>
toMap
()
{
return
<
String
,
dynamic
>{
return
<
String
,
dynamic
>{
'name'
:
name
,
'name'
:
name
,
'package'
:
package
,
if
(
package
!=
null
)
'package'
:
package
,
'class'
:
pluginClass
,
if
(
pluginClass
!=
null
)
'class'
:
pluginClass
,
if
(
dartPluginClass
!=
null
)
kDartPluginClass
:
dartPluginClass
,
if
(
defaultPackage
!=
null
)
kDefaultPackage
:
defaultPackage
,
// Mustache doesn't support complex types.
// Mustache doesn't support complex types.
'supportsEmbeddingV1'
:
_supportedEmbeddings
.
contains
(
'1'
),
'supportsEmbeddingV1'
:
_supportedEmbeddings
.
contains
(
'1'
),
'supportsEmbeddingV2'
:
_supportedEmbeddings
.
contains
(
'2'
),
'supportsEmbeddingV2'
:
_supportedEmbeddings
.
contains
(
'2'
),
...
@@ -119,6 +142,13 @@ class AndroidPlugin extends PluginPlatform {
...
@@ -119,6 +142,13 @@ class AndroidPlugin extends PluginPlatform {
'main'
,
'main'
,
);
);
final
String
?
package
=
this
.
package
;
// Don't attempt to validate the native code if there isn't supposed to
// be any.
if
(
package
==
null
)
{
return
supportedEmbeddings
;
}
final
List
<
String
>
mainClassCandidates
=
<
String
>[
final
List
<
String
>
mainClassCandidates
=
<
String
>[
_fileSystem
.
path
.
join
(
_fileSystem
.
path
.
join
(
baseMainPath
,
baseMainPath
,
...
@@ -170,13 +200,21 @@ class AndroidPlugin extends PluginPlatform {
...
@@ -170,13 +200,21 @@ class AndroidPlugin extends PluginPlatform {
/// Contains the parameters to template an iOS plugin.
/// Contains the parameters to template an iOS plugin.
///
///
/// The required fields include: [name] of the plugin, the [pluginClass] that
/// The [name] of the plugin is required. Additionally, either:
/// will be the entry point to the plugin's native code.
/// - [defaultPackage], or
class
IOSPlugin
extends
PluginPlatform
{
/// - an implementation consisting of:
/// - the [pluginClass] (with optional [classPrefix]) that will be the entry
/// point to the plugin's native code, and/or
/// - the [dartPluginClass] that will be the entry point for the plugin's
/// Dart code
/// is required.
class
IOSPlugin
extends
PluginPlatform
implements
NativeOrDartPlugin
{
const
IOSPlugin
({
const
IOSPlugin
({
required
this
.
name
,
required
this
.
name
,
required
this
.
classPrefix
,
required
this
.
classPrefix
,
required
this
.
pluginClass
,
this
.
pluginClass
,
this
.
dartPluginClass
,
this
.
defaultPackage
,
});
});
factory
IOSPlugin
.
fromYaml
(
String
name
,
YamlMap
yaml
)
{
factory
IOSPlugin
.
fromYaml
(
String
name
,
YamlMap
yaml
)
{
...
@@ -184,7 +222,9 @@ class IOSPlugin extends PluginPlatform {
...
@@ -184,7 +222,9 @@ class IOSPlugin extends PluginPlatform {
return
IOSPlugin
(
return
IOSPlugin
(
name:
name
,
name:
name
,
classPrefix:
''
,
classPrefix:
''
,
pluginClass:
yaml
[
'pluginClass'
]
as
String
,
pluginClass:
yaml
[
kPluginClass
]
as
String
?,
dartPluginClass:
yaml
[
kDartPluginClass
]
as
String
?,
defaultPackage:
yaml
[
kDefaultPackage
]
as
String
?,
);
);
}
}
...
@@ -192,7 +232,9 @@ class IOSPlugin extends PluginPlatform {
...
@@ -192,7 +232,9 @@ class IOSPlugin extends PluginPlatform {
if
(
yaml
==
null
)
{
if
(
yaml
==
null
)
{
return
false
;
return
false
;
}
}
return
yaml
[
'pluginClass'
]
is
String
;
return
yaml
[
kPluginClass
]
is
String
||
yaml
[
kDartPluginClass
]
is
String
||
yaml
[
kDefaultPackage
]
is
String
;
}
}
static
const
String
kConfigKey
=
'ios'
;
static
const
String
kConfigKey
=
'ios'
;
...
@@ -202,14 +244,21 @@ class IOSPlugin extends PluginPlatform {
...
@@ -202,14 +244,21 @@ class IOSPlugin extends PluginPlatform {
/// Note, this is here only for legacy reasons. Multi-platform format
/// Note, this is here only for legacy reasons. Multi-platform format
/// always sets it to empty String.
/// always sets it to empty String.
final
String
classPrefix
;
final
String
classPrefix
;
final
String
pluginClass
;
final
String
?
pluginClass
;
final
String
?
dartPluginClass
;
final
String
?
defaultPackage
;
@override
bool
isNative
()
=>
pluginClass
!=
null
;
@override
@override
Map
<
String
,
dynamic
>
toMap
()
{
Map
<
String
,
dynamic
>
toMap
()
{
return
<
String
,
dynamic
>{
return
<
String
,
dynamic
>{
'name'
:
name
,
'name'
:
name
,
'prefix'
:
classPrefix
,
'prefix'
:
classPrefix
,
'class'
:
pluginClass
,
if
(
pluginClass
!=
null
)
'class'
:
pluginClass
,
if
(
dartPluginClass
!=
null
)
kDartPluginClass
:
dartPluginClass
,
if
(
defaultPackage
!=
null
)
kDefaultPackage
:
defaultPackage
,
};
};
}
}
}
}
...
...
packages/flutter_tools/lib/src/plugins.dart
View file @
23cea267
...
@@ -136,44 +136,35 @@ class Plugin {
...
@@ -136,44 +136,35 @@ class Plugin {
WindowsPlugin
.
fromYaml
(
name
,
platformsYaml
[
WindowsPlugin
.
kConfigKey
]
as
YamlMap
);
WindowsPlugin
.
fromYaml
(
name
,
platformsYaml
[
WindowsPlugin
.
kConfigKey
]
as
YamlMap
);
}
}
final
String
?
defaultPackageForLinux
=
// TODO(stuartmorgan): Consider merging web into this common handling; the
_getDefaultPackageForPlatform
(
platformsYaml
,
LinuxPlugin
.
kConfigKey
);
// fact that its implementation of Dart-only plugins and default packages
// are separate is legacy.
final
String
?
defaultPackageForMacOS
=
final
List
<
String
>
sharedHandlingPlatforms
=
<
String
>[
_getDefaultPackageForPlatform
(
platformsYaml
,
MacOSPlugin
.
kConfigKey
);
AndroidPlugin
.
kConfigKey
,
IOSPlugin
.
kConfigKey
,
final
String
?
defaultPackageForWindows
=
LinuxPlugin
.
kConfigKey
,
_getDefaultPackageForPlatform
(
platformsYaml
,
WindowsPlugin
.
kConfigKey
);
MacOSPlugin
.
kConfigKey
,
WindowsPlugin
.
kConfigKey
,
final
String
?
defaultPluginDartClassForLinux
=
];
_getPluginDartClassForPlatform
(
platformsYaml
,
LinuxPlugin
.
kConfigKey
);
final
Map
<
String
,
String
>
defaultPackages
=
<
String
,
String
>{};
final
Map
<
String
,
String
>
dartPluginClasses
=
<
String
,
String
>{};
final
String
?
defaultPluginDartClassForMacOS
=
for
(
final
String
platform
in
sharedHandlingPlatforms
)
{
_getPluginDartClassForPlatform
(
platformsYaml
,
MacOSPlugin
.
kConfigKey
);
final
String
?
defaultPackage
=
_getDefaultPackageForPlatform
(
platformsYaml
,
platform
);
if
(
defaultPackage
!=
null
)
{
final
String
?
defaultPluginDartClassForWindows
=
defaultPackages
[
platform
]
=
defaultPackage
;
_getPluginDartClassForPlatform
(
platformsYaml
,
WindowsPlugin
.
kConfigKey
);
}
final
String
?
dartClass
=
_getPluginDartClassForPlatform
(
platformsYaml
,
platform
);
if
(
dartClass
!=
null
)
{
dartPluginClasses
[
platform
]
=
dartClass
;
}
}
return
Plugin
(
return
Plugin
(
name:
name
,
name:
name
,
path:
path
,
path:
path
,
platforms:
platforms
,
platforms:
platforms
,
defaultPackagePlatforms:
<
String
,
String
>{
defaultPackagePlatforms:
defaultPackages
,
if
(
defaultPackageForLinux
!=
null
)
pluginDartClassPlatforms:
dartPluginClasses
,
LinuxPlugin
.
kConfigKey
:
defaultPackageForLinux
,
if
(
defaultPackageForMacOS
!=
null
)
MacOSPlugin
.
kConfigKey
:
defaultPackageForMacOS
,
if
(
defaultPackageForWindows
!=
null
)
WindowsPlugin
.
kConfigKey
:
defaultPackageForWindows
,
},
pluginDartClassPlatforms:
<
String
,
String
>{
if
(
defaultPluginDartClassForLinux
!=
null
)
LinuxPlugin
.
kConfigKey
:
defaultPluginDartClassForLinux
,
if
(
defaultPluginDartClassForMacOS
!=
null
)
MacOSPlugin
.
kConfigKey
:
defaultPluginDartClassForMacOS
,
if
(
defaultPluginDartClassForWindows
!=
null
)
WindowsPlugin
.
kConfigKey
:
defaultPluginDartClassForWindows
,
},
dependencies:
dependencies
,
dependencies:
dependencies
,
isDirectDependency:
isDirectDependency
,
isDirectDependency:
isDirectDependency
,
implementsPackage:
pluginYaml
[
'implements'
]
!=
null
?
pluginYaml
[
'implements'
]
as
String
:
''
,
implementsPackage:
pluginYaml
[
'implements'
]
!=
null
?
pluginYaml
[
'implements'
]
as
String
:
''
,
...
...
packages/flutter_tools/test/general.shard/android_plugin_test.dart
View file @
23cea267
...
@@ -26,6 +26,40 @@ void main() {
...
@@ -26,6 +26,40 @@ void main() {
));
));
});
});
testWithoutContext
(
'AndroidPlugin does not validate the main class for Dart-only plugins'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
AndroidPlugin
androidPlugin
=
AndroidPlugin
(
name:
'pluginA'
,
dartPluginClass:
'PluginA'
,
pluginPath:
'.pub_cache/plugin_a'
,
fileSystem:
fileSystem
,
);
expect
(
androidPlugin
.
toMap
(),
<
String
,
Object
>{
'name'
:
'pluginA'
,
'dartPluginClass'
:
'PluginA'
,
'supportsEmbeddingV1'
:
false
,
'supportsEmbeddingV2'
:
false
,
});
});
testWithoutContext
(
'AndroidPlugin does not validate the main class for default_package'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
AndroidPlugin
androidPlugin
=
AndroidPlugin
(
name:
'pluginA'
,
defaultPackage:
'plugin_a_android'
,
pluginPath:
'.pub_cache/plugin_a'
,
fileSystem:
fileSystem
,
);
expect
(
androidPlugin
.
toMap
(),
<
String
,
Object
>{
'name'
:
'pluginA'
,
'default_package'
:
'plugin_a_android'
,
'supportsEmbeddingV1'
:
false
,
'supportsEmbeddingV2'
:
false
,
});
});
testWithoutContext
(
'AndroidPlugin parses embedding version 2 from the Java search path'
,
()
{
testWithoutContext
(
'AndroidPlugin parses embedding version 2 from the Java search path'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
AndroidPlugin
androidPlugin
=
AndroidPlugin
(
final
AndroidPlugin
androidPlugin
=
AndroidPlugin
(
...
...
packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart
View file @
23cea267
...
@@ -110,10 +110,7 @@ void main() {
...
@@ -110,10 +110,7 @@ void main() {
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
generateDartPluginRegistry:
false
,
generateDartPluginRegistry:
false
);
defines:
<
String
,
String
>{
kTargetPlatform:
'darwin-x64'
,
});
expect
(
const
DartPluginRegistrantTarget
().
canSkip
(
environment
),
isTrue
);
expect
(
const
DartPluginRegistrantTarget
().
canSkip
(
environment
),
isTrue
);
...
@@ -123,14 +120,10 @@ void main() {
...
@@ -123,14 +120,10 @@ void main() {
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
generateDartPluginRegistry:
true
,
generateDartPluginRegistry:
true
);
defines:
<
String
,
String
>{
kTargetPlatform:
'darwin-x64'
,
});
expect
(
const
DartPluginRegistrantTarget
().
canSkip
(
environment2
),
isFalse
);
expect
(
const
DartPluginRegistrantTarget
().
canSkip
(
environment2
),
isFalse
);
});
});
testWithoutContext
(
'skipped based on platform'
,
()
async
{
testWithoutContext
(
'skipped based on platform'
,
()
async
{
const
Map
<
String
,
bool
>
canSkip
=
<
String
,
bool
>{
const
Map
<
String
,
bool
>
canSkip
=
<
String
,
bool
>{
'darwin-x64'
:
false
,
'darwin-x64'
:
false
,
...
@@ -139,8 +132,8 @@ void main() {
...
@@ -139,8 +132,8 @@ void main() {
'windows-x64'
:
false
,
'windows-x64'
:
false
,
'windows-uwp-x64'
:
false
,
'windows-uwp-x64'
:
false
,
'web-javascript'
:
true
,
'web-javascript'
:
true
,
'ios'
:
tru
e
,
'ios'
:
fals
e
,
'android'
:
tru
e
,
'android'
:
fals
e
,
'fuchsia-arm64'
:
true
,
'fuchsia-arm64'
:
true
,
'fuchsia-x64'
:
true
,
'fuchsia-x64'
:
true
,
};
};
...
@@ -258,7 +251,9 @@ void main() {
...
@@ -258,7 +251,9 @@ void main() {
'
\n
'
'
\n
'
" @pragma('vm:entry-point')
\n
"
" @pragma('vm:entry-point')
\n
"
' static void register() {
\n
'
' static void register() {
\n
'
' if (Platform.isLinux) {
\n
'
' if (Platform.isAndroid) {
\n
'
' } else if (Platform.isIOS) {
\n
'
' } else if (Platform.isLinux) {
\n
'
' try {
\n
'
' try {
\n
'
' PathProviderLinux.registerWith();
\n
'
' PathProviderLinux.registerWith();
\n
'
' } catch (err) {
\n
'
' } catch (err) {
\n
'
...
@@ -395,7 +390,9 @@ void main() {
...
@@ -395,7 +390,9 @@ void main() {
'
\n
'
'
\n
'
" @pragma('vm:entry-point')
\n
"
" @pragma('vm:entry-point')
\n
"
' static void register() {
\n
'
' static void register() {
\n
'
' if (Platform.isLinux) {
\n
'
' if (Platform.isAndroid) {
\n
'
' } else if (Platform.isIOS) {
\n
'
' } else if (Platform.isLinux) {
\n
'
' try {
\n
'
' try {
\n
'
' PathProviderLinux.registerWith();
\n
'
' PathProviderLinux.registerWith();
\n
'
' } catch (err) {
\n
'
' } catch (err) {
\n
'
...
...
packages/flutter_tools/test/general.shard/dart_plugin_test.dart
View file @
23cea267
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/plugin_parsing_test.dart
View file @
23cea267
...
@@ -31,12 +31,10 @@ void main() {
...
@@ -31,12 +31,10 @@ void main() {
final
AndroidPlugin
androidPlugin
=
plugin
.
platforms
[
AndroidPlugin
.
kConfigKey
]!
as
AndroidPlugin
;
final
AndroidPlugin
androidPlugin
=
plugin
.
platforms
[
AndroidPlugin
.
kConfigKey
]!
as
AndroidPlugin
;
final
IOSPlugin
iosPlugin
=
plugin
.
platforms
[
IOSPlugin
.
kConfigKey
]!
as
IOSPlugin
;
final
IOSPlugin
iosPlugin
=
plugin
.
platforms
[
IOSPlugin
.
kConfigKey
]!
as
IOSPlugin
;
final
String
androidPluginClass
=
androidPlugin
.
pluginClass
;
final
String
iosPluginClass
=
iosPlugin
.
pluginClass
;
expect
(
iosPluginClass
,
'SamplePlugin'
);
expect
(
iosPlugin
.
pluginClass
,
'SamplePlugin'
);
expect
(
androidPluginClass
,
'SamplePlugin'
);
expect
(
iosPlugin
.
classPrefix
,
'FLT'
);
expect
(
iosPlugin
.
classPrefix
,
'FLT'
);
expect
(
androidPlugin
.
pluginClass
,
'SamplePlugin'
);
expect
(
androidPlugin
.
package
,
'com.flutter.dev'
);
expect
(
androidPlugin
.
package
,
'com.flutter.dev'
);
});
});
...
@@ -73,12 +71,10 @@ void main() {
...
@@ -73,12 +71,10 @@ void main() {
final
MacOSPlugin
macOSPlugin
=
plugin
.
platforms
[
MacOSPlugin
.
kConfigKey
]!
as
MacOSPlugin
;
final
MacOSPlugin
macOSPlugin
=
plugin
.
platforms
[
MacOSPlugin
.
kConfigKey
]!
as
MacOSPlugin
;
final
WebPlugin
webPlugin
=
plugin
.
platforms
[
WebPlugin
.
kConfigKey
]!
as
WebPlugin
;
final
WebPlugin
webPlugin
=
plugin
.
platforms
[
WebPlugin
.
kConfigKey
]!
as
WebPlugin
;
final
WindowsPlugin
windowsPlugin
=
plugin
.
platforms
[
WindowsPlugin
.
kConfigKey
]!
as
WindowsPlugin
;
final
WindowsPlugin
windowsPlugin
=
plugin
.
platforms
[
WindowsPlugin
.
kConfigKey
]!
as
WindowsPlugin
;
final
String
androidPluginClass
=
androidPlugin
.
pluginClass
;
final
String
iosPluginClass
=
iosPlugin
.
pluginClass
;
expect
(
iosPluginClass
,
'ISamplePlugin'
);
expect
(
iosPlugin
.
pluginClass
,
'ISamplePlugin'
);
expect
(
androidPluginClass
,
'ASamplePlugin'
);
expect
(
iosPlugin
.
classPrefix
,
''
);
expect
(
iosPlugin
.
classPrefix
,
''
);
expect
(
androidPlugin
.
pluginClass
,
'ASamplePlugin'
);
expect
(
androidPlugin
.
package
,
'com.flutter.dev'
);
expect
(
androidPlugin
.
package
,
'com.flutter.dev'
);
expect
(
linuxPlugin
.
pluginClass
,
'LSamplePlugin'
);
expect
(
linuxPlugin
.
pluginClass
,
'LSamplePlugin'
);
expect
(
macOSPlugin
.
pluginClass
,
'MSamplePlugin'
);
expect
(
macOSPlugin
.
pluginClass
,
'MSamplePlugin'
);
...
@@ -122,12 +118,10 @@ void main() {
...
@@ -122,12 +118,10 @@ void main() {
final
MacOSPlugin
macOSPlugin
=
plugin
.
platforms
[
MacOSPlugin
.
kConfigKey
]!
as
MacOSPlugin
;
final
MacOSPlugin
macOSPlugin
=
plugin
.
platforms
[
MacOSPlugin
.
kConfigKey
]!
as
MacOSPlugin
;
final
WebPlugin
webPlugin
=
plugin
.
platforms
[
WebPlugin
.
kConfigKey
]!
as
WebPlugin
;
final
WebPlugin
webPlugin
=
plugin
.
platforms
[
WebPlugin
.
kConfigKey
]!
as
WebPlugin
;
final
WindowsPlugin
windowsPlugin
=
plugin
.
platforms
[
WindowsPlugin
.
kConfigKey
]!
as
WindowsPlugin
;
final
WindowsPlugin
windowsPlugin
=
plugin
.
platforms
[
WindowsPlugin
.
kConfigKey
]!
as
WindowsPlugin
;
final
String
androidPluginClass
=
androidPlugin
.
pluginClass
;
final
String
iosPluginClass
=
iosPlugin
.
pluginClass
;
expect
(
iosPluginClass
,
'ISamplePlugin'
);
expect
(
iosPlugin
.
pluginClass
,
'ISamplePlugin'
);
expect
(
androidPluginClass
,
'ASamplePlugin'
);
expect
(
iosPlugin
.
classPrefix
,
''
);
expect
(
iosPlugin
.
classPrefix
,
''
);
expect
(
androidPlugin
.
pluginClass
,
'ASamplePlugin'
);
expect
(
androidPlugin
.
package
,
'com.flutter.dev'
);
expect
(
androidPlugin
.
package
,
'com.flutter.dev'
);
expect
(
linuxPlugin
.
pluginClass
,
'LSamplePlugin'
);
expect
(
linuxPlugin
.
pluginClass
,
'LSamplePlugin'
);
expect
(
macOSPlugin
.
pluginClass
,
'MSamplePlugin'
);
expect
(
macOSPlugin
.
pluginClass
,
'MSamplePlugin'
);
...
@@ -138,9 +132,12 @@ void main() {
...
@@ -138,9 +132,12 @@ void main() {
testWithoutContext
(
'Plugin parsing allows for Dart-only plugins without a pluginClass'
,
()
{
testWithoutContext
(
'Plugin parsing allows for Dart-only plugins without a pluginClass'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
/// This is currently supported only on macOS, linux, Windows.
const
String
pluginYamlRaw
=
'implements: same_plugin
\n
'
// this should be ignored by the tool
const
String
pluginYamlRaw
=
'implements: same_plugin
\n
'
// this should be ignored by the tool
'platforms:
\n
'
'platforms:
\n
'
' android:
\n
'
' dartPluginClass: ASamplePlugin
\n
'
' ios:
\n
'
' dartPluginClass: ISamplePlugin
\n
'
' linux:
\n
'
' linux:
\n
'
' dartPluginClass: LSamplePlugin
\n
'
' dartPluginClass: LSamplePlugin
\n
'
' macos:
\n
'
' macos:
\n
'
...
@@ -157,13 +154,19 @@ void main() {
...
@@ -157,13 +154,19 @@ void main() {
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
);
);
final
AndroidPlugin
androidPlugin
=
plugin
.
platforms
[
AndroidPlugin
.
kConfigKey
]!
as
AndroidPlugin
;
final
IOSPlugin
iOSPlugin
=
plugin
.
platforms
[
IOSPlugin
.
kConfigKey
]!
as
IOSPlugin
;
final
LinuxPlugin
linuxPlugin
=
plugin
.
platforms
[
LinuxPlugin
.
kConfigKey
]!
as
LinuxPlugin
;
final
LinuxPlugin
linuxPlugin
=
plugin
.
platforms
[
LinuxPlugin
.
kConfigKey
]!
as
LinuxPlugin
;
final
MacOSPlugin
macOSPlugin
=
plugin
.
platforms
[
MacOSPlugin
.
kConfigKey
]!
as
MacOSPlugin
;
final
MacOSPlugin
macOSPlugin
=
plugin
.
platforms
[
MacOSPlugin
.
kConfigKey
]!
as
MacOSPlugin
;
final
WindowsPlugin
windowsPlugin
=
plugin
.
platforms
[
WindowsPlugin
.
kConfigKey
]!
as
WindowsPlugin
;
final
WindowsPlugin
windowsPlugin
=
plugin
.
platforms
[
WindowsPlugin
.
kConfigKey
]!
as
WindowsPlugin
;
expect
(
androidPlugin
.
pluginClass
,
isNull
);
expect
(
iOSPlugin
.
pluginClass
,
isNull
);
expect
(
linuxPlugin
.
pluginClass
,
isNull
);
expect
(
linuxPlugin
.
pluginClass
,
isNull
);
expect
(
macOSPlugin
.
pluginClass
,
isNull
);
expect
(
macOSPlugin
.
pluginClass
,
isNull
);
expect
(
windowsPlugin
.
pluginClass
,
isNull
);
expect
(
windowsPlugin
.
pluginClass
,
isNull
);
expect
(
androidPlugin
.
dartPluginClass
,
'ASamplePlugin'
);
expect
(
iOSPlugin
.
dartPluginClass
,
'ISamplePlugin'
);
expect
(
linuxPlugin
.
dartPluginClass
,
'LSamplePlugin'
);
expect
(
linuxPlugin
.
dartPluginClass
,
'LSamplePlugin'
);
expect
(
macOSPlugin
.
dartPluginClass
,
'MSamplePlugin'
);
expect
(
macOSPlugin
.
dartPluginClass
,
'MSamplePlugin'
);
expect
(
windowsPlugin
.
dartPluginClass
,
'WinSamplePlugin'
);
expect
(
windowsPlugin
.
dartPluginClass
,
'WinSamplePlugin'
);
...
@@ -219,6 +222,8 @@ void main() {
...
@@ -219,6 +222,8 @@ void main() {
expect
(
plugin
.
platforms
,
<
String
,
PluginPlatform
>{});
expect
(
plugin
.
platforms
,
<
String
,
PluginPlatform
>{});
expect
(
plugin
.
defaultPackagePlatforms
,
<
String
,
String
>{
expect
(
plugin
.
defaultPackagePlatforms
,
<
String
,
String
>{
'android'
:
'sample_package_android'
,
'ios'
:
'sample_package_ios'
,
'linux'
:
'sample_package_linux'
,
'linux'
:
'sample_package_linux'
,
'macos'
:
'sample_package_macos'
,
'macos'
:
'sample_package_macos'
,
'windows'
:
'sample_package_windows'
,
'windows'
:
'sample_package_windows'
,
...
...
packages/flutter_tools/test/general.shard/plugins_test.dart
View file @
23cea267
...
@@ -966,6 +966,53 @@ web_plugin_with_nested:${webPluginWithNestedFile.childDirectory('lib').uri.toStr
...
@@ -966,6 +966,53 @@ web_plugin_with_nested:${webPluginWithNestedFile.childDirectory('lib').uri.toStr
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'Injecting creates generated Android registrant, but does not include Dart-only plugins'
,
()
async
{
// Create a plugin without a pluginClass.
final
Directory
pluginDirectory
=
createFakePlugin
(
fs
);
pluginDirectory
.
childFile
(
'pubspec.yaml'
).
writeAsStringSync
(
'''
flutter:
plugin:
platforms:
android:
dartPluginClass: SomePlugin
'''
);
await
injectPlugins
(
flutterProject
,
androidPlatform:
true
);
final
File
registrantFile
=
androidProject
.
pluginRegistrantHost
.
childDirectory
(
fs
.
path
.
join
(
'src'
,
'main'
,
'java'
,
'io'
,
'flutter'
,
'plugins'
))
.
childFile
(
'GeneratedPluginRegistrant.java'
);
expect
(
registrantFile
,
exists
);
expect
(
registrantFile
,
isNot
(
contains
(
'SomePlugin'
)));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Injecting creates generated iOS registrant, but does not include Dart-only plugins'
,
()
async
{
flutterProject
.
isModule
=
true
;
// Create a plugin without a pluginClass.
final
Directory
pluginDirectory
=
createFakePlugin
(
fs
);
pluginDirectory
.
childFile
(
'pubspec.yaml'
).
writeAsStringSync
(
'''
flutter:
plugin:
platforms:
ios:
dartPluginClass: SomePlugin
'''
);
await
injectPlugins
(
flutterProject
,
iosPlatform:
true
);
final
File
registrantFile
=
iosProject
.
pluginRegistrantImplementation
;
expect
(
registrantFile
,
exists
);
expect
(
registrantFile
,
isNot
(
contains
(
'SomePlugin'
)));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Injecting creates generated macos registrant, but does not include Dart-only plugins'
,
()
async
{
testUsingContext
(
'Injecting creates generated macos registrant, but does not include Dart-only plugins'
,
()
async
{
flutterProject
.
isModule
=
true
;
flutterProject
.
isModule
=
true
;
// Create a plugin without a pluginClass.
// Create a plugin without a pluginClass.
...
@@ -1548,6 +1595,12 @@ class FakeIosProject extends Fake implements IosProject {
...
@@ -1548,6 +1595,12 @@ class FakeIosProject extends Fake implements IosProject {
@override
@override
Directory
pluginRegistrantHost
;
Directory
pluginRegistrantHost
;
@override
File
get
pluginRegistrantHeader
=>
pluginRegistrantHost
.
childFile
(
'GeneratedPluginRegistrant.h'
);
@override
File
get
pluginRegistrantImplementation
=>
pluginRegistrantHost
.
childFile
(
'GeneratedPluginRegistrant.m'
);
@override
@override
File
podfile
;
File
podfile
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment