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
acdaffc4
Unverified
Commit
acdaffc4
authored
Jan 24, 2020
by
Jenn Magder
Committed by
GitHub
Jan 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppress upgrade message with --machine (#49408)
parent
1cc38683
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+4
-3
flutter_command_runner_test.dart
...est/general.shard/runner/flutter_command_runner_test.dart
+16
-0
No files found.
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
acdaffc4
...
...
@@ -309,7 +309,8 @@ class FlutterCommandRunner extends CommandRunner<void> {
globals
.
printError
(
'Please ensure you have permissions in the artifact cache directory.'
);
throwToolExit
(
'Failed to write the version file'
);
}
if
(
topLevelResults
.
command
?.
name
!=
'upgrade'
&&
topLevelResults
[
'version-check'
]
as
bool
)
{
final
bool
machineFlag
=
topLevelResults
[
'machine'
]
as
bool
;
if
(
topLevelResults
.
command
?.
name
!=
'upgrade'
&&
topLevelResults
[
'version-check'
]
as
bool
&&
!
machineFlag
)
{
await
FlutterVersion
.
instance
.
checkFlutterVersionFreshness
();
}
...
...
@@ -323,7 +324,7 @@ class FlutterCommandRunner extends CommandRunner<void> {
if
(
topLevelResults
[
'version'
]
as
bool
)
{
flutterUsage
.
sendCommand
(
'version'
);
String
status
;
if
(
topLevelResults
[
'machine'
]
as
bool
)
{
if
(
machineFlag
)
{
status
=
const
JsonEncoder
.
withIndent
(
' '
).
convert
(
FlutterVersion
.
instance
.
toJson
());
}
else
{
status
=
FlutterVersion
.
instance
.
toString
();
...
...
@@ -332,7 +333,7 @@ class FlutterCommandRunner extends CommandRunner<void> {
return
;
}
if
(
topLevelResults
[
'machine'
]
as
bool
)
{
if
(
machineFlag
)
{
throwToolExit
(
'The --machine flag is only valid with the --version flag.'
,
exitCode:
2
);
}
await
super
.
runCommand
(
topLevelResults
);
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_runner_test.dart
View file @
acdaffc4
...
...
@@ -72,6 +72,22 @@ void main() {
Platform:
()
=>
platform
,
},
initializeFlutterRoot:
false
);
testUsingContext
(
'does not check that Flutter installation is up-to-date with --machine flag'
,
()
async
{
final
MockFlutterVersion
version
=
FlutterVersion
.
instance
as
MockFlutterVersion
;
bool
versionChecked
=
false
;
when
(
version
.
checkFlutterVersionFreshness
()).
thenAnswer
((
_
)
async
{
versionChecked
=
true
;
});
await
runner
.
run
(<
String
>[
'dummy'
,
'--machine'
,
'--version'
]);
expect
(
versionChecked
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
platform
,
},
initializeFlutterRoot:
false
);
testUsingContext
(
'throw tool exit if the version file cannot be written'
,
()
async
{
final
MockFlutterVersion
version
=
FlutterVersion
.
instance
as
MockFlutterVersion
;
when
(
version
.
ensureVersionFile
()).
thenThrow
(
const
FileSystemException
());
...
...
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