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
3f4cb1fe
Commit
3f4cb1fe
authored
Mar 22, 2017
by
Michael Goderbauer
Committed by
GitHub
Mar 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Report detailed OS version string to analytics (#8934)
parent
1bae8a03
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
26 deletions
+57
-26
os.dart
packages/flutter_tools/lib/src/base/os.dart
+50
-0
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+2
-26
usage.dart
packages/flutter_tools/lib/src/usage.dart
+5
-0
No files found.
packages/flutter_tools/lib/src/base/os.dart
View file @
3f4cb1fe
...
@@ -47,6 +47,19 @@ abstract class OperatingSystemUtils {
...
@@ -47,6 +47,19 @@ abstract class OperatingSystemUtils {
void
unzip
(
File
file
,
Directory
targetDirectory
);
void
unzip
(
File
file
,
Directory
targetDirectory
);
/// Returns a pretty name string for the current operating system.
///
/// If available, the detailed version of the OS is included.
String
get
name
{
const
Map
<
String
,
String
>
osNames
=
const
<
String
,
String
>{
'macos'
:
'Mac OS'
,
'linux'
:
'Linux'
,
'windows'
:
'Windows'
};
final
String
osName
=
platform
.
operatingSystem
;
return
osNames
.
containsKey
(
osName
)
?
osNames
[
osName
]
:
osName
;
}
List
<
File
>
_which
(
String
execName
,
{
bool
all:
false
});
List
<
File
>
_which
(
String
execName
,
{
bool
all:
false
});
}
}
...
@@ -86,6 +99,28 @@ class _PosixUtils extends OperatingSystemUtils {
...
@@ -86,6 +99,28 @@ class _PosixUtils extends OperatingSystemUtils {
runSync
(<
String
>[
'mkfifo'
,
path
]);
runSync
(<
String
>[
'mkfifo'
,
path
]);
return
fs
.
file
(
path
);
return
fs
.
file
(
path
);
}
}
String
_name
;
@override
String
get
name
{
if
(
_name
==
null
)
{
if
(
platform
.
isMacOS
)
{
final
List
<
ProcessResult
>
results
=
<
ProcessResult
>[
processManager
.
runSync
(<
String
>[
"sw_vers"
,
"-productName"
]),
processManager
.
runSync
(<
String
>[
"sw_vers"
,
"-productVersion"
]),
processManager
.
runSync
(<
String
>[
"sw_vers"
,
"-buildVersion"
]),
];
if
(
results
.
every
((
ProcessResult
result
)
=>
result
.
exitCode
==
0
))
{
_name
=
"
${results[0].stdout.trim()}
${results[1].stdout
.trim()}
${results[2].stdout.trim()}
"
;
}
}
if
(
_name
==
null
)
_name
=
super
.
name
;
}
return
_name
;
}
}
}
class
_WindowsUtils
extends
OperatingSystemUtils
{
class
_WindowsUtils
extends
OperatingSystemUtils
{
...
@@ -144,6 +179,21 @@ class _WindowsUtils extends OperatingSystemUtils {
...
@@ -144,6 +179,21 @@ class _WindowsUtils extends OperatingSystemUtils {
File
makePipe
(
String
path
)
{
File
makePipe
(
String
path
)
{
throw
new
UnsupportedError
(
'makePipe is not implemented on Windows.'
);
throw
new
UnsupportedError
(
'makePipe is not implemented on Windows.'
);
}
}
String
_name
;
@override
String
get
name
{
if
(
_name
==
null
)
{
final
ProcessResult
result
=
processManager
.
runSync
(
<
String
>[
'ver'
],
runInShell:
true
);
if
(
result
.
exitCode
==
0
)
_name
=
result
.
stdout
.
trim
();
else
_name
=
super
.
name
;
}
return
_name
;
}
}
}
/// Find and return the project root directory relative to the specified
/// Find and return the project root directory relative to the specified
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
3f4cb1fe
...
@@ -13,7 +13,7 @@ import 'artifacts.dart';
...
@@ -13,7 +13,7 @@ import 'artifacts.dart';
import
'base/common.dart'
;
import
'base/common.dart'
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
import
'base/
io
.dart'
;
import
'base/
os
.dart'
;
import
'base/platform.dart'
;
import
'base/platform.dart'
;
import
'base/process_manager.dart'
;
import
'base/process_manager.dart'
;
import
'cache.dart'
;
import
'cache.dart'
;
...
@@ -25,30 +25,6 @@ import 'version.dart';
...
@@ -25,30 +25,6 @@ import 'version.dart';
Doctor
get
doctor
=>
context
[
Doctor
];
Doctor
get
doctor
=>
context
[
Doctor
];
const
Map
<
String
,
String
>
_osNames
=
const
<
String
,
String
>{
'macos'
:
'Mac OS'
,
'linux'
:
'Linux'
,
'windows'
:
'Windows'
};
String
osName
(
)
{
if
(
platform
.
isWindows
)
{
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
'ver'
],
runInShell:
true
);
if
(
result
.
exitCode
==
0
)
return
result
.
stdout
.
trim
();
}
else
if
(
platform
.
isMacOS
)
{
final
List
<
ProcessResult
>
results
=
<
ProcessResult
>[
processManager
.
runSync
(<
String
>[
"sw_vers"
,
"-productName"
]),
processManager
.
runSync
(<
String
>[
"sw_vers"
,
"-productVersion"
]),
processManager
.
runSync
(<
String
>[
"sw_vers"
,
"-buildVersion"
]),
];
if
(
results
.
every
((
ProcessResult
result
)
=>
result
.
exitCode
==
0
))
return
"
${results[0].stdout.trim()}
${results[1].stdout.trim()}
${results[2].stdout.trim()}
"
;
}
final
String
os
=
platform
.
operatingSystem
;
return
_osNames
.
containsKey
(
os
)
?
_osNames
[
os
]
:
os
;
}
class
Doctor
{
class
Doctor
{
Doctor
()
{
Doctor
()
{
_androidWorkflow
=
new
AndroidWorkflow
();
_androidWorkflow
=
new
AndroidWorkflow
();
...
@@ -242,7 +218,7 @@ class _FlutterValidator extends DoctorValidator {
...
@@ -242,7 +218,7 @@ class _FlutterValidator extends DoctorValidator {
messages
.
add
(
new
ValidationMessage
(
'Tools Dart version
${version.dartSdkVersion}
'
));
messages
.
add
(
new
ValidationMessage
(
'Tools Dart version
${version.dartSdkVersion}
'
));
return
new
ValidationResult
(
valid
,
messages
,
return
new
ValidationResult
(
valid
,
messages
,
statusInfo:
'on
${os
Name()
}
, channel
${version.channel}
'
);
statusInfo:
'on
${os
.name
}
, channel
${version.channel}
'
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/usage.dart
View file @
3f4cb1fe
...
@@ -7,6 +7,7 @@ import 'dart:async';
...
@@ -7,6 +7,7 @@ import 'dart:async';
import
'package:usage/usage_io.dart'
;
import
'package:usage/usage_io.dart'
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'base/os.dart'
;
import
'base/utils.dart'
;
import
'base/utils.dart'
;
import
'globals.dart'
;
import
'globals.dart'
;
import
'version.dart'
;
import
'version.dart'
;
...
@@ -23,6 +24,10 @@ class Usage {
...
@@ -23,6 +24,10 @@ class Usage {
final
String
version
=
versionOverride
??
FlutterVersion
.
getVersionString
(
whitelistBranchName:
true
);
final
String
version
=
versionOverride
??
FlutterVersion
.
getVersionString
(
whitelistBranchName:
true
);
_analytics
=
new
AnalyticsIO
(
_kFlutterUA
,
settingsName
,
version
);
_analytics
=
new
AnalyticsIO
(
_kFlutterUA
,
settingsName
,
version
);
// Report a more detailed OS version string than package:usage does by
// default as custom dimension 1 (configured in our analytics account).
_analytics
.
setSessionValue
(
'dimension1'
,
os
.
name
);
bool
runningOnCI
=
false
;
bool
runningOnCI
=
false
;
// Many CI systems don't do a full git checkout.
// Many CI systems don't do a full git checkout.
...
...
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