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
16df32b1
Unverified
Commit
16df32b1
authored
Aug 12, 2020
by
Jonah Williams
Committed by
GitHub
Aug 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] handle invalid yaml in plugin dependency (#63526)
parent
8dcb4c33
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
plugins_test.dart
packages/flutter_tools/test/general.shard/plugins_test.dart
+22
-0
No files found.
packages/flutter_tools/lib/src/plugins.dart
View file @
16df32b1
...
...
@@ -311,7 +311,14 @@ Plugin _pluginFromPackage(String name, Uri packageRoot) {
if
(!
globals
.
fs
.
isFileSync
(
pubspecPath
))
{
return
null
;
}
final
dynamic
pubspec
=
loadYaml
(
globals
.
fs
.
file
(
pubspecPath
).
readAsStringSync
());
dynamic
pubspec
;
try
{
pubspec
=
loadYaml
(
globals
.
fs
.
file
(
pubspecPath
).
readAsStringSync
());
}
on
YamlException
catch
(
err
)
{
globals
.
printTrace
(
'Failed to parse plugin manifest for
$name
:
$err
'
);
// Do nothing, potentially not a plugin.
}
if
(
pubspec
==
null
)
{
return
null
;
}
...
...
packages/flutter_tools/test/general.shard/plugins_test.dart
View file @
16df32b1
...
...
@@ -908,6 +908,28 @@ flutter:
FeatureFlags:
()
=>
featureFlags
,
});
testUsingContext
(
'Invalid yaml does not crash plugin lookup.'
,
()
async
{
when
(
macosProject
.
existsSync
()).
thenReturn
(
true
);
when
(
featureFlags
.
isMacOSEnabled
).
thenReturn
(
true
);
when
(
flutterProject
.
isModule
).
thenReturn
(
true
);
// Create a plugin without a pluginClass.
dummyPackageDirectory
.
parent
.
childFile
(
'pubspec.yaml'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r''
'
"aws ...
\"
Branch
\"
:
$BITBUCKET_BRANCH
,
\"
Date
\"
:
$
(date +"%m-%d-%y"),
\"
Time
\"
:
$
(date +"%T")}
\"
'''
);
await
injectPlugins
(
flutterProject
,
checkProjects:
true
);
final
File
registrantFile
=
macosProject
.
managedDirectory
.
childFile
(
'GeneratedPluginRegistrant.swift'
);
expect
(
registrantFile
,
exists
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
featureFlags
,
});
testUsingContext
(
'Injecting creates generated Linux registrant'
,
()
async
{
when
(
linuxProject
.
existsSync
()).
thenReturn
(
true
);
when
(
featureFlags
.
isLinuxEnabled
).
thenReturn
(
true
);
...
...
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