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
26ed1e71
Commit
26ed1e71
authored
Apr 28, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify the analysis benchmarking code (#3588)
* simplify the analysis benchmarking code * review comments
parent
201ad82d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+9
-13
No files found.
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
26ed1e71
...
@@ -118,12 +118,10 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -118,12 +118,10 @@ class AnalyzeCommand extends FlutterCommand {
argParser
.
addFlag
(
'watch'
,
help:
'Run analysis continuously, watching the filesystem for changes.'
,
negatable:
false
);
argParser
.
addFlag
(
'watch'
,
help:
'Run analysis continuously, watching the filesystem for changes.'
,
negatable:
false
);
argParser
.
addOption
(
'dart-sdk'
,
help:
'The path to the Dart SDK.'
,
hide:
true
);
argParser
.
addOption
(
'dart-sdk'
,
help:
'The path to the Dart SDK.'
,
hide:
true
);
// These options enable a benchmarking mode where the total time is written at the
// Options to enable a benchmarking mode.
// end of the run to a json file.
argParser
.
addFlag
(
'benchmark'
,
argParser
.
addOption
(
'benchmark-out'
,
negatable:
false
,
defaultsTo:
'analysis.json'
,
hide:
true
hide:
true
,
help:
'Where to write benchmarking output.'
);
);
argParser
.
addOption
(
'benchmark-expected'
,
argParser
.
addOption
(
'benchmark-expected'
,
hide:
true
,
hide:
true
,
...
@@ -177,9 +175,7 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -177,9 +175,7 @@ class AnalyzeCommand extends FlutterCommand {
return
true
;
return
true
;
}
}
bool
get
_isBenchmarking
{
bool
get
_isBenchmarking
=>
argResults
[
'benchmark'
];
return
argResults
.
wasParsed
(
'benchmark-out'
)
||
argResults
.
wasParsed
(
'benchmark-expected'
);
}
Future
<
int
>
_analyzeOnce
()
async
{
Future
<
int
>
_analyzeOnce
()
async
{
Stopwatch
stopwatch
=
new
Stopwatch
()..
start
();
Stopwatch
stopwatch
=
new
Stopwatch
()..
start
();
...
@@ -490,7 +486,7 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -490,7 +486,7 @@ class AnalyzeCommand extends FlutterCommand {
}
}
AnalysisServer
server
=
new
AnalysisServer
(
dartSdkPath
,
directories
);
AnalysisServer
server
=
new
AnalysisServer
(
dartSdkPath
,
directories
);
server
.
onAnalyzing
.
listen
(
_handleAnalysisStatus
);
server
.
onAnalyzing
.
listen
(
(
bool
isAnalyzing
)
=>
_handleAnalysisStatus
(
server
,
isAnalyzing
)
);
server
.
onErrors
.
listen
(
_handleAnalysisErrors
);
server
.
onErrors
.
listen
(
_handleAnalysisErrors
);
await
server
.
start
();
await
server
.
start
();
...
@@ -506,7 +502,7 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -506,7 +502,7 @@ class AnalyzeCommand extends FlutterCommand {
Stopwatch
analysisTimer
;
Stopwatch
analysisTimer
;
int
lastErrorCount
=
0
;
int
lastErrorCount
=
0
;
void
_handleAnalysisStatus
(
bool
isAnalyzing
)
{
void
_handleAnalysisStatus
(
AnalysisServer
server
,
bool
isAnalyzing
)
{
if
(
isAnalyzing
)
{
if
(
isAnalyzing
)
{
if
(
firstAnalysis
)
{
if
(
firstAnalysis
)
{
printStatus
(
'Analyzing
${path.basename(Directory.current.path)}
...'
);
printStatus
(
'Analyzing
${path.basename(Directory.current.path)}
...'
);
...
@@ -556,7 +552,7 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -556,7 +552,7 @@ class AnalyzeCommand extends FlutterCommand {
if
(
firstAnalysis
&&
_isBenchmarking
)
{
if
(
firstAnalysis
&&
_isBenchmarking
)
{
_writeBenchmark
(
analysisTimer
,
issueCount
);
_writeBenchmark
(
analysisTimer
,
issueCount
);
exit
(
0
);
server
.
dispose
().
then
((
_
)
=>
exit
(
0
)
);
}
}
firstAnalysis
=
false
;
firstAnalysis
=
false
;
...
@@ -580,7 +576,7 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -580,7 +576,7 @@ class AnalyzeCommand extends FlutterCommand {
}
}
void
_writeBenchmark
(
Stopwatch
stopwatch
,
int
errorCount
)
{
void
_writeBenchmark
(
Stopwatch
stopwatch
,
int
errorCount
)
{
String
benchmarkOut
=
argResults
[
'benchmark-out'
]
;
final
String
benchmarkOut
=
'analysis_benchmark.json'
;
String
expectedTime
=
argResults
[
'benchmark-expected'
];
String
expectedTime
=
argResults
[
'benchmark-expected'
];
Map
<
String
,
dynamic
>
data
=
<
String
,
dynamic
>{
Map
<
String
,
dynamic
>
data
=
<
String
,
dynamic
>{
...
...
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