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
f707f6f6
Unverified
Commit
f707f6f6
authored
Jul 29, 2020
by
Jonah Williams
Committed by
GitHub
Jul 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] add flutterRoot field to JSON machine output (#62053)
parent
d053a4d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+5
-1
command_output_test.dart
...ter_tools/test/integration.shard/command_output_test.dart
+19
-0
No files found.
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
f707f6f6
...
@@ -317,7 +317,11 @@ class FlutterCommandRunner extends CommandRunner<void> {
...
@@ -317,7 +317,11 @@ class FlutterCommandRunner extends CommandRunner<void> {
globals
.
flutterVersion
.
fetchTagsAndUpdate
();
globals
.
flutterVersion
.
fetchTagsAndUpdate
();
String
status
;
String
status
;
if
(
machineFlag
)
{
if
(
machineFlag
)
{
status
=
const
JsonEncoder
.
withIndent
(
' '
).
convert
(
globals
.
flutterVersion
.
toJson
());
final
Map
<
String
,
Object
>
jsonOut
=
globals
.
flutterVersion
.
toJson
();
if
(
jsonOut
!=
null
)
{
jsonOut
[
'flutterRoot'
]
=
Cache
.
flutterRoot
;
}
status
=
const
JsonEncoder
.
withIndent
(
' '
).
convert
(
jsonOut
);
}
else
{
}
else
{
status
=
globals
.
flutterVersion
.
toString
();
status
=
globals
.
flutterVersion
.
toString
();
}
}
...
...
packages/flutter_tools/test/integration.shard/command_output_test.dart
View file @
f707f6f6
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:convert'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/features.dart'
;
...
@@ -128,4 +130,21 @@ void main() {
...
@@ -128,4 +130,21 @@ void main() {
// Only printed by verbose tool.
// Only printed by verbose tool.
expect
(
result
.
stdout
,
isNot
(
contains
(
'exiting with code 0'
)));
expect
(
result
.
stdout
,
isNot
(
contains
(
'exiting with code 0'
)));
});
});
test
(
'flutter --version --machine outputs JSON with flutterRoot'
,
()
async
{
final
String
flutterBin
=
globals
.
fs
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
'flutter'
);
final
ProcessResult
result
=
await
const
LocalProcessManager
().
run
(<
String
>[
flutterBin
,
'--version'
,
'--machine'
,
]);
final
Map
<
String
,
Object
>
versionInfo
=
json
.
decode
(
result
.
stdout
.
toString
()
.
replaceAll
(
'Building flutter tool...'
,
''
)
.
replaceAll
(
'Waiting for another flutter command to release the startup lock...'
,
''
)
.
trim
())
as
Map
<
String
,
Object
>;
expect
(
versionInfo
,
containsPair
(
'flutterRoot'
,
isNotNull
));
});
}
}
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