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
fa65ddf5
Unverified
Commit
fa65ddf5
authored
Jul 16, 2019
by
Zachary Anderson
Committed by
GitHub
Jul 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] Allow analytics without a terminal attached (#36208)
parent
11660159
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
27 deletions
+16
-27
utils.dart
packages/flutter_tools/lib/src/base/utils.dart
+2
-4
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+2
-0
usage.dart
packages/flutter_tools/lib/src/usage.dart
+2
-1
utils_test.dart
...ges/flutter_tools/test/general.shard/base/utils_test.dart
+2
-2
flutter_command_test.dart
...tools/test/general.shard/runner/flutter_command_test.dart
+8
-20
No files found.
packages/flutter_tools/lib/src/base/utils.dart
View file @
fa65ddf5
...
...
@@ -33,9 +33,6 @@ class BotDetector {
return
platform
.
environment
[
'BOT'
]
==
'true'
// Non-interactive terminals are assumed to be bots.
||
!
io
.
stdout
.
hasTerminal
// https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
||
platform
.
environment
[
'TRAVIS'
]
==
'true'
||
platform
.
environment
[
'CONTINUOUS_INTEGRATION'
]
==
'true'
...
...
@@ -48,7 +45,8 @@ class BotDetector {
||
platform
.
environment
.
containsKey
(
'CIRRUS_CI'
)
// https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
||
(
platform
.
environment
.
containsKey
(
'AWS_REGION'
)
&&
platform
.
environment
.
containsKey
(
'CODEBUILD_INITIATOR'
))
||
(
platform
.
environment
.
containsKey
(
'AWS_REGION'
)
&&
platform
.
environment
.
containsKey
(
'CODEBUILD_INITIATOR'
))
// https://wiki.jenkins.io/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-belowJenkinsSetEnvironmentVariables
||
platform
.
environment
.
containsKey
(
'JENKINS_URL'
)
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
fa65ddf5
...
...
@@ -13,6 +13,7 @@ import '../application_package.dart';
import
'../base/common.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
as
io
;
import
'../base/terminal.dart'
;
import
'../base/time.dart'
;
import
'../base/user_messages.dart'
;
...
...
@@ -424,6 +425,7 @@ abstract class FlutterCommand extends Command<void> {
break
;
}
}
additionalUsageValues
[
kCommandHasTerminal
]
=
io
.
stdout
.
hasTerminal
?
'true'
:
'false'
;
flutterUsage
.
sendCommand
(
commandPath
,
parameters:
additionalUsageValues
);
// Send timing.
...
...
packages/flutter_tools/lib/src/usage.dart
View file @
fa65ddf5
...
...
@@ -49,12 +49,13 @@ const String kCommandBuildBundleTargetPlatform = 'cd24';
const
String
kCommandBuildBundleIsModule
=
'cd25'
;
const
String
kCommandResult
=
'cd26'
;
const
String
kCommandHasTerminal
=
'cd31'
;
const
String
reloadExceptionTargetPlatform
=
'cd27'
;
const
String
reloadExceptionSdkName
=
'cd28'
;
const
String
reloadExceptionEmulator
=
'cd29'
;
const
String
reloadExceptionFullRestart
=
'cd30'
;
// Next ID: cd3
1
// Next ID: cd3
2
Usage
get
flutterUsage
=>
Usage
.
instance
;
...
...
packages/flutter_tools/test/general.shard/base/utils_test.dart
View file @
fa65ddf5
...
...
@@ -42,11 +42,11 @@ void main() {
Platform:
()
=>
fakePlatform
,
});
testUsingContext
(
'returns
true for non-interactive terminals
'
,
()
async
{
testUsingContext
(
'returns
false with and without a terminal attached
'
,
()
async
{
mockStdio
.
stdout
.
hasTerminal
=
true
;
expect
(
botDetector
.
isRunningOnBot
,
isFalse
);
mockStdio
.
stdout
.
hasTerminal
=
false
;
expect
(
botDetector
.
isRunningOnBot
,
is
Tru
e
);
expect
(
botDetector
.
isRunningOnBot
,
is
Fals
e
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Platform:
()
=>
fakePlatform
,
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart
View file @
fa65ddf5
...
...
@@ -62,11 +62,8 @@ void main() {
expect
(
verify
(
usage
.
sendCommand
(
captureAny
,
parameters:
captureAnyNamed
(
'parameters'
))).
captured
,
<
dynamic
>[
'dummy'
,
const
<
String
,
String
>{
'cd26'
:
'success'
}
],
parameters:
captureAnyNamed
(
'parameters'
))).
captured
[
1
][
'cd26'
],
equals
(
'success'
),
);
},
overrides:
<
Type
,
Generator
>{
...
...
@@ -87,11 +84,8 @@ void main() {
expect
(
verify
(
usage
.
sendCommand
(
captureAny
,
parameters:
captureAnyNamed
(
'parameters'
))).
captured
,
<
dynamic
>[
'dummy'
,
const
<
String
,
String
>{
'cd26'
:
'warning'
}
],
parameters:
captureAnyNamed
(
'parameters'
))).
captured
[
1
][
'cd26'
],
equals
(
'warning'
),
);
},
overrides:
<
Type
,
Generator
>{
...
...
@@ -114,11 +108,8 @@ void main() {
}
on
ToolExit
{
expect
(
verify
(
usage
.
sendCommand
(
captureAny
,
parameters:
captureAnyNamed
(
'parameters'
))).
captured
,
<
dynamic
>[
'dummy'
,
const
<
String
,
String
>{
'cd26'
:
'fail'
}
],
parameters:
captureAnyNamed
(
'parameters'
))).
captured
[
1
][
'cd26'
],
equals
(
'fail'
),
);
}
},
...
...
@@ -144,11 +135,8 @@ void main() {
}
on
ToolExit
{
expect
(
verify
(
usage
.
sendCommand
(
captureAny
,
parameters:
captureAnyNamed
(
'parameters'
))).
captured
,
<
dynamic
>[
'dummy'
,
const
<
String
,
String
>{
'cd26'
:
'fail'
}
],
parameters:
captureAnyNamed
(
'parameters'
))).
captured
[
1
][
'cd26'
],
equals
(
'fail'
),
);
}
},
...
...
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