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
a7367b65
Unverified
Commit
a7367b65
authored
Nov 18, 2019
by
Jonah Williams
Committed by
GitHub
Nov 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't log stack traces to console on build failures (#44966)
parent
ff84b3e6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
14 deletions
+69
-14
aot.dart
packages/flutter_tools/lib/src/aot.dart
+5
-2
build_system.dart
...ages/flutter_tools/lib/src/build_system/build_system.dart
+6
-1
bundle.dart
packages/flutter_tools/lib/src/bundle.dart
+5
-2
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+6
-2
compile.dart
packages/flutter_tools/lib/src/web/compile.dart
+5
-2
assemble_test.dart
...ter_tools/test/commands.shard/hermetic/assemble_test.dart
+42
-5
No files found.
packages/flutter_tools/lib/src/aot.dart
View file @
a7367b65
...
...
@@ -226,8 +226,11 @@ class AotBuilder {
status
?.
stop
();
if
(!
result
.
success
)
{
for
(
ExceptionMeasurement
measurement
in
result
.
exceptions
.
values
)
{
printError
(
measurement
.
exception
.
toString
());
printError
(
measurement
.
stackTrace
.
toString
());
printError
(
'Target
${measurement.target}
failed:
${measurement.exception}
'
,
stackTrace:
measurement
.
fatal
?
measurement
.
stackTrace
:
null
,
);
}
throwToolExit
(
'Failed to build aot.'
);
}
...
...
packages/flutter_tools/lib/src/build_system/build_system.dart
View file @
a7367b65
...
...
@@ -556,6 +556,8 @@ class _BuildInstance {
}
}
}
catch
(
exception
,
stackTrace
)
{
// TODO(jonahwilliams): throw specific exception for expected errors to mark
// as non-fatal. All others should be fatal.
node
.
target
.
clearStamp
(
environment
);
passed
=
false
;
skipped
=
false
;
...
...
@@ -573,12 +575,15 @@ class _BuildInstance {
/// Helper class to collect exceptions.
class
ExceptionMeasurement
{
ExceptionMeasurement
(
this
.
target
,
this
.
exception
,
this
.
stackTrace
);
ExceptionMeasurement
(
this
.
target
,
this
.
exception
,
this
.
stackTrace
,
{
this
.
fatal
=
false
}
);
final
String
target
;
final
dynamic
exception
;
final
StackTrace
stackTrace
;
/// Whether this exception was a fatal build system error.
final
bool
fatal
;
@override
String
toString
()
=>
'target:
$target
\n
exception:
$exception
\n
$stackTrace
'
;
}
...
...
packages/flutter_tools/lib/src/bundle.dart
View file @
a7367b65
...
...
@@ -126,8 +126,11 @@ Future<void> buildWithAssemble({
if
(!
result
.
success
)
{
for
(
ExceptionMeasurement
measurement
in
result
.
exceptions
.
values
)
{
printError
(
measurement
.
exception
.
toString
());
printError
(
measurement
.
stackTrace
.
toString
());
printError
(
'Target
${measurement.target}
failed:
${measurement.exception}
'
,
stackTrace:
measurement
.
fatal
?
measurement
.
stackTrace
:
null
,
);
}
throwToolExit
(
'Failed to build bundle.'
);
}
...
...
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
a7367b65
...
...
@@ -155,8 +155,12 @@ class AssembleCommand extends FlutterCommand {
resourcePoolSize:
argResults
[
'resource-pool-size'
],
));
if
(!
result
.
success
)
{
for
(
MapEntry
<
String
,
ExceptionMeasurement
>
data
in
result
.
exceptions
.
entries
)
{
printError
(
'Target
${data.key}
failed:
${data.value.exception}
'
,
stackTrace:
data
.
value
.
stackTrace
);
for
(
ExceptionMeasurement
measurement
in
result
.
exceptions
.
values
)
{
printError
(
'Target
${measurement.target}
failed:
${measurement.exception}
'
,
stackTrace:
measurement
.
fatal
?
measurement
.
stackTrace
:
null
,
);
}
throwToolExit
(
'build failed.'
);
}
...
...
packages/flutter_tools/lib/src/web/compile.dart
View file @
a7367b65
...
...
@@ -54,8 +54,11 @@ Future<void> buildWeb(
));
if
(!
result
.
success
)
{
for
(
ExceptionMeasurement
measurement
in
result
.
exceptions
.
values
)
{
printError
(
measurement
.
stackTrace
.
toString
());
printError
(
measurement
.
exception
.
toString
());
printError
(
'Target
${measurement.target}
failed:
${measurement.exception}
'
,
stackTrace:
measurement
.
fatal
?
measurement
.
stackTrace
:
null
,
);
}
throwToolExit
(
'Failed to compile application for the Web.'
);
}
...
...
packages/flutter_tools/test/commands.shard/hermetic/assemble_test.dart
View file @
a7367b65
...
...
@@ -41,7 +41,8 @@ void main() {
});
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
AssembleCommand
());
expect
(
commandRunner
.
run
(<
String
>[
'assemble'
,
'debug_macos_bundle_flutter_assets'
]),
throwsA
(
isInstanceOf
<
ToolExit
>()));
expect
(
commandRunner
.
run
(<
String
>[
'assemble'
,
'debug_macos_bundle_flutter_assets'
]),
throwsA
(
isInstanceOf
<
ToolExit
>()));
});
testbed
.
test
(
'Throws ToolExit if called with non-existent rule'
,
()
async
{
...
...
@@ -51,7 +52,25 @@ void main() {
});
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
AssembleCommand
());
expect
(
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'undefined'
]),
throwsA
(
isInstanceOf
<
ToolExit
>()));
expect
(
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'undefined'
]),
throwsA
(
isInstanceOf
<
ToolExit
>()));
});
testbed
.
test
(
'Does not log stack traces during build failure'
,
()
async
{
final
BufferLogger
bufferLogger
=
logger
;
final
StackTrace
testStackTrace
=
StackTrace
.
current
;
when
(
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
false
,
exceptions:
<
String
,
ExceptionMeasurement
>{
'hello'
:
ExceptionMeasurement
(
'hello'
,
'bar'
,
testStackTrace
),
});
});
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
AssembleCommand
());
await
expectLater
(
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'debug_macos_bundle_flutter_assets'
]),
throwsA
(
isInstanceOf
<
ToolExit
>()));
expect
(
bufferLogger
.
errorText
,
contains
(
'bar'
));
expect
(
bufferLogger
.
errorText
,
isNot
(
contains
(
testStackTrace
.
toString
())));
});
testbed
.
test
(
'Only writes input and output files when the values change'
,
()
async
{
...
...
@@ -65,7 +84,13 @@ void main() {
});
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
AssembleCommand
());
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'--build-outputs=outputs'
,
'--build-inputs=inputs'
,
'debug_macos_bundle_flutter_assets'
]);
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'--build-outputs=outputs'
,
'--build-inputs=inputs'
,
'debug_macos_bundle_flutter_assets'
,
]);
final
File
inputs
=
fs
.
file
(
'inputs'
);
final
File
outputs
=
fs
.
file
(
'outputs'
);
...
...
@@ -75,7 +100,13 @@ void main() {
final
DateTime
theDistantPast
=
DateTime
(
1991
,
8
,
23
);
inputs
.
setLastModifiedSync
(
theDistantPast
);
outputs
.
setLastModifiedSync
(
theDistantPast
);
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'--build-outputs=outputs'
,
'--build-inputs=inputs'
,
'debug_macos_bundle_flutter_assets'
]);
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'--build-outputs=outputs'
,
'--build-inputs=inputs'
,
'debug_macos_bundle_flutter_assets'
,
]);
expect
(
inputs
.
lastModifiedSync
(),
theDistantPast
);
expect
(
outputs
.
lastModifiedSync
(),
theDistantPast
);
...
...
@@ -87,7 +118,13 @@ void main() {
inputFiles:
<
File
>[
fs
.
file
(
'foo'
),
fs
.
file
(
'fizz'
)..
createSync
()],
outputFiles:
<
File
>[
fs
.
file
(
'bar'
),
fs
.
file
(
fs
.
path
.
join
(
'.dart_tool'
,
'fizz2'
))..
createSync
(
recursive:
true
)]);
});
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'--build-outputs=outputs'
,
'--build-inputs=inputs'
,
'debug_macos_bundle_flutter_assets'
]);
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'--build-outputs=outputs'
,
'--build-inputs=inputs'
,
'debug_macos_bundle_flutter_assets'
,
]);
expect
(
inputs
.
readAsStringSync
(),
contains
(
'foo'
));
expect
(
inputs
.
readAsStringSync
(),
contains
(
'fizz'
));
...
...
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