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
ae291745
Unverified
Commit
ae291745
authored
Aug 20, 2019
by
Jonah Williams
Committed by
GitHub
Aug 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle compilation failures from web application (#38723)
parent
7ed27b51
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
23 deletions
+33
-23
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+12
-6
web_fs.dart
packages/flutter_tools/lib/src/build_runner/web_fs.dart
+1
-17
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+20
-0
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
ae291745
...
...
@@ -238,12 +238,18 @@ class ResidentWebRunner extends ResidentRunner {
return
OperationResult
(
1
,
'Failed to recompile application.'
);
}
if
(
supportsServiceProtocol
)
{
final
vmservice
.
Response
reloadResponse
=
await
_vmService
.
callServiceExtension
(
'hotRestart'
);
status
.
stop
();
printStatus
(
'Restarted application in
${getElapsedAsMilliseconds(timer.elapsed)}
.'
);
return
reloadResponse
.
type
==
'Success'
?
OperationResult
.
ok
:
OperationResult
(
1
,
reloadResponse
.
toString
());
try
{
final
vmservice
.
Response
reloadResponse
=
await
_vmService
.
callServiceExtension
(
'hotRestart'
);
printStatus
(
'Restarted application in
${getElapsedAsMilliseconds(timer.elapsed)}
.'
);
return
reloadResponse
.
type
==
'Success'
?
OperationResult
.
ok
:
OperationResult
(
1
,
reloadResponse
.
toString
());
}
on
vmservice
.
RPCError
{
await
_webFs
.
hardRefresh
();
return
OperationResult
(
1
,
'Page requires full reload'
);
}
finally
{
status
.
stop
();
}
}
// If we're not in hot mode, the only way to restart is to reload the tab.
await
_webFs
.
hardRefresh
();
...
...
packages/flutter_tools/lib/src/build_runner/web_fs.dart
View file @
ae291745
...
...
@@ -319,23 +319,7 @@ class BuildDaemonCreator {
'--define'
,
'flutter_tools:shell=flutterWebSdk=
$flutterWebSdk
'
,
],
logHandler:
(
ServerLog
serverLog
)
{
switch
(
serverLog
.
level
)
{
case
Level
.
CONFIG
:
case
Level
.
FINE
:
case
Level
.
FINER
:
case
Level
.
FINEST
:
case
Level
.
INFO
:
printTrace
(
serverLog
.
message
);
break
;
case
Level
.
SEVERE
:
case
Level
.
SHOUT
:
printError
(
serverLog
?.
error
??
''
,
stackTrace:
serverLog
.
stackTrace
!=
null
?
StackTrace
.
fromString
(
serverLog
?.
stackTrace
)
:
null
,
);
}
printTrace
(
serverLog
.
message
);
},
buildMode:
daemon
.
BuildMode
.
Manual
,
);
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
ae291745
...
...
@@ -61,6 +61,9 @@ void main() {
when
(
mockWebFs
.
runAndDebug
()).
thenAnswer
((
Invocation
_
)
async
{
return
mockDebugConnection
;
});
when
(
mockWebFs
.
recompile
()).
thenAnswer
((
Invocation
_
)
{
return
Future
<
bool
>.
value
(
false
);
});
when
(
mockDebugConnection
.
vmService
).
thenReturn
(
mockVmService
);
when
(
mockVmService
.
onStdoutEvent
).
thenAnswer
((
Invocation
_
)
{
return
const
Stream
<
Event
>.
empty
();
...
...
@@ -165,6 +168,23 @@ void main() {
expect
(
result
.
message
,
contains
(
'Failed'
));
}));
test
(
'Fails on vmservice RpcError'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
unawaited
(
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
));
await
connectionInfoCompleter
.
future
;
when
(
mockWebFs
.
recompile
()).
thenAnswer
((
Invocation
_
)
async
{
return
true
;
});
when
(
mockVmService
.
callServiceExtension
(
'hotRestart'
)).
thenThrow
(
RPCError
(
''
,
2
,
'123'
));
final
OperationResult
result
=
await
residentWebRunner
.
restart
(
fullRestart:
true
);
expect
(
result
.
code
,
1
);
expect
(
result
.
message
,
contains
(
'Page requires full reload'
));
}));
test
(
'printHelp without details is spoopy'
,
()
=>
testbed
.
run
(()
async
{
residentWebRunner
.
printHelp
(
details:
false
);
final
BufferLogger
bufferLogger
=
logger
;
...
...
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