Remove some globals from the tool (#79422)
This commit is contained in:
@@ -13,7 +13,6 @@ import '../../base/logger.dart';
|
||||
import '../../build_info.dart';
|
||||
import '../../convert.dart';
|
||||
import '../../devfs.dart';
|
||||
import '../../globals.dart' as globals;
|
||||
import '../build_system.dart';
|
||||
import '../depfile.dart';
|
||||
import 'common.dart';
|
||||
@@ -51,7 +50,7 @@ Future<Depfile> copyAssets(Environment environment, Directory outputDirectory, {
|
||||
final AssetBundle assetBundle = AssetBundleFactory.defaultInstance(
|
||||
logger: environment.logger,
|
||||
fileSystem: environment.fileSystem,
|
||||
platform: globals.platform,
|
||||
platform: environment.platform,
|
||||
splitDeferredAssets: buildMode != BuildMode.debug && buildMode != BuildMode.jitRelease,
|
||||
).createBundle();
|
||||
final int resultCode = await assetBundle.build(
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
import '../../base/file_system.dart';
|
||||
import '../../convert.dart';
|
||||
import '../../globals.dart' as globals;
|
||||
import '../../localizations/gen_l10n.dart';
|
||||
import '../../localizations/localizations_utils.dart';
|
||||
import '../build_system.dart';
|
||||
@@ -53,7 +52,7 @@ class GenerateLocalizationsTarget extends Target {
|
||||
|
||||
final LocalizationOptions options = parseLocalizationsOptions(
|
||||
file: configFile,
|
||||
logger: globals.logger,
|
||||
logger: environment.logger,
|
||||
);
|
||||
final DepfileService depfileService = DepfileService(
|
||||
logger: environment.logger,
|
||||
|
||||
@@ -296,6 +296,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
||||
ipv6: ipv6,
|
||||
devicePort: deviceVmservicePort,
|
||||
hostPort: hostVmservicePort,
|
||||
logger: globals.logger,
|
||||
);
|
||||
globals.printStatus('Waiting for a connection from Flutter on ${device.name}...');
|
||||
observatoryUri = observatoryDiscovery.uris;
|
||||
|
||||
@@ -471,6 +471,7 @@ class IOSSimulator extends Device {
|
||||
ipv6: ipv6,
|
||||
hostPort: debuggingOptions.hostVmServicePort,
|
||||
devicePort: debuggingOptions.deviceVmServicePort,
|
||||
logger: globals.logger,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import 'base/io.dart';
|
||||
import 'base/logger.dart';
|
||||
import 'device.dart';
|
||||
import 'device_port_forwader.dart';
|
||||
import 'globals.dart' as globals;
|
||||
|
||||
/// Discovers a specific service protocol on a device, and forwards the service
|
||||
/// protocol device port to the host.
|
||||
@@ -42,7 +41,7 @@ class ProtocolDiscovery {
|
||||
@required int hostPort,
|
||||
@required int devicePort,
|
||||
@required bool ipv6,
|
||||
Logger logger, // TODO(jonahwilliams): make required.
|
||||
@required Logger logger,
|
||||
}) {
|
||||
const String kObservatoryService = 'Observatory';
|
||||
return ProtocolDiscovery._(
|
||||
@@ -53,7 +52,7 @@ class ProtocolDiscovery {
|
||||
hostPort: hostPort,
|
||||
devicePort: devicePort,
|
||||
ipv6: ipv6,
|
||||
logger: logger ?? globals.logger,
|
||||
logger: logger,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -206,6 +206,7 @@ class FlutterTesterDevice extends Device {
|
||||
hostPort: debuggingOptions.hostVmServicePort,
|
||||
devicePort: debuggingOptions.deviceVmServicePort,
|
||||
ipv6: ipv6,
|
||||
logger: _logger,
|
||||
);
|
||||
_logReader.initializeProcess(_process);
|
||||
|
||||
|
||||
@@ -23,10 +23,8 @@ import '../../../src/context.dart';
|
||||
void main() {
|
||||
Environment environment;
|
||||
FileSystem fileSystem;
|
||||
Platform platform;
|
||||
|
||||
setUp(() {
|
||||
platform = FakePlatform();
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
environment = Environment.test(
|
||||
fileSystem.currentDirectory,
|
||||
@@ -34,6 +32,7 @@ void main() {
|
||||
artifacts: Artifacts.test(),
|
||||
fileSystem: fileSystem,
|
||||
logger: BufferLogger.test(),
|
||||
platform: FakePlatform(),
|
||||
);
|
||||
fileSystem.file(environment.buildDir.childFile('app.dill')).createSync(recursive: true);
|
||||
fileSystem.file('packages/flutter_tools/lib/src/build_system/targets/assets.dart')
|
||||
@@ -82,7 +81,6 @@ flutter:
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
Platform: () => platform,
|
||||
});
|
||||
|
||||
testUsingContext('Copies files to correct asset directory', () async {
|
||||
@@ -98,7 +96,6 @@ flutter:
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
Platform: () => platform,
|
||||
});
|
||||
|
||||
testUsingContext('Throws exception if pubspec contains missing files', () async {
|
||||
@@ -118,7 +115,6 @@ flutter:
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
Platform: () => platform,
|
||||
});
|
||||
|
||||
testWithoutContext('processSkSLBundle returns null if there is no path '
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/device_port_forwader.dart';
|
||||
import 'package:flutter_tools/src/protocol_discovery.dart';
|
||||
import 'package:fake_async/fake_async.dart';
|
||||
@@ -44,6 +45,7 @@ void main() {
|
||||
hostPort: null,
|
||||
devicePort: devicePort,
|
||||
throttleDuration: throttleDuration,
|
||||
logger: BufferLogger.test(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -280,6 +282,7 @@ void main() {
|
||||
hostPort: null,
|
||||
devicePort: null,
|
||||
ipv6: false,
|
||||
logger: BufferLogger.test(),
|
||||
);
|
||||
|
||||
// Get next port future.
|
||||
@@ -301,6 +304,7 @@ void main() {
|
||||
hostPort: 1243,
|
||||
devicePort: null,
|
||||
ipv6: false,
|
||||
logger: BufferLogger.test(),
|
||||
);
|
||||
|
||||
// Get next port future.
|
||||
@@ -322,6 +326,7 @@ void main() {
|
||||
hostPort: 0,
|
||||
devicePort: null,
|
||||
ipv6: false,
|
||||
logger: BufferLogger.test(),
|
||||
);
|
||||
|
||||
// Get next port future.
|
||||
@@ -343,6 +348,7 @@ void main() {
|
||||
hostPort: 54777,
|
||||
ipv6: true,
|
||||
devicePort: null,
|
||||
logger: BufferLogger.test(),
|
||||
);
|
||||
|
||||
// Get next port future.
|
||||
@@ -364,6 +370,7 @@ void main() {
|
||||
hostPort: 54777,
|
||||
ipv6: true,
|
||||
devicePort: null,
|
||||
logger: BufferLogger.test(),
|
||||
);
|
||||
|
||||
// Get next port future.
|
||||
|
||||
Reference in New Issue
Block a user