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
096a8ac4
Commit
096a8ac4
authored
Oct 24, 2019
by
Jonah Williams
Committed by
Zachary Anderson
Oct 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle format error from vswhere (#43402)
parent
2b272f81
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
visual_studio.dart
packages/flutter_tools/lib/src/windows/visual_studio.dart
+2
-0
visual_studio_test.dart
..._tools/test/general.shard/windows/visual_studio_test.dart
+21
-2
No files found.
packages/flutter_tools/lib/src/windows/visual_studio.dart
View file @
096a8ac4
...
...
@@ -208,6 +208,8 @@ class VisualStudio {
// Thrown if vswhere doesnt' exist; ignore and return null below.
}
on
ProcessException
{
// Ignored, return null below.
}
on
FormatException
{
// may be thrown if invalid JSON is returned.
}
return
null
;
}
...
...
packages/flutter_tools/test/general.shard/windows/visual_studio_test.dart
View file @
096a8ac4
...
...
@@ -71,6 +71,7 @@ void main() {
List
<
String
>
requiredComponents
,
List
<
String
>
additionalArguments
,
Map
<
String
,
dynamic
>
response
,
String
responseOverride
,
])
{
fs
.
file
(
vswherePath
).
createSync
(
recursive:
true
);
fs
.
file
(
vcvarsPath
).
createSync
(
recursive:
true
);
...
...
@@ -78,7 +79,7 @@ void main() {
final
MockProcessResult
result
=
MockProcessResult
();
when
(
result
.
exitCode
).
thenReturn
(
0
);
final
String
finalResponse
=
final
String
finalResponse
=
responseOverride
??
json
.
encode
(<
Map
<
String
,
dynamic
>>[
response
]);
when
<
String
>(
result
.
stdout
).
thenReturn
(
finalResponse
);
when
<
String
>(
result
.
stderr
).
thenReturn
(
''
);
...
...
@@ -116,10 +117,15 @@ void main() {
// Sets whether or not a vswhere query searching for 'all' and 'prerelease'
// versions will return an installation.
void
setMockAnyVisualStudioInstallation
(
Map
<
String
,
dynamic
>
response
)
{
void
setMockAnyVisualStudioInstallation
(
Map
<
String
,
dynamic
>
response
)
{
setMockVswhereResponse
(
null
,
<
String
>[
'-prerelease'
,
'-all'
],
response
);
}
// Set a pre-encoded query result.
void
setMockEncodedAnyVisualStudioInstallation
(
String
response
)
{
setMockVswhereResponse
(
null
,
<
String
>[
'-prerelease'
,
'-all'
],
null
,
response
);
}
group
(
'Visual Studio'
,
()
{
VisualStudio
visualStudio
;
...
...
@@ -393,6 +399,19 @@ void main() {
Platform:
()
=>
windowsPlatform
,
});
testUsingContext
(
'vcvarsPath returns null when VS is present but when vswhere returns invalid JSON'
,
()
{
setMockCompatibleVisualStudioInstallation
(
null
);
setMockPrereleaseVisualStudioInstallation
(
null
);
setMockEncodedAnyVisualStudioInstallation
(
'{'
);
visualStudio
=
VisualStudio
();
expect
(
visualStudio
.
vcvarsPath
,
isNull
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFilesystem
,
ProcessManager:
()
=>
mockProcessManager
,
Platform:
()
=>
windowsPlatform
,
});
testUsingContext
(
'Everything returns good values when VS is present with all components'
,
()
{
setMockCompatibleVisualStudioInstallation
(
_defaultResponse
);
setMockPrereleaseVisualStudioInstallation
(
null
);
...
...
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