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
8a3c9863
Unverified
Commit
8a3c9863
authored
Jan 22, 2020
by
Jenn Magder
Committed by
GitHub
Jan 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disallow empty platforms and specific platforms when parsing manifest for plugins (#49262)
parent
320c19e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+8
-1
plugin_parsing_test.dart
...flutter_tools/test/general.shard/plugin_parsing_test.dart
+22
-0
No files found.
packages/flutter_tools/lib/src/plugins.dart
View file @
8a3c9863
...
...
@@ -202,9 +202,12 @@ class Plugin {
static
List
<
String
>
_validateMultiPlatformYaml
(
YamlMap
yaml
)
{
bool
isInvalid
(
String
key
,
bool
Function
(
YamlMap
)
validate
)
{
if
(!
yaml
.
containsKey
(
key
))
{
return
false
;
}
final
dynamic
value
=
yaml
[
key
];
if
(
value
is
!
YamlMap
)
{
return
fals
e
;
return
tru
e
;
}
final
YamlMap
yamlValue
=
value
as
YamlMap
;
if
(
yamlValue
.
containsKey
(
'default_package'
))
{
...
...
@@ -212,6 +215,10 @@ class Plugin {
}
return
!
validate
(
yamlValue
);
}
if
(
yaml
==
null
)
{
return
<
String
>[
'Invalid "platforms" specification.'
];
}
final
List
<
String
>
errors
=
<
String
>[];
if
(
isInvalid
(
AndroidPlugin
.
kConfigKey
,
AndroidPlugin
.
validate
))
{
errors
.
add
(
'Invalid "android" plugin specification.'
);
...
...
packages/flutter_tools/test/general.shard/plugin_parsing_test.dart
View file @
8a3c9863
...
...
@@ -157,5 +157,27 @@ void main() {
expect
(
plugin
.
platforms
,
<
String
,
PluginPlatform
>
{});
});
test
(
'error on empty platforms'
,
()
{
const
String
pluginYamlRaw
=
'platforms:
\n
'
;
final
YamlMap
pluginYaml
=
loadYaml
(
pluginYamlRaw
)
as
YamlMap
;
expect
(
()
=>
Plugin
.
fromYaml
(
_kTestPluginName
,
_kTestPluginPath
,
pluginYaml
,
const
<
String
>[]),
throwsToolExit
(
message:
'Invalid "platforms" specification.'
),
);
});
test
(
'error on empty platform'
,
()
{
const
String
pluginYamlRaw
=
'platforms:
\n
'
' android:
\n
'
;
final
YamlMap
pluginYaml
=
loadYaml
(
pluginYamlRaw
)
as
YamlMap
;
expect
(
()
=>
Plugin
.
fromYaml
(
_kTestPluginName
,
_kTestPluginPath
,
pluginYaml
,
const
<
String
>[]),
throwsToolExit
(
message:
'Invalid "android" plugin specification.'
),
);
});
});
}
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