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
e1ff62a7
Unverified
Commit
e1ff62a7
authored
Jan 14, 2021
by
J-P Nurmi
Committed by
GitHub
Jan 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] propagate build errors from the backend (#72196)
parent
ac2f62a9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
61 additions
and
2 deletions
+61
-2
tool_backend.dart
packages/flutter_tools/bin/tool_backend.dart
+3
-0
executable.dart
packages/flutter_tools/lib/executable.dart
+6
-0
logger.dart
packages/flutter_tools/lib/src/base/logger.dart
+28
-0
build_linux.dart
packages/flutter_tools/lib/src/linux/build_linux.dart
+5
-2
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+4
-0
build_linux_test.dart
..._tools/test/commands.shard/hermetic/build_linux_test.dart
+2
-0
logger_test.dart
...es/flutter_tools/test/general.shard/base/logger_test.dart
+13
-0
No files found.
packages/flutter_tools/bin/tool_backend.dart
View file @
e1ff62a7
...
...
@@ -29,6 +29,7 @@ Future<void> main(List<String> arguments) async {
final
bool
trackWidgetCreation
=
Platform
.
environment
[
'TRACK_WIDGET_CREATION'
]
==
'true'
;
final
bool
treeShakeIcons
=
Platform
.
environment
[
'TREE_SHAKE_ICONS'
]
==
'true'
;
final
bool
verbose
=
Platform
.
environment
[
'VERBOSE_SCRIPT_LOGGING'
]
==
'true'
;
final
bool
prefixedErrors
=
Platform
.
environment
[
'PREFIXED_ERROR_LOGGING'
]
==
'true'
;
Directory
.
current
=
projectDirectory
;
...
...
@@ -61,6 +62,8 @@ or
<
String
>[
if
(
verbose
)
'--verbose'
,
if
(
prefixedErrors
)
'--prefixed-errors'
,
if
(
flutterEngine
!=
null
)
'--local-engine-src-path=
$flutterEngine
'
,
if
(
localEngine
!=
null
)
'--local-engine=
$localEngine
'
,
'assemble'
,
...
...
packages/flutter_tools/lib/executable.dart
View file @
e1ff62a7
...
...
@@ -61,6 +61,7 @@ import 'src/web/web_runner.dart';
Future
<
void
>
main
(
List
<
String
>
args
)
async
{
final
bool
veryVerbose
=
args
.
contains
(
'-vv'
);
final
bool
verbose
=
args
.
contains
(
'-v'
)
||
args
.
contains
(
'--verbose'
)
||
veryVerbose
;
final
bool
prefixedErrors
=
args
.
contains
(
'--prefixed-errors'
);
// Support the -? Powershell help idiom.
final
int
powershellHelpIndex
=
args
.
indexOf
(
'-?'
);
if
(
powershellHelpIndex
!=
-
1
)
{
...
...
@@ -169,6 +170,7 @@ Future<void> main(List<String> args) async {
daemon:
daemon
,
machine:
runMachine
,
verbose:
verbose
&&
!
muteCommandLogging
,
prefixedErrors:
prefixedErrors
,
windows:
globals
.
platform
.
isWindows
,
);
}
...
...
@@ -197,6 +199,7 @@ class LoggerFactory {
/// Create the appropriate logger for the current platform and configuration.
Logger
createLogger
({
@required
bool
verbose
,
@required
bool
prefixedErrors
,
@required
bool
machine
,
@required
bool
daemon
,
@required
bool
windows
,
...
...
@@ -220,6 +223,9 @@ class LoggerFactory {
if
(
verbose
)
{
logger
=
VerboseLogger
(
logger
,
stopwatchFactory:
_stopwatchFactory
);
}
if
(
prefixedErrors
)
{
logger
=
PrefixedErrorLogger
(
logger
);
}
if
(
daemon
)
{
return
NotifyingLogger
(
verbose:
verbose
,
parent:
logger
);
}
...
...
packages/flutter_tools/lib/src/base/logger.dart
View file @
e1ff62a7
...
...
@@ -676,6 +676,34 @@ class VerboseLogger extends DelegatingLogger {
void
sendEvent
(
String
name
,
[
Map
<
String
,
dynamic
>
args
])
{
}
}
class
PrefixedErrorLogger
extends
DelegatingLogger
{
PrefixedErrorLogger
(
Logger
parent
)
:
super
(
parent
);
@override
void
printError
(
String
message
,
{
StackTrace
stackTrace
,
bool
emphasis
,
TerminalColor
color
,
int
indent
,
int
hangingIndent
,
bool
wrap
,
})
{
if
(
message
?.
trim
()?.
isNotEmpty
==
true
)
{
message
=
'ERROR:
$message
'
;
}
super
.
printError
(
message
,
stackTrace:
stackTrace
,
emphasis:
emphasis
,
color:
color
,
indent:
indent
,
hangingIndent:
hangingIndent
,
wrap:
wrap
,
);
}
}
enum
_LogType
{
error
,
status
,
trace
}
typedef
SlowWarningCallback
=
String
Function
();
...
...
packages/flutter_tools/lib/src/linux/build_linux.dart
View file @
e1ff62a7
...
...
@@ -22,7 +22,8 @@ import '../project.dart';
// - <file path>:<line>:<column>: (fatal) error: <error...>
// - <file path>:<line>:<column>: warning: <warning...>
// - clang: error: <link error...>
final
RegExp
errorMatcher
=
RegExp
(
r'(?:.*:\d+:\d+|clang):\s?(fatal\s)?(?:error|warning):\s.*'
,
caseSensitive:
false
);
// - Error: <tool error...>
final
RegExp
errorMatcher
=
RegExp
(
r'(?:(?:.*:\d+:\d+|clang):\s)?(fatal\s)?(?:error|warning):\s.*'
,
caseSensitive:
false
);
/// Builds the Linux project through the Makefile.
Future
<
void
>
buildLinux
(
...
...
@@ -152,7 +153,9 @@ Future<void> _runBuild(Directory buildDir) async {
],
environment:
<
String
,
String
>{
if
(
globals
.
logger
.
isVerbose
)
'VERBOSE_SCRIPT_LOGGING'
:
'true'
'VERBOSE_SCRIPT_LOGGING'
:
'true'
,
if
(!
globals
.
logger
.
isVerbose
)
'PREFIXED_ERROR_LOGGING'
:
'true'
,
},
trace:
true
,
stdoutErrorMatcher:
errorMatcher
,
...
...
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
e1ff62a7
...
...
@@ -44,6 +44,10 @@ class FlutterCommandRunner extends CommandRunner<void> {
negatable:
false
,
help:
'Noisy logging, including all shell commands executed.
\n
'
'If used with --help, shows hidden options.'
);
argParser
.
addFlag
(
'prefixed-errors'
,
negatable:
false
,
hide:
true
,
defaultsTo:
false
);
argParser
.
addFlag
(
'quiet'
,
negatable:
false
,
hide:
!
verboseHelp
,
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart
View file @
e1ff62a7
...
...
@@ -231,6 +231,7 @@ lib/main.dart:4:3: Error: Method not found: 'foo'.
main
.
cc
:(.
text
+
0x13
):
undefined
reference
to
`
Foo:
:
bar
()
'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
'''
;
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
...
...
@@ -252,6 +253,7 @@ lib/main.dart:4:3: Error: Method not found: 'foo'.
/foo/linux/main.cc:12:7: error: '
bar
' is a private member of '
Foo
'
/foo/linux/my_application.h:4:10: fatal error: '
gtk
/
gtk
.
h
' file not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
'''
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
...
...
packages/flutter_tools/test/general.shard/base/logger_test.dart
View file @
e1ff62a7
...
...
@@ -36,36 +36,49 @@ void main() {
expect
(
loggerFactory
.
createLogger
(
verbose:
false
,
prefixedErrors:
false
,
machine:
false
,
daemon:
false
,
windows:
false
,
),
isA
<
StdoutLogger
>());
expect
(
loggerFactory
.
createLogger
(
verbose:
false
,
prefixedErrors:
false
,
machine:
false
,
daemon:
false
,
windows:
true
,
),
isA
<
WindowsStdoutLogger
>());
expect
(
loggerFactory
.
createLogger
(
verbose:
true
,
prefixedErrors:
false
,
machine:
false
,
daemon:
false
,
windows:
true
,
),
isA
<
VerboseLogger
>());
expect
(
loggerFactory
.
createLogger
(
verbose:
true
,
prefixedErrors:
false
,
machine:
false
,
daemon:
false
,
windows:
false
,
),
isA
<
VerboseLogger
>());
expect
(
loggerFactory
.
createLogger
(
verbose:
false
,
prefixedErrors:
true
,
machine:
false
,
daemon:
false
,
windows:
false
,
),
isA
<
PrefixedErrorLogger
>());
expect
(
loggerFactory
.
createLogger
(
verbose:
false
,
prefixedErrors:
false
,
machine:
false
,
daemon:
true
,
windows:
false
,
),
isA
<
NotifyingLogger
>());
expect
(
loggerFactory
.
createLogger
(
verbose:
false
,
prefixedErrors:
false
,
machine:
true
,
daemon:
false
,
windows:
false
,
...
...
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