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
f7d2bcdf
Unverified
Commit
f7d2bcdf
authored
Jun 09, 2020
by
Alexandre Ardhuin
Committed by
GitHub
Jun 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nnbd annotation in flutter_goldens_client (#59069)
parent
6067571f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
26 deletions
+24
-26
skia_client.dart
packages/flutter_goldens_client/lib/skia_client.dart
+24
-26
No files found.
packages/flutter_goldens_client/lib/skia_client.dart
View file @
f7d2bcdf
...
...
@@ -93,13 +93,13 @@ class SkiaGoldClient {
/// The path to the local [Directory] where the goldctl tool is hosted.
///
/// Uses the [platform] environment in this implementation.
String
get
_goldctl
=>
platform
.
environment
[
_kGoldctlKey
];
String
/*!*/
get
_goldctl
=>
platform
.
environment
[
_kGoldctlKey
];
/// The path to the local [Directory] where the service account key is
/// hosted.
///
/// Uses the [platform] environment in this implementation.
String
get
_serviceAccount
=>
platform
.
environment
[
_kServiceAccountKey
];
String
/*!*/
get
_serviceAccount
=>
platform
.
environment
[
_kServiceAccountKey
];
/// Prepares the local work space for golden file testing and calls the
/// goldctl `auth` command.
...
...
@@ -116,9 +116,9 @@ class SkiaGoldClient {
return
;
List
<
String
>
authArguments
;
String
failureContext
;
/*late*/
String
failureContext
;
switch
(
ci
)
{
switch
(
ci
/*!*/
)
{
case
ContinuousIntegrationEnvironment
.
luci
:
authArguments
=
<
String
>[
'auth'
,
...
...
@@ -378,7 +378,7 @@ class SkiaGoldClient {
imgtestArguments
,
);
final
String
resultStdout
=
result
.
stdout
.
toString
();
final
String
/*!*/
resultStdout
=
result
.
stdout
.
toString
();
if
(
result
.
exitCode
!=
0
&&
!(
resultStdout
.
contains
(
'Untriaged'
)
||
resultStdout
.
contains
(
'negative image'
)))
{
final
StringBuffer
buf
=
StringBuffer
()
...
...
@@ -508,8 +508,8 @@ class SkiaGoldClient {
rawResponse
=
await
utf8
.
decodeStream
(
response
);
final
List
<
dynamic
>
ignores
=
json
.
decode
(
rawResponse
)
as
List
<
dynamic
>;
for
(
final
dynamic
ignore
in
ignores
)
{
final
List
<
String
>
ignoredQueries
=
(
ignore
[
'query'
]
as
String
).
split
(
'&'
);
final
String
ignoredPullRequest
=
(
ignore
[
'note'
]
as
String
).
split
(
'/'
).
last
;
final
List
<
String
>
ignoredQueries
=
(
ignore
[
'query'
]
as
String
/*!*/
).
split
(
'&'
);
final
String
ignoredPullRequest
=
(
ignore
[
'note'
]
as
String
/*!*/
).
split
(
'/'
).
last
;
final
DateTime
expiration
=
DateTime
.
parse
(
ignore
[
'expires'
]
as
String
);
// The currently failing test is in the process of modification.
if
(
ignoredQueries
.
contains
(
'name=
$testName
'
))
{
...
...
@@ -589,15 +589,16 @@ class SkiaGoldClient {
/// Returns the current commit hash of the Flutter repository.
Future
<
String
>
_getCurrentCommit
()
async
{
if
(!
_flutterRoot
.
existsSync
())
{
final
StringBuffer
buf
=
StringBuffer
()
..
writeln
(
'Flutter root could not be found:
$_flutterRoot
'
);
throw
Exception
(
buf
.
toString
());
throw
Exception
(
'Flutter root could not be found:
$_flutterRoot
\n
'
);
}
else
{
final
io
.
ProcessResult
revParse
=
await
process
.
run
(
<
String
>[
'git'
,
'rev-parse'
,
'HEAD'
],
workingDirectory:
_flutterRoot
.
path
,
);
return
revParse
.
exitCode
==
0
?
(
revParse
.
stdout
as
String
).
trim
()
:
null
;
if
(
revParse
.
exitCode
!=
0
)
{
throw
Exception
(
'Current commit of Flutter can not be found.'
);
}
return
(
revParse
.
stdout
as
String
/*!*/
).
trim
();
}
}
...
...
@@ -626,15 +627,15 @@ class SkiaGoldClient {
/// Returns a boolean value to prevent the client from re-authorizing itself
/// for multiple tests.
Future
<
bool
>
clientIsAuthorized
()
async
{
final
File
authFile
=
workDirectory
?
.
childFile
(
fs
.
path
.
join
(
final
File
authFile
=
workDirectory
.
childFile
(
fs
.
path
.
join
(
'temp'
,
'auth_opt.json'
,
));
))
/*!*/
;
if
(
await
authFile
.
exists
())
{
final
String
contents
=
await
authFile
.
readAsString
();
final
Map
<
String
,
dynamic
>
decoded
=
json
.
decode
(
contents
)
as
Map
<
String
,
dynamic
>;
return
!(
decoded
[
'GSUtil'
]
as
bool
);
return
!(
decoded
[
'GSUtil'
]
as
bool
/*!*/
);
}
return
false
;
}
...
...
@@ -642,11 +643,11 @@ class SkiaGoldClient {
/// Returns a list of arguments for initializing a tryjob based on the testing
/// environment.
List
<
String
>
getCIArguments
()
{
String
pullRequest
;
String
jobId
;
String
cis
;
/*late*/
String
/*!*/
pullRequest
;
/*late*/
String
/*!*/
jobId
;
/*late*/
String
cis
;
switch
(
ci
)
{
switch
(
ci
/*!*/
)
{
case
ContinuousIntegrationEnvironment
.
luci
:
jobId
=
platform
.
environment
[
'LOGDOG_STREAM_PREFIX'
].
split
(
'/'
).
last
;
final
List
<
String
>
refs
=
platform
.
environment
[
'GOLD_TRYJOB'
].
split
(
'/'
);
...
...
@@ -682,9 +683,6 @@ class SkiaGoldDigest {
/// Create a digest from requested JSON.
factory
SkiaGoldDigest
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
==
null
)
return
null
;
return
SkiaGoldDigest
(
imageHash:
json
[
'digest'
]
as
String
,
paramSet:
Map
<
String
,
dynamic
>.
from
(
json
[
'paramset'
]
as
Map
<
String
,
dynamic
>
??
...
...
@@ -698,21 +696,21 @@ class SkiaGoldDigest {
}
/// Unique identifier for the image associated with the digest.
final
String
imageHash
;
final
String
/*!*/
imageHash
;
/// Parameter set for the given test, e.g. Platform : Windows.
final
Map
<
String
,
dynamic
>
paramSet
;
final
Map
<
String
,
dynamic
>
/*!*/
paramSet
;
/// Test name associated with the digest, e.g. positive or un-triaged.
final
String
testName
;
final
String
/*!*/
testName
;
/// Status of the given digest, e.g. positive or un-triaged.
final
String
status
;
final
String
/*!*/
status
;
/// Validates a given digest against the current testing conditions.
bool
isValid
(
Platform
platform
,
String
name
,
String
expectation
)
{
return
imageHash
==
expectation
&&
(
paramSet
[
'Platform'
]
as
List
<
dynamic
>).
contains
(
platform
.
operatingSystem
)
&&
(
paramSet
[
'Platform'
]
as
List
<
dynamic
>
/*!*/
).
contains
(
platform
.
operatingSystem
)
&&
(
platform
.
environment
[
_kTestBrowserKey
]
==
null
||
paramSet
[
'Browser'
]
==
platform
.
environment
[
_kTestBrowserKey
])
&&
testName
==
name
...
...
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