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
5b9ce492
Unverified
Commit
5b9ce492
authored
Jul 20, 2020
by
Helin Shiah
Committed by
GitHub
Jul 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip printing rendered error text in machine mode (#61684)
parent
c4bfa4c7
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
106 additions
and
27 deletions
+106
-27
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+6
-0
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+4
-0
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+1
-0
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+3
-1
run_cold.dart
packages/flutter_tools/lib/src/run_cold.dart
+10
-6
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+12
-8
web_runner.dart
packages/flutter_tools/lib/src/web/web_runner.dart
+1
-0
flutter_run_with_error_test.dart
...s/test/integration.shard/flutter_run_with_error_test.dart
+67
-11
test_driver.dart
...ges/flutter_tools/test/integration.shard/test_driver.dart
+2
-1
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
5b9ce492
...
...
@@ -53,6 +53,7 @@ class DwdsWebRunnerFactory extends WebRunnerFactory {
@required
bool
ipv6
,
@required
DebuggingOptions
debuggingOptions
,
@required
UrlTunneller
urlTunneller
,
bool
machine
=
false
,
})
{
return
_ResidentWebRunner
(
device
,
...
...
@@ -62,6 +63,7 @@ class DwdsWebRunnerFactory extends WebRunnerFactory {
ipv6:
ipv6
,
stayResident:
stayResident
,
urlTunneller:
urlTunneller
,
machine:
machine
,
);
}
}
...
...
@@ -79,12 +81,14 @@ abstract class ResidentWebRunner extends ResidentRunner {
@required
bool
ipv6
,
@required
DebuggingOptions
debuggingOptions
,
bool
stayResident
=
true
,
bool
machine
=
false
,
})
:
super
(
<
FlutterDevice
>[
device
],
target:
target
??
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
),
debuggingOptions:
debuggingOptions
,
ipv6:
ipv6
,
stayResident:
stayResident
,
machine:
machine
,
);
FlutterDevice
get
device
=>
flutterDevices
.
first
;
...
...
@@ -390,6 +394,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
@required
DebuggingOptions
debuggingOptions
,
bool
stayResident
=
true
,
@required
this
.
urlTunneller
,
bool
machine
=
false
,
})
:
super
(
device
,
flutterProject:
flutterProject
,
...
...
@@ -397,6 +402,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
debuggingOptions:
debuggingOptions
,
ipv6:
ipv6
,
stayResident:
stayResident
,
machine:
machine
,
);
final
UrlTunneller
urlTunneller
;
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
5b9ce492
...
...
@@ -448,6 +448,7 @@ class AppDomain extends Domain {
String
dillOutputPath
,
bool
ipv6
=
false
,
String
isolateFilter
,
bool
machine
=
true
,
})
async
{
if
(!
await
device
.
supportsRuntimeMode
(
options
.
buildInfo
.
mode
))
{
throw
Exception
(
...
...
@@ -480,6 +481,7 @@ class AppDomain extends Domain {
ipv6:
ipv6
,
stayResident:
true
,
urlTunneller:
options
.
webEnableExposeUrl
?
daemon
.
daemonDomain
.
exposeUrl
:
null
,
machine:
machine
,
);
}
else
if
(
enableHotReload
)
{
runner
=
HotRunner
(
...
...
@@ -491,6 +493,7 @@ class AppDomain extends Domain {
dillOutputPath:
dillOutputPath
,
ipv6:
ipv6
,
hostIsIde:
true
,
machine:
machine
,
);
}
else
{
runner
=
ColdRunner
(
...
...
@@ -499,6 +502,7 @@ class AppDomain extends Domain {
debuggingOptions:
options
,
applicationBinary:
applicationBinary
,
ipv6:
ipv6
,
machine:
machine
,
);
}
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
5b9ce492
...
...
@@ -450,6 +450,7 @@ class RunCommand extends RunCommandBase {
packagesFilePath:
globalResults
[
'packages'
]
as
String
,
dillOutputPath:
stringArg
(
'output-dill'
),
ipv6:
ipv6
,
machine:
true
,
);
}
on
Exception
catch
(
error
)
{
throwToolExit
(
error
.
toString
());
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
5b9ce492
...
...
@@ -705,6 +705,7 @@ abstract class ResidentRunner {
this
.
stayResident
=
true
,
this
.
hotMode
=
true
,
String
dillOutputPath
,
this
.
machine
=
false
,
})
:
mainPath
=
findMainDartFile
(
target
),
packagesFilePath
=
debuggingOptions
.
buildInfo
.
packagesPath
,
projectRootPath
=
projectRootPath
??
globals
.
fs
.
currentDirectory
.
path
,
...
...
@@ -741,6 +742,7 @@ abstract class ResidentRunner {
final
AssetBundle
assetBundle
;
final
CommandHelp
commandHelp
;
final
bool
machine
;
io
.
HttpServer
_devtoolsServer
;
...
...
@@ -1141,7 +1143,7 @@ abstract class ResidentRunner {
}
void
printStructuredErrorLog
(
vm_service
.
Event
event
)
{
if
(
event
.
extensionKind
==
'Flutter.Error'
)
{
if
(
event
.
extensionKind
==
'Flutter.Error'
&&
!
machine
)
{
final
Map
<
dynamic
,
dynamic
>
json
=
event
.
extensionData
?.
data
;
if
(
json
!=
null
&&
json
.
containsKey
(
'renderedErrorText'
))
{
globals
.
printStatus
(
'
\n
${json['renderedErrorText']}
'
);
...
...
packages/flutter_tools/lib/src/run_cold.dart
View file @
5b9ce492
...
...
@@ -23,12 +23,16 @@ class ColdRunner extends ResidentRunner {
this
.
applicationBinary
,
bool
ipv6
=
false
,
bool
stayResident
=
true
,
})
:
super
(
devices
,
bool
machine
=
false
,
})
:
super
(
devices
,
target:
target
,
debuggingOptions:
debuggingOptions
,
hotMode:
false
,
stayResident:
stayResident
,
ipv6:
ipv6
);
ipv6:
ipv6
,
machine:
machine
,
);
final
bool
traceStartup
;
final
bool
awaitFirstFrameWhenTracing
;
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
5b9ce492
...
...
@@ -74,14 +74,18 @@ class HotRunner extends ResidentRunner {
String
dillOutputPath
,
bool
stayResident
=
true
,
bool
ipv6
=
false
,
})
:
super
(
devices
,
bool
machine
=
false
,
})
:
super
(
devices
,
target:
target
,
debuggingOptions:
debuggingOptions
,
projectRootPath:
projectRootPath
,
stayResident:
stayResident
,
hotMode:
true
,
dillOutputPath:
dillOutputPath
,
ipv6:
ipv6
);
ipv6:
ipv6
,
machine:
machine
,
);
final
bool
benchmarkMode
;
final
File
applicationBinary
;
...
...
packages/flutter_tools/lib/src/web/web_runner.dart
View file @
5b9ce492
...
...
@@ -25,5 +25,6 @@ abstract class WebRunnerFactory {
@required
bool
ipv6
,
@required
DebuggingOptions
debuggingOptions
,
@required
UrlTunneller
urlTunneller
,
bool
machine
=
false
,
});
}
packages/flutter_tools/test/integration.shard/flutter_run_with_error_test.dart
View file @
5b9ce492
...
...
@@ -3,9 +3,14 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'package:file/file.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:process/process.dart'
;
import
'package:vm_service/vm_service.dart'
;
import
'package:vm_service/vm_service_io.dart'
;
import
'../src/common.dart'
;
import
'test_data/project_with_early_error.dart'
;
...
...
@@ -29,38 +34,89 @@ void main() {
tryToDelete
(
tempDir
);
});
test
(
'flutter run reports an early error in an application'
,
()
async
{
test
(
'flutter run in non-machine mode reports an early error in an application'
,
()
async
{
final
String
flutterBin
=
globals
.
fs
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
'flutter'
,
);
final
StringBuffer
stdout
=
StringBuffer
();
final
Process
process
=
await
const
LocalProcessManager
().
start
(<
String
>[
flutterBin
,
'run'
,
'--disable-service-auth-codes'
,
'--show-test-device'
,
'-dflutter-tester'
,
'--start-paused'
,
'--dart-define=flutter.inspector.structuredErrors=true'
,
],
workingDirectory:
tempDir
.
path
);
transformToLines
(
process
.
stdout
).
listen
((
String
line
)
async
{
stdout
.
writeln
(
line
);
if
(
line
.
startsWith
(
'An Observatory debugger'
))
{
final
RegExp
exp
=
RegExp
(
r'http://127.0.0.1:(\d+)/'
);
final
RegExpMatch
match
=
exp
.
firstMatch
(
line
);
final
String
port
=
match
.
group
(
1
);
if
(
port
!=
null
)
{
final
VmService
vmService
=
await
vmServiceConnectUri
(
'ws://localhost:
$port
/ws'
);
final
VM
vm
=
await
vmService
.
getVM
();
for
(
final
IsolateRef
isolate
in
vm
.
isolates
)
{
await
vmService
.
resume
(
isolate
.
id
);
}
}
}
if
(
line
.
startsWith
(
'Another exception was thrown'
))
{
process
.
kill
();
}
});
await
process
.
exitCode
;
expect
(
stdout
.
toString
(),
contains
(
_exceptionStart
));
});
test
(
'flutter run in machine mode does not print an error'
,
()
async
{
final
StringBuffer
stdout
=
StringBuffer
();
await
_flutter
.
run
(
startPaused:
true
,
withDebugger:
true
,
structuredErrors:
true
);
await
_flutter
.
run
(
startPaused:
true
,
withDebugger:
true
,
structuredErrors:
true
,
);
await
_flutter
.
resume
();
final
Completer
<
void
>
completer
=
Completer
<
void
>();
bool
lineFound
=
false
;
await
Future
<
void
>(()
async
{
_flutter
.
stdout
.
listen
((
String
line
)
{
stdout
.
writeln
(
line
);
if
(
line
.
startsWith
(
'Another exception was thrown'
)
&&
!
lineFound
)
{
lineFound
=
true
;
completer
.
complete
();
}
});
await
completer
.
future
;
}).
timeout
(
const
Duration
(
seconds:
1
5
),
onTimeout:
()
{
//
Complete anyway in case we don't see the 'Another exception' line
.
}).
timeout
(
const
Duration
(
seconds:
5
),
onTimeout:
()
{
//
We don't expect to see any output but want to write to stdout anyway
.
completer
.
complete
();
});
await
_flutter
.
stop
();
expect
(
stdout
.
toString
(),
contains
(
_exceptionStart
));
expect
(
stdout
.
toString
(),
isNot
(
contains
(
_exceptionStart
)
));
});
test
(
'flutter run for web reports an early error in an application'
,
()
async
{
final
StringBuffer
stdout
=
StringBuffer
();
await
_flutter
.
run
(
startPaused:
true
,
withDebugger:
true
,
structuredErrors:
true
,
chrome:
true
);
await
_flutter
.
run
(
startPaused:
true
,
withDebugger:
true
,
structuredErrors:
true
,
chrome:
true
,
machine:
false
,
);
await
_flutter
.
resume
();
final
Completer
<
void
>
completer
=
Completer
<
void
>();
...
...
packages/flutter_tools/test/integration.shard/test_driver.dart
View file @
5b9ce492
...
...
@@ -439,6 +439,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
bool
chrome
=
false
,
bool
expressionEvaluation
=
true
,
bool
structuredErrors
=
false
,
bool
machine
=
true
,
File
pidFile
,
String
script
,
})
async
{
...
...
@@ -447,7 +448,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
'run'
,
if
(!
chrome
)
'--disable-service-auth-codes'
,
'--machine'
,
if
(
machine
)
'--machine'
,
'-d'
,
if
(
chrome
)
...<
String
>[
...
...
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