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
10931af0
Commit
10931af0
authored
Jun 23, 2016
by
Adam Barth
Committed by
GitHub
Jun 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify coverage workflow (#4725)
We now download the base coverage file automatically.
parent
f20546a1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
28 deletions
+59
-28
CONTRIBUTING.md
CONTRIBUTING.md
+7
-4
net.dart
packages/flutter_tools/lib/src/base/net.dart
+27
-0
cache.dart
packages/flutter_tools/lib/src/cache.dart
+2
-20
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+23
-4
No files found.
CONTRIBUTING.md
View file @
10931af0
...
...
@@ -150,11 +150,14 @@ Coveralls to [track our test coverage](https://coveralls.io/github/flutter/flutt
You can download our current coverage data from cloud storage and visualize it
in Atom as follows:
*
`mkdir packages/flutter/coverage`
*
Download the latest
`lcov.info`
file produced by Travis using
`curl https://storage.googleapis.com/flutter_infra/flutter/coverage/lcov.info -o packages/flutter/coverage/lcov.info`
*
Install the
[
lcov-info
](
https://atom.io/packages/lcov-info
)
package for Atom.
*
Open a file in
`packages/flutter/lib`
in Atom and type
`Ctrl+Alt+C`
.
*
Open the
`packages/flutter`
folder in Atom.
*
Open a Dart file in the
`lib`
directory an type
`Ctrl+Alt+C`
to bring up the
coverage data.
If you don't see any coverage data, check that you have an
`lcov.info`
file in
the
`packages/flutter/coverage`
directory. It should have been downloaded by the
`flutter update-packages`
command you ran previously.
See
[
issue 4719
](
https://github.com/flutter/flutter/issues/4719
)
for ideas about
how to improve this workflow.
...
...
packages/flutter_tools/lib/src/base/net.dart
0 → 100644
View file @
10931af0
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'../globals.dart'
;
/// Download a file from the given URL and return the bytes.
Future
<
List
<
int
>>
fetchUrl
(
Uri
url
)
async
{
printTrace
(
'Downloading
$url
.'
);
HttpClient
httpClient
=
new
HttpClient
();
HttpClientRequest
request
=
await
httpClient
.
getUrl
(
url
);
HttpClientResponse
response
=
await
request
.
close
();
printTrace
(
'Received response statusCode=
${response.statusCode}
'
);
if
(
response
.
statusCode
!=
200
)
throw
new
Exception
(
response
.
reasonPhrase
);
BytesBuilder
responseBody
=
new
BytesBuilder
(
copy:
false
);
await
for
(
List
<
int
>
chunk
in
response
)
responseBody
.
add
(
chunk
);
return
responseBody
.
takeBytes
();
}
packages/flutter_tools/lib/src/cache.dart
View file @
10931af0
...
...
@@ -9,6 +9,7 @@ import 'package:path/path.dart' as path;
import
'base/context.dart'
;
import
'base/logger.dart'
;
import
'base/net.dart'
;
import
'base/os.dart'
;
import
'globals.dart'
;
...
...
@@ -167,25 +168,6 @@ class Cache {
await
engine
.
download
();
}
/// Download a file from the given URL and return the bytes.
static
Future
<
List
<
int
>>
_downloadFile
(
Uri
url
)
async
{
printTrace
(
'Downloading
$url
.'
);
HttpClient
httpClient
=
new
HttpClient
();
HttpClientRequest
request
=
await
httpClient
.
getUrl
(
url
);
HttpClientResponse
response
=
await
request
.
close
();
printTrace
(
'Received response statusCode=
${response.statusCode}
'
);
if
(
response
.
statusCode
!=
200
)
throw
new
Exception
(
response
.
reasonPhrase
);
BytesBuilder
responseBody
=
new
BytesBuilder
(
copy:
false
);
await
for
(
List
<
int
>
chunk
in
response
)
responseBody
.
add
(
chunk
);
return
responseBody
.
takeBytes
();
}
/// Download a file from the given url and write it to the cache.
/// If [unzip] is true, treat the url as a zip file, and unzip it to the
/// directory given.
...
...
@@ -193,7 +175,7 @@ class Cache {
if
(!
location
.
parent
.
existsSync
())
location
.
parent
.
createSync
(
recursive:
true
);
List
<
int
>
fileBytes
=
await
_downloadFile
(
url
);
List
<
int
>
fileBytes
=
await
fetchUrl
(
url
);
if
(
unzip
)
{
if
(
location
is
Directory
&&
!
location
.
existsSync
())
location
.
createSync
(
recursive:
true
);
...
...
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
10931af0
...
...
@@ -5,6 +5,11 @@
import
'dart:async'
;
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
import
'../base/logger.dart'
;
import
'../base/net.dart'
;
import
'../cache.dart'
;
import
'../dart/pub.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
;
...
...
@@ -30,12 +35,25 @@ class UpdatePackagesCommand extends FlutterCommand {
@override
bool
get
requiresProjectRoot
=>
false
;
Future
<
Null
>
_downloadCoverageData
()
async
{
Status
status
=
logger
.
startProgress
(
"Downloading lcov data for package:flutter..."
);
final
List
<
int
>
data
=
await
fetchUrl
(
Uri
.
parse
(
'https://storage.googleapis.com/flutter_infra/flutter/coverage/lcov.info'
));
final
String
coverageDir
=
path
.
join
(
Cache
.
flutterRoot
,
'packages/flutter/coverage'
);
new
File
(
path
.
join
(
coverageDir
,
'lcov.base.info'
))
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
data
,
flush:
true
);
new
File
(
path
.
join
(
coverageDir
,
'lcov.info'
))
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
data
,
flush:
true
);
status
.
stop
(
showElapsedTime:
true
);
}
@override
Future
<
int
>
runInProject
()
async
{
try
{
Stopwatch
timer
=
new
Stopwatch
()..
start
();
final
Stopwatch
timer
=
new
Stopwatch
()..
start
();
int
count
=
0
;
bool
upgrade
=
argResults
[
'upgrade'
];
final
bool
upgrade
=
argResults
[
'upgrade'
];
for
(
Directory
dir
in
runner
.
getRepoPackages
())
{
int
code
=
await
pubGet
(
directory:
dir
.
path
,
upgrade:
upgrade
,
checkLastModified:
false
);
...
...
@@ -44,9 +62,10 @@ class UpdatePackagesCommand extends FlutterCommand {
count
++;
}
double
seconds
=
timer
.
elapsedMilliseconds
/
1000.0
;
printStatus
(
'
\n
Ran
\'
pub
\'
$count
time
${count == 1 ? "" : "s"}
in
${seconds.toStringAsFixed(1)}
s.'
);
await
_downloadCoverageData
();
final
double
seconds
=
timer
.
elapsedMilliseconds
/
1000.0
;
printStatus
(
'
\n
Ran
\'
pub
\'
$count
time
${count == 1 ? "" : "s"}
and fetched coverage data in
${seconds.toStringAsFixed(1)}
s.'
);
return
0
;
}
on
int
catch
(
code
)
{
return
code
;
...
...
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