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
9da74f66
Unverified
Commit
9da74f66
authored
Jul 23, 2020
by
huangchaoyang
Committed by
GitHub
Jul 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show correct errors when plugins yaml forgot the 'flutter.plugins.pla… (#61338)
parent
d41b1fbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+9
-0
flutter_manifest_test.dart
...utter_tools/test/general.shard/flutter_manifest_test.dart
+22
-0
No files found.
packages/flutter_tools/lib/src/plugins.dart
View file @
9da74f66
...
...
@@ -213,6 +213,14 @@ class Plugin {
return
<
String
>[
errorMessage
];
}
if
(!
usesOldPluginFormat
&&
!
usesNewPluginFormat
)
{
const
String
errorMessage
=
'Cannot find the `flutter.plugin.platforms` key in the `pubspec.yaml` file. '
'An instruction to format the `pubspec.yaml` can be found here: '
'https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms'
;
return
<
String
>[
errorMessage
];
}
if
(
usesNewPluginFormat
)
{
if
(
yaml
[
'platforms'
]
!=
null
&&
yaml
[
'platforms'
]
is
!
YamlMap
)
{
const
String
errorMessage
=
'flutter.plugin.platforms should be a map with the platform name as the key'
;
...
...
@@ -264,6 +272,7 @@ class Plugin {
static
List
<
String
>
_validateLegacyYaml
(
YamlMap
yaml
)
{
final
List
<
String
>
errors
=
<
String
>[];
if
(
yaml
[
'androidPackage'
]
!=
null
&&
yaml
[
'androidPackage'
]
is
!
String
)
{
errors
.
add
(
'The "androidPackage" must either be null or a string.'
);
}
...
...
packages/flutter_tools/test/general.shard/flutter_manifest_test.dart
View file @
9da74f66
...
...
@@ -1017,6 +1017,28 @@ flutter:
expect
(
logger
.
errorText
,
contains
(
'flutter.plugin.platforms should be a map with the platform name as the key'
));
});
testWithoutContext
(
'FlutterManifest validates plugin format not support.'
,
()
{
const
String
manifest
=
'''
name: test
flutter:
plugin:
android:
package: com.example
pluginClass: SomeClass
ios:
pluginClass: SomeClass
'''
;
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
,
logger:
logger
,
);
expect
(
flutterManifest
,
null
);
expect
(
logger
.
errorText
,
contains
(
'Cannot find the `flutter.plugin.platforms` key in the `pubspec.yaml` file. '
));
});
}
Matcher
matchesManifest
(
{
...
...
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