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
4807f806
Unverified
Commit
4807f806
authored
Mar 16, 2021
by
Jonah Williams
Committed by
GitHub
Mar 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove globals from logger (#78353)
parent
4b879c31
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
52 additions
and
49 deletions
+52
-49
logger.dart
packages/flutter_tools/lib/src/base/logger.dart
+37
-25
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+2
-0
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+0
-1
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+1
-4
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+1
-10
attach_test.dart
...utter_tools/test/commands.shard/hermetic/attach_test.dart
+9
-0
logger_test.dart
...es/flutter_tools/test/general.shard/base/logger_test.dart
+1
-2
xcodeproj_test.dart
.../flutter_tools/test/general.shard/ios/xcodeproj_test.dart
+0
-6
fakes.dart
packages/flutter_tools/test/src/fakes.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/base/logger.dart
View file @
4807f806
...
...
@@ -9,7 +9,6 @@ import 'dart:async';
import
'package:meta/meta.dart'
;
import
'../convert.dart'
;
import
'../globals.dart'
as
globals
;
import
'io.dart'
;
import
'terminal.dart'
show
Terminal
,
TerminalColor
,
OutputPreferences
;
import
'utils.dart'
;
...
...
@@ -132,6 +131,10 @@ abstract class Logger {
int
progressIndicatorPadding
=
kDefaultStatusPadding
,
});
/// A [SilentStatus] or an [AnsiSpinner] (depending on whether the
/// terminal is fancy enough), already started.
Status
startSpinner
({
VoidCallback
onFinish
});
/// Send an event to be emitted.
///
/// Only surfaces a value in machine modes, Loggers may ignore this message in
...
...
@@ -214,6 +217,11 @@ class DelegatingLogger implements Logger {
);
}
@override
Status
startSpinner
({
VoidCallback
onFinish
})
{
return
_delegate
.
startSpinner
(
onFinish:
onFinish
);
}
@override
bool
get
supportsColor
=>
_delegate
.
supportsColor
;
...
...
@@ -374,6 +382,22 @@ class StdoutLogger extends Logger {
return
_status
;
}
@override
Status
startSpinner
({
VoidCallback
onFinish
})
{
if
(
terminal
.
supportsColor
)
{
return
AnsiSpinner
(
onFinish:
onFinish
,
stopwatch:
_stopwatchFactory
.
createStopwatch
(),
terminal:
terminal
,
stdio:
_stdio
,
)..
start
();
}
return
SilentStatus
(
onFinish:
onFinish
,
stopwatch:
_stopwatchFactory
.
createStopwatch
(),
)..
start
();
}
void
_clearStatus
()
{
_status
=
null
;
}
...
...
@@ -534,6 +558,14 @@ class BufferLogger extends Logger {
)..
start
();
}
@override
Status
startSpinner
({
VoidCallback
onFinish
})
{
return
SilentStatus
(
stopwatch:
_stopwatchFactory
.
createStopwatch
(),
onFinish:
onFinish
,
)..
start
();
}
@override
void
clear
()
{
_error
.
clear
();
...
...
@@ -731,26 +763,6 @@ abstract class Status {
@required
Stopwatch
stopwatch
,
})
:
_stopwatch
=
stopwatch
;
/// A [SilentStatus] or an [AnsiSpinner] (depending on whether the
/// terminal is fancy enough), already started.
factory
Status
.
withSpinner
({
@required
Stopwatch
stopwatch
,
@required
Terminal
terminal
,
VoidCallback
onFinish
,
})
{
if
(
terminal
.
supportsColor
)
{
return
AnsiSpinner
(
onFinish:
onFinish
,
stopwatch:
stopwatch
,
terminal:
terminal
,
)..
start
();
}
return
SilentStatus
(
onFinish:
onFinish
,
stopwatch:
stopwatch
,
)..
start
();
}
final
VoidCallback
onFinish
;
@protected
...
...
@@ -822,10 +834,10 @@ class SummaryStatus extends Status {
@required
Stopwatch
stopwatch
,
this
.
padding
=
kDefaultStatusPadding
,
VoidCallback
onFinish
,
Stdio
stdio
,
@required
Stdio
stdio
,
})
:
assert
(
message
!=
null
),
assert
(
padding
!=
null
),
_stdio
=
stdio
??
globals
.
stdio
,
_stdio
=
stdio
,
super
(
onFinish:
onFinish
,
stopwatch:
stopwatch
,
...
...
@@ -890,8 +902,8 @@ class AnsiSpinner extends Status {
@required
Stopwatch
stopwatch
,
@required
Terminal
terminal
,
VoidCallback
onFinish
,
Stdio
stdio
,
})
:
_stdio
=
stdio
??
globals
.
stdio
,
@required
Stdio
stdio
,
})
:
_stdio
=
stdio
,
_terminal
=
terminal
,
super
(
onFinish:
onFinish
,
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
4807f806
...
...
@@ -1024,6 +1024,7 @@ class NotifyingLogger extends DelegatingLogger {
@required
Duration
timeout
,
String
progressId
,
bool
multilineOutput
=
false
,
bool
includeTiming
=
true
,
int
progressIndicatorPadding
=
kDefaultStatusPadding
,
})
{
assert
(
timeout
!=
null
);
...
...
@@ -1152,6 +1153,7 @@ class AppRunLogger extends DelegatingLogger {
@required
Duration
timeout
,
String
progressId
,
bool
multilineOutput
=
false
,
bool
includeTiming
=
true
,
int
progressIndicatorPadding
=
kDefaultStatusPadding
,
})
{
final
int
id
=
_nextProgressId
++;
...
...
packages/flutter_tools/lib/src/context_runner.dart
View file @
4807f806
...
...
@@ -357,7 +357,6 @@ Future<T> runInContext<T>(
processManager:
globals
.
processManager
,
platform:
globals
.
platform
,
fileSystem:
globals
.
fs
,
terminal:
globals
.
terminal
,
usage:
globals
.
flutterUsage
,
),
},
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
4807f806
...
...
@@ -308,10 +308,7 @@ class Doctor {
for
(
final
ValidatorTask
validatorTask
in
startValidatorTasks
())
{
final
DoctorValidator
validator
=
validatorTask
.
validator
;
final
Status
status
=
Status
.
withSpinner
(
stopwatch:
Stopwatch
(),
terminal:
globals
.
terminal
,
);
final
Status
status
=
_logger
.
startSpinner
();
ValidationResult
result
;
try
{
result
=
await
validatorTask
.
result
;
...
...
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
4807f806
...
...
@@ -246,7 +246,6 @@ class XcodeProjectInterpreter {
@required
ProcessManager
processManager
,
@required
Logger
logger
,
@required
FileSystem
fileSystem
,
@required
Terminal
terminal
,
@required
Usage
usage
,
})
{
return
XcodeProjectInterpreter
.
_
(
...
...
@@ -254,7 +253,6 @@ class XcodeProjectInterpreter {
processManager:
processManager
,
logger:
logger
,
fileSystem:
fileSystem
,
terminal:
terminal
,
usage:
usage
,
);
}
...
...
@@ -264,14 +262,12 @@ class XcodeProjectInterpreter {
@required
ProcessManager
processManager
,
@required
Logger
logger
,
@required
FileSystem
fileSystem
,
@required
Terminal
terminal
,
@required
Usage
usage
,
int
majorVersion
,
int
minorVersion
,
int
patchVersion
,
})
:
_platform
=
platform
,
_fileSystem
=
fileSystem
,
_terminal
=
terminal
,
_logger
=
logger
,
_processUtils
=
ProcessUtils
(
logger:
logger
,
processManager:
processManager
),
_operatingSystemUtils
=
OperatingSystemUtils
(
...
...
@@ -307,7 +303,6 @@ class XcodeProjectInterpreter {
processManager:
processManager
,
usage:
TestUsage
(),
logger:
BufferLogger
.
test
(),
terminal:
Terminal
.
test
(),
majorVersion:
majorVersion
,
minorVersion:
minorVersion
,
patchVersion:
patchVersion
,
...
...
@@ -318,7 +313,6 @@ class XcodeProjectInterpreter {
final
FileSystem
_fileSystem
;
final
ProcessUtils
_processUtils
;
final
OperatingSystemUtils
_operatingSystemUtils
;
final
Terminal
_terminal
;
final
Logger
_logger
;
final
Usage
_usage
;
...
...
@@ -415,10 +409,7 @@ class XcodeProjectInterpreter {
String
scheme
,
Duration
timeout
=
const
Duration
(
minutes:
1
),
})
async
{
final
Status
status
=
Status
.
withSpinner
(
stopwatch:
Stopwatch
(),
terminal:
_terminal
,
);
final
Status
status
=
_logger
.
startSpinner
();
final
List
<
String
>
showBuildSettingsCommand
=
<
String
>[
...
xcrunCommand
(),
'xcodebuild'
,
...
...
packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart
View file @
4807f806
...
...
@@ -760,6 +760,7 @@ class StreamLogger extends Logger {
@required
Duration
timeout
,
String
progressId
,
bool
multilineOutput
=
false
,
bool
includeTiming
=
true
,
int
progressIndicatorPadding
=
kDefaultStatusPadding
,
})
{
_log
(
'[progress]
$message
'
);
...
...
@@ -768,6 +769,14 @@ class StreamLogger extends Logger {
)..
start
();
}
@override
Status
startSpinner
({
VoidCallback
onFinish
})
{
return
SilentStatus
(
stopwatch:
Stopwatch
(),
onFinish:
onFinish
,
)..
start
();
}
bool
_interrupt
=
false
;
void
interrupt
()
{
...
...
packages/flutter_tools/test/general.shard/base/logger_test.dart
View file @
4807f806
...
...
@@ -18,7 +18,6 @@ import 'package:meta/meta.dart';
import
'package:test/fake.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fakes.dart'
;
final
Platform
_kNoAnsiPlatform
=
FakePlatform
(
stdoutSupportsAnsi:
false
);
...
...
@@ -659,7 +658,7 @@ void main() {
expect
(
lines
[
3
],
equals
(
'0123456789'
*
3
));
});
test
Using
Context
(
'AppRunLogger writes plain text statuses when no app is active'
,
()
async
{
test
Without
Context
(
'AppRunLogger writes plain text statuses when no app is active'
,
()
async
{
final
BufferLogger
buffer
=
BufferLogger
.
test
();
final
AppRunLogger
logger
=
AppRunLogger
(
parent:
buffer
);
...
...
packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
View file @
4807f806
...
...
@@ -10,7 +10,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/terminal.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
import
'package:flutter_tools/src/project.dart'
;
...
...
@@ -41,7 +40,6 @@ void main() {
fileSystem:
fileSystem
,
platform:
platform
,
processManager:
processManager
,
terminal:
Terminal
.
test
(),
usage:
null
,
);
});
...
...
@@ -101,7 +99,6 @@ void main() {
fileSystem:
fileSystem
,
platform:
platform
,
processManager:
fakeProcessManager
,
terminal:
Terminal
.
test
(),
usage:
null
,
);
});
...
...
@@ -218,7 +215,6 @@ void main() {
fileSystem:
fileSystem
,
platform:
platform
,
processManager:
fakeProcessManager
,
terminal:
Terminal
.
test
(),
usage:
TestUsage
(),
);
fileSystem
.
file
(
xcodebuild
).
deleteSync
();
...
...
@@ -422,7 +418,6 @@ void main() {
fileSystem:
fileSystem
,
platform:
platform
,
processManager:
fakeProcessManager
,
terminal:
Terminal
.
test
(),
usage:
TestUsage
(),
);
...
...
@@ -449,7 +444,6 @@ void main() {
fileSystem:
fileSystem
,
platform:
platform
,
processManager:
fakeProcessManager
,
terminal:
Terminal
.
test
(),
usage:
TestUsage
(),
);
...
...
packages/flutter_tools/test/src/fakes.dart
View file @
4807f806
...
...
@@ -628,7 +628,7 @@ class FakeStatusLogger extends DelegatingLogger {
Status
status
;
@override
Status
startProgress
(
String
message
,
{
Duration
timeout
,
String
progressId
,
bool
multilineOutput
=
false
,
int
progressIndicatorPadding
=
kDefaultStatusPadding
})
{
Status
startProgress
(
String
message
,
{
Duration
timeout
,
String
progressId
,
bool
multilineOutput
=
false
,
bool
includeTiming
=
true
,
int
progressIndicatorPadding
=
kDefaultStatusPadding
})
{
return
status
;
}
}
...
...
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