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
cd239599
Unverified
Commit
cd239599
authored
Dec 10, 2021
by
Ian Hickson
Committed by
GitHub
Dec 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt to mitigate flakiness around devtools (#94879)
parent
7ddd9984
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
29 deletions
+37
-29
test.dart
dev/bots/test.dart
+23
-26
resident_devtools_handler.dart
...ages/flutter_tools/lib/src/resident_devtools_handler.dart
+14
-3
No files found.
dev/bots/test.dart
View file @
cd239599
...
...
@@ -853,19 +853,7 @@ Future<void> _runFrameworkTests() async {
if
(
Directory
(
pubCache
).
existsSync
())
{
pubEnvironment
[
'PUB_CACHE'
]
=
pubCache
;
}
// If an existing env variable exists append to it, but only if
// it doesn't appear to already include enable-asserts.
String
toolsArgs
=
Platform
.
environment
[
'FLUTTER_TOOL_ARGS'
]
??
''
;
if
(!
toolsArgs
.
contains
(
'--enable-asserts'
))
{
toolsArgs
+=
' --enable-asserts'
;
}
pubEnvironment
[
'FLUTTER_TOOL_ARGS'
]
=
toolsArgs
.
trim
();
// The flutter_tool will originally have been snapshotted without asserts.
// We need to force it to be regenerated with them enabled.
deleteFile
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'flutter_tools.snapshot'
));
deleteFile
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'flutter_tools.stamp'
));
recompileFlutterToolWithAsserts
(
pubEnvironment
);
await
runCommand
(
pub
,
args
,
...
...
@@ -1536,6 +1524,10 @@ Future<void> _runWebDebugTest(String target, {
})
async
{
final
String
testAppDirectory
=
path
.
join
(
flutterRoot
,
'dev'
,
'integration_tests'
,
'web'
);
bool
success
=
false
;
final
Map
<
String
,
String
>
environment
=
<
String
,
String
>{
'FLUTTER_WEB'
:
'true'
,
};
recompileFlutterToolWithAsserts
(
environment
);
final
CommandResult
result
=
await
runCommand
(
flutter
,
<
String
>[
...
...
@@ -1565,9 +1557,7 @@ Future<void> _runWebDebugTest(String target, {
}
},
workingDirectory:
testAppDirectory
,
environment:
<
String
,
String
>{
'FLUTTER_WEB'
:
'true'
,
},
environment:
environment
,
);
if
(
success
)
{
...
...
@@ -1663,16 +1653,7 @@ Future<void> _pubRunTest(String workingDirectory, {
pubEnvironment
[
'PUB_CACHE'
]
=
pubCache
;
}
if
(
enableFlutterToolAsserts
)
{
// If an existing env variable exists append to it, but only if
// it doesn't appear to already include enable-asserts.
String
toolsArgs
=
Platform
.
environment
[
'FLUTTER_TOOL_ARGS'
]
??
''
;
if
(!
toolsArgs
.
contains
(
'--enable-asserts'
))
toolsArgs
+=
' --enable-asserts'
;
pubEnvironment
[
'FLUTTER_TOOL_ARGS'
]
=
toolsArgs
.
trim
();
// The flutter_tool will originally have been snapshotted without asserts.
// We need to force it to be regenerated with them enabled.
deleteFile
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'flutter_tools.snapshot'
));
deleteFile
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'flutter_tools.stamp'
));
recompileFlutterToolWithAsserts
(
pubEnvironment
);
}
if
(
ensurePrecompiledTool
)
{
// We rerun the `flutter` tool here just to make sure that it is compiled
...
...
@@ -1800,6 +1781,22 @@ Future<void> _runFlutterTest(String workingDirectory, {
}
}
/// This will force the next run of the Flutter tool (if it uses the provided environment) to
/// have asserts enabled, by setting an environment variable and deleting the cache.
void
recompileFlutterToolWithAsserts
(
Map
<
String
,
String
>
pubEnvironment
)
{
// If an existing env variable exists append to it, but only if
// it doesn't appear to already include enable-asserts.
String
toolsArgs
=
Platform
.
environment
[
'FLUTTER_TOOL_ARGS'
]
??
''
;
if
(!
toolsArgs
.
contains
(
'--enable-asserts'
))
{
toolsArgs
+=
' --enable-asserts'
;
}
pubEnvironment
[
'FLUTTER_TOOL_ARGS'
]
=
toolsArgs
.
trim
();
// The flutter_tool will originally have been snapshotted without asserts.
// We need to force it to be regenerated with them enabled.
deleteFile
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'flutter_tools.snapshot'
));
deleteFile
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'flutter_tools.stamp'
));
}
Map
<
String
,
String
>
_initGradleEnvironment
()
{
final
String
?
androidSdkRoot
=
(
Platform
.
environment
[
'ANDROID_HOME'
]?.
isEmpty
??
true
)
?
Platform
.
environment
[
'ANDROID_SDK_ROOT'
]
...
...
packages/flutter_tools/lib/src/resident_devtools_handler.dart
View file @
cd239599
...
...
@@ -60,7 +60,10 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
bool
launchedInBrowser
=
false
;
@override
DevToolsServerAddress
get
activeDevToolsServer
=>
_devToolsLauncher
?.
activeDevToolsServer
;
DevToolsServerAddress
get
activeDevToolsServer
{
assert
(!
_readyToAnnounce
||
_devToolsLauncher
?.
activeDevToolsServer
!=
null
);
return
_devToolsLauncher
?.
activeDevToolsServer
;
}
@override
bool
get
readyToAnnounce
=>
_readyToAnnounce
;
...
...
@@ -72,6 +75,7 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
Uri
devToolsServerAddress
,
@required
List
<
FlutterDevice
>
flutterDevices
,
})
async
{
assert
(!
_readyToAnnounce
);
if
(!
_residentRunner
.
supportsServiceProtocol
||
_devToolsLauncher
==
null
)
{
return
;
}
...
...
@@ -82,14 +86,20 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
_served
=
true
;
}
await
_devToolsLauncher
.
ready
;
// Do not attempt to print debugger list if the connection has failed.
if
(
_devToolsLauncher
.
activeDevToolsServer
==
null
)
{
// Do not attempt to print debugger list if the connection has failed or if we're shutting down.
if
(
_devToolsLauncher
.
activeDevToolsServer
==
null
||
_shutdown
)
{
assert
(!
_readyToAnnounce
);
return
;
}
final
List
<
FlutterDevice
>
devicesWithExtension
=
await
_devicesWithExtensions
(
flutterDevices
);
await
_maybeCallDevToolsUriServiceExtension
(
devicesWithExtension
);
await
_callConnectedVmServiceUriExtension
(
devicesWithExtension
);
if
(
_shutdown
)
{
// If we're shutting down, no point reporting the debugger list.
return
;
}
_readyToAnnounce
=
true
;
assert
(
_devToolsLauncher
.
activeDevToolsServer
!=
null
);
if
(
_residentRunner
.
reportedDebuggers
)
{
// Since the DevTools only just became available, we haven't had a chance to
// report their URLs yet. Do so now.
...
...
@@ -248,6 +258,7 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
return
;
}
_shutdown
=
true
;
_readyToAnnounce
=
false
;
await
_devToolsLauncher
.
close
();
}
}
...
...
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