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
0f03af01
Unverified
Commit
0f03af01
authored
Apr 09, 2021
by
Jenn Magder
Committed by
GitHub
Apr 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate visual_studio_test (#80088)
parent
4a730509
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
41 deletions
+35
-41
visual_studio.dart
packages/flutter_tools/lib/src/windows/visual_studio.dart
+6
-6
visual_studio_validator.dart
...lutter_tools/lib/src/windows/visual_studio_validator.dart
+3
-3
os_test.dart
packages/flutter_tools/test/general.shard/base/os_test.dart
+3
-5
linux_doctor_test.dart
...ter_tools/test/general.shard/linux/linux_doctor_test.dart
+0
-2
visual_studio_test.dart
..._tools/test/general.shard/windows/visual_studio_test.dart
+23
-25
No files found.
packages/flutter_tools/lib/src/windows/visual_studio.dart
View file @
0f03af01
...
...
@@ -47,7 +47,7 @@ class VisualStudio {
/// The name of the Visual Studio install.
///
/// For instance: "Visual Studio Community 2019".
String
get
displayName
=>
_bestVisualStudioDetails
[
_displayNameKey
]
as
String
;
String
?
get
displayName
=>
_bestVisualStudioDetails
[
_displayNameKey
]
as
String
?
;
/// The user-friendly version number of the Visual Studio install.
///
...
...
@@ -56,16 +56,16 @@ class VisualStudio {
if
(
_bestVisualStudioDetails
[
_catalogKey
]
==
null
)
{
return
null
;
}
return
_bestVisualStudioDetails
[
_catalogKey
][
_catalogDisplayVersionKey
]
as
String
;
return
_bestVisualStudioDetails
[
_catalogKey
][
_catalogDisplayVersionKey
]
as
String
?
;
}
/// The directory where Visual Studio is installed.
String
get
installLocation
=>
_bestVisualStudioDetails
[
_installationPathKey
]
as
String
;
String
?
get
installLocation
=>
_bestVisualStudioDetails
[
_installationPathKey
]
as
String
?
;
/// The full version of the Visual Studio install.
///
/// For instance: "15.4.27004.2002".
String
get
fullVersion
=>
_bestVisualStudioDetails
[
_fullVersionKey
]
as
String
;
String
?
get
fullVersion
=>
_bestVisualStudioDetails
[
_fullVersionKey
]
as
String
?
;
// Properties that determine the status of the installation. There might be
// Visual Studio versions that don't include them, so default to a "valid" value to
...
...
@@ -151,7 +151,7 @@ class VisualStudio {
/// the components necessary to build.
String
?
get
cmakePath
{
final
Map
<
String
,
dynamic
>
details
=
_usableVisualStudioDetails
;
if
(
details
.
isEmpty
)
{
if
(
details
.
isEmpty
||
_usableVisualStudioDetails
[
_installationPathKey
]
==
null
)
{
return
null
;
}
return
_fileSystem
.
path
.
joinAll
(<
String
>[
...
...
@@ -168,7 +168,7 @@ class VisualStudio {
}
/// The major version of the Visual Studio install, as an integer.
int
?
get
_majorVersion
=>
fullVersion
!=
null
?
int
.
tryParse
(
fullVersion
.
split
(
'.'
)[
0
])
:
null
;
int
?
get
_majorVersion
=>
fullVersion
!=
null
?
int
.
tryParse
(
fullVersion
!
.
split
(
'.'
)[
0
])
:
null
;
/// The path to vswhere.exe.
///
...
...
packages/flutter_tools/lib/src/windows/visual_studio_validator.dart
View file @
0f03af01
...
...
@@ -30,12 +30,12 @@ class VisualStudioValidator extends DoctorValidator {
status
=
ValidationType
.
installed
;
messages
.
add
(
ValidationMessage
(
_userMessages
.
visualStudioLocation
(
_visualStudio
.
installLocation
)
_userMessages
.
visualStudioLocation
(
_visualStudio
.
installLocation
??
'unknown'
)
));
messages
.
add
(
ValidationMessage
(
_userMessages
.
visualStudioVersion
(
_visualStudio
.
displayName
,
_visualStudio
.
fullVersion
,
_visualStudio
.
displayName
??
'unknown'
,
_visualStudio
.
fullVersion
??
'unknown'
,
)));
if
(
_visualStudio
.
isPrerelease
)
{
...
...
packages/flutter_tools/test/general.shard/base/os_test.dart
View file @
0f03af01
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
...
...
@@ -20,7 +18,7 @@ const String kPath1 = '/bar/bin/$kExecutable';
const
String
kPath2
=
'/another/bin/
$kExecutable
'
;
void
main
(
)
{
FakeProcessManager
fakeProcessManager
;
late
FakeProcessManager
fakeProcessManager
;
setUp
(()
{
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
...
...
@@ -61,7 +59,7 @@ void main() {
),
);
final
OperatingSystemUtils
utils
=
createOSUtils
(
FakePlatform
(
operatingSystem:
'linux'
));
expect
(
utils
.
which
(
kExecutable
).
path
,
kPath1
);
expect
(
utils
.
which
(
kExecutable
)
!
.
path
,
kPath1
);
});
testWithoutContext
(
'returns all results for whichAll'
,
()
async
{
...
...
@@ -131,7 +129,7 @@ void main() {
),
);
final
OperatingSystemUtils
utils
=
createOSUtils
(
FakePlatform
(
operatingSystem:
'windows'
));
expect
(
utils
.
which
(
kExecutable
).
path
,
kPath1
);
expect
(
utils
.
which
(
kExecutable
)
!
.
path
,
kPath1
);
});
testWithoutContext
(
'returns all results for whichAll'
,
()
async
{
...
...
packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart
View file @
0f03af01
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter_tools/src/base/user_messages.dart'
;
import
'package:flutter_tools/src/doctor_validator.dart'
;
import
'package:flutter_tools/src/linux/linux_doctor.dart'
;
...
...
packages/flutter_tools/test/general.shard/windows/visual_studio_test.dart
View file @
0f03af01
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
show
ProcessException
;
...
...
@@ -102,17 +100,17 @@ const List<String> _requirementsBuildTools = <String>[
void
setMockVswhereResponse
(
FileSystem
fileSystem
,
FakeProcessManager
processManager
,
[
List
<
String
>
requiredComponents
,
List
<
String
>
additionalArguments
,
Map
<
String
,
dynamic
>
response
,
String
responseOverride
,
int
exitCode
,
Exception
exception
,
List
<
String
>
?
requiredComponents
,
List
<
String
>
?
additionalArguments
,
Map
<
String
,
dynamic
>
?
response
,
String
?
responseOverride
,
int
?
exitCode
,
Exception
?
exception
,
])
{
fileSystem
.
file
(
vswherePath
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
cmakePath
).
createSync
(
recursive:
true
);
final
String
finalResponse
=
responseOverride
??
json
.
encode
(<
Map
<
String
,
dynamic
>>[
response
]
);
??
(
response
!=
null
?
json
.
encode
(<
Map
<
String
,
dynamic
>>[
response
])
:
''
);
final
List
<
String
>
requirementArguments
=
requiredComponents
==
null
?
<
String
>[]
:
<
String
>[
'-requires'
,
...
requiredComponents
];
...
...
@@ -127,7 +125,7 @@ void setMockVswhereResponse(
'-utf8'
,
'-latest'
,
...?
additionalArguments
,
...
?
requirementArguments
,
...
requirementArguments
,
],
stdout:
finalResponse
,
exception:
exception
,
...
...
@@ -138,11 +136,11 @@ void setMockVswhereResponse(
// Sets whether or not a vswhere query with the required components will
// return an installation.
void
setMockCompatibleVisualStudioInstallation
(
Map
<
String
,
dynamic
>
response
,
Map
<
String
,
dynamic
>
?
response
,
FileSystem
fileSystem
,
FakeProcessManager
processManager
,
[
int
exitCode
,
Exception
exception
,
int
?
exitCode
,
Exception
?
exception
,
])
{
setMockVswhereResponse
(
fileSystem
,
...
...
@@ -159,11 +157,11 @@ void setMockCompatibleVisualStudioInstallation(
// Sets whether or not a vswhere query with the required components will
// return a pre-release installation.
void
setMockPrereleaseVisualStudioInstallation
(
Map
<
String
,
dynamic
>
response
,
Map
<
String
,
dynamic
>
?
response
,
FileSystem
fileSystem
,
FakeProcessManager
processManager
,
[
int
exitCode
,
Exception
exception
,
int
?
exitCode
,
Exception
?
exception
,
])
{
setMockVswhereResponse
(
fileSystem
,
...
...
@@ -180,11 +178,11 @@ void setMockPrereleaseVisualStudioInstallation(
// Sets whether or not a vswhere query with the required components will
// return an Build Tools installation.
void
setMockCompatibleVisualStudioBuildToolsInstallation
(
Map
<
String
,
dynamic
>
response
,
Map
<
String
,
dynamic
>
?
response
,
FileSystem
fileSystem
,
FakeProcessManager
processManager
,
[
int
exitCode
,
Exception
exception
,
int
?
exitCode
,
Exception
?
exception
,
])
{
setMockVswhereResponse
(
fileSystem
,
...
...
@@ -201,11 +199,11 @@ void setMockCompatibleVisualStudioBuildToolsInstallation(
// Sets whether or not a vswhere query with the required components will
// return a pre-release Build Tools installation.
void
setMockPrereleaseVisualStudioBuildToolsInstallation
(
Map
<
String
,
dynamic
>
response
,
Map
<
String
,
dynamic
>
?
response
,
FileSystem
fileSystem
,
FakeProcessManager
processManager
,
[
int
exitCode
,
Exception
exception
,
int
?
exitCode
,
Exception
?
exception
,
])
{
setMockVswhereResponse
(
fileSystem
,
...
...
@@ -222,11 +220,11 @@ void setMockPrereleaseVisualStudioBuildToolsInstallation(
// Sets whether or not a vswhere query searching for 'all' and 'prerelease'
// versions will return an installation.
void
setMockAnyVisualStudioInstallation
(
Map
<
String
,
dynamic
>
response
,
Map
<
String
,
dynamic
>
?
response
,
FileSystem
fileSystem
,
FakeProcessManager
processManager
,
[
int
exitCode
,
Exception
exception
,
int
?
exitCode
,
Exception
?
exception
,
])
{
setMockVswhereResponse
(
fileSystem
,
...
...
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