mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Split globals.dart into null sound and unsound libraries (#79016)
This commit is contained in:
parent
dff957fb5c
commit
8ddc27e607
@ -13,7 +13,7 @@ import 'package:flutter_tools/src/cache.dart';
|
|||||||
import 'package:flutter_tools/src/context_runner.dart';
|
import 'package:flutter_tools/src/context_runner.dart';
|
||||||
import 'package:flutter_tools/src/devfs.dart';
|
import 'package:flutter_tools/src/devfs.dart';
|
||||||
import 'package:flutter_tools/src/bundle.dart';
|
import 'package:flutter_tools/src/bundle.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
|
|
||||||
const String _kOptionPackages = 'packages';
|
const String _kOptionPackages = 'packages';
|
||||||
|
@ -10,7 +10,7 @@ import '../base/io.dart';
|
|||||||
import '../base/process.dart';
|
import '../base/process.dart';
|
||||||
import '../base/utils.dart';
|
import '../base/utils.dart';
|
||||||
import '../base/version.dart';
|
import '../base/version.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../ios/plist_parser.dart';
|
import '../ios/plist_parser.dart';
|
||||||
|
|
||||||
AndroidStudio get androidStudio => context.get<AndroidStudio>();
|
AndroidStudio get androidStudio => context.get<AndroidStudio>();
|
||||||
|
@ -12,7 +12,7 @@ import '../base/error_handling_io.dart';
|
|||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../base/logger.dart';
|
import '../base/logger.dart';
|
||||||
import '../base/platform.dart';
|
import '../base/platform.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../template.dart';
|
import '../template.dart';
|
||||||
import 'deferred_components_validator.dart';
|
import 'deferred_components_validator.dart';
|
||||||
|
@ -113,7 +113,7 @@ class AppContext {
|
|||||||
|
|
||||||
/// Gets the value associated with the specified [type], or `null` if no
|
/// Gets the value associated with the specified [type], or `null` if no
|
||||||
/// such value has been associated.
|
/// such value has been associated.
|
||||||
T get<T>() {
|
T? get<T>() {
|
||||||
dynamic value = _generateIfNecessary(T, _overrides);
|
dynamic value = _generateIfNecessary(T, _overrides);
|
||||||
if (value == null && _parent != null) {
|
if (value == null && _parent != null) {
|
||||||
value = _parent!.get<T>();
|
value = _parent!.get<T>();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'context.dart';
|
import 'context.dart';
|
||||||
import 'platform.dart';
|
import 'platform.dart';
|
||||||
|
|
||||||
UserMessages get userMessages => context.get<UserMessages>();
|
UserMessages get userMessages => context.get<UserMessages>()!;
|
||||||
|
|
||||||
/// Class containing message strings that can be produced by Flutter tools.
|
/// Class containing message strings that can be produced by Flutter tools.
|
||||||
class UserMessages {
|
class UserMessages {
|
||||||
|
@ -15,7 +15,7 @@ import 'base/os.dart';
|
|||||||
import 'base/utils.dart';
|
import 'base/utils.dart';
|
||||||
import 'build_system/targets/icon_tree_shaker.dart';
|
import 'build_system/targets/icon_tree_shaker.dart';
|
||||||
import 'convert.dart';
|
import 'convert.dart';
|
||||||
import 'globals.dart' as globals;
|
import 'globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
/// Information about a build to be performed or used.
|
/// Information about a build to be performed or used.
|
||||||
class BuildInfo {
|
class BuildInfo {
|
||||||
|
@ -9,7 +9,7 @@ import '../../base/build.dart';
|
|||||||
import '../../base/deferred_component.dart';
|
import '../../base/deferred_component.dart';
|
||||||
import '../../base/file_system.dart';
|
import '../../base/file_system.dart';
|
||||||
import '../../build_info.dart';
|
import '../../build_info.dart';
|
||||||
import '../../globals.dart' as globals hide fs, artifacts, logger, processManager;
|
import '../../globals.dart' as globals show platform, printError, xcode;
|
||||||
import '../../project.dart';
|
import '../../project.dart';
|
||||||
import '../build_system.dart';
|
import '../build_system.dart';
|
||||||
import '../depfile.dart';
|
import '../depfile.dart';
|
||||||
|
@ -12,7 +12,7 @@ import '../../base/file_system.dart';
|
|||||||
import '../../build_info.dart';
|
import '../../build_info.dart';
|
||||||
import '../../compile.dart';
|
import '../../compile.dart';
|
||||||
import '../../dart/package_map.dart';
|
import '../../dart/package_map.dart';
|
||||||
import '../../globals.dart' as globals hide fs, processManager, artifacts, logger;
|
import '../../globals.dart' as globals show xcode;
|
||||||
import '../build_system.dart';
|
import '../build_system.dart';
|
||||||
import '../depfile.dart';
|
import '../depfile.dart';
|
||||||
import '../exceptions.dart';
|
import '../exceptions.dart';
|
||||||
|
@ -12,7 +12,7 @@ import '../../base/common.dart';
|
|||||||
import '../../base/file_system.dart';
|
import '../../base/file_system.dart';
|
||||||
import '../../base/io.dart';
|
import '../../base/io.dart';
|
||||||
import '../../build_info.dart';
|
import '../../build_info.dart';
|
||||||
import '../../globals.dart' as globals hide fs, logger, processManager, artifacts;
|
import '../../globals.dart' as globals show xcode;
|
||||||
import '../../macos/xcode.dart';
|
import '../../macos/xcode.dart';
|
||||||
import '../../project.dart';
|
import '../../project.dart';
|
||||||
import '../build_system.dart';
|
import '../build_system.dart';
|
||||||
|
@ -10,7 +10,7 @@ import '../../base/file_system.dart';
|
|||||||
import '../../base/io.dart';
|
import '../../base/io.dart';
|
||||||
import '../../base/process.dart';
|
import '../../base/process.dart';
|
||||||
import '../../build_info.dart';
|
import '../../build_info.dart';
|
||||||
import '../../globals.dart' as globals hide fs, logger, artifacts, processManager;
|
import '../../globals.dart' as globals show xcode;
|
||||||
import '../build_system.dart';
|
import '../build_system.dart';
|
||||||
import '../depfile.dart';
|
import '../depfile.dart';
|
||||||
import '../exceptions.dart';
|
import '../exceptions.dart';
|
||||||
|
@ -18,7 +18,7 @@ import '../base/terminal.dart';
|
|||||||
import '../base/utils.dart';
|
import '../base/utils.dart';
|
||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../dart/analysis.dart';
|
import '../dart/analysis.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
/// Common behavior for `flutter analyze` and `flutter analyze --watch`
|
/// Common behavior for `flutter analyze` and `flutter analyze --watch`
|
||||||
abstract class AnalyzeBase {
|
abstract class AnalyzeBase {
|
||||||
|
@ -8,7 +8,7 @@ import '../base/common.dart';
|
|||||||
import '../build_info.dart';
|
import '../build_info.dart';
|
||||||
import '../bundle.dart';
|
import '../bundle.dart';
|
||||||
import '../features.dart';
|
import '../features.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../reporting/reporting.dart';
|
import '../reporting/reporting.dart';
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
|
@ -12,7 +12,7 @@ import '../cache.dart';
|
|||||||
import '../features.dart';
|
import '../features.dart';
|
||||||
import '../fuchsia/fuchsia_build.dart';
|
import '../fuchsia/fuchsia_build.dart';
|
||||||
import '../fuchsia/fuchsia_pm.dart';
|
import '../fuchsia/fuchsia_pm.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
||||||
import 'build.dart';
|
import 'build.dart';
|
||||||
|
@ -10,7 +10,7 @@ import '../base/common.dart';
|
|||||||
import '../build_info.dart';
|
import '../build_info.dart';
|
||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../features.dart';
|
import '../features.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
||||||
import '../windows/build_windows.dart';
|
import '../windows/build_windows.dart';
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// @dart = 2.8
|
// @dart = 2.8
|
||||||
|
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
|
|
||||||
class GenerateCommand extends FlutterCommand {
|
class GenerateCommand extends FlutterCommand {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
import '../base/common.dart';
|
import '../base/common.dart';
|
||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../base/logger.dart';
|
import '../base/logger.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../localizations/gen_l10n.dart';
|
import '../localizations/gen_l10n.dart';
|
||||||
import '../localizations/gen_l10n_types.dart';
|
import '../localizations/gen_l10n_types.dart';
|
||||||
import '../localizations/localizations_utils.dart';
|
import '../localizations/localizations_utils.dart';
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
import '../base/common.dart';
|
import '../base/common.dart';
|
||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
import '../template.dart';
|
import '../template.dart';
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import '../application_package.dart';
|
|||||||
import '../base/common.dart';
|
import '../base/common.dart';
|
||||||
import '../base/io.dart';
|
import '../base/io.dart';
|
||||||
import '../device.dart';
|
import '../device.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
|
|
||||||
class InstallCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
class InstallCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
||||||
|
@ -10,7 +10,7 @@ import '../base/common.dart';
|
|||||||
import '../base/io.dart';
|
import '../base/io.dart';
|
||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../device.dart';
|
import '../device.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
|
|
||||||
class LogsCommand extends FlutterCommand {
|
class LogsCommand extends FlutterCommand {
|
||||||
|
@ -10,7 +10,7 @@ import '../base/common.dart';
|
|||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../convert.dart';
|
import '../convert.dart';
|
||||||
import '../device.dart';
|
import '../device.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
import '../vmservice.dart';
|
import '../vmservice.dart';
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import 'package:completion/completion.dart';
|
|||||||
|
|
||||||
import '../base/common.dart';
|
import '../base/common.dart';
|
||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
|
|
||||||
class ShellCompletionCommand extends FlutterCommand {
|
class ShellCompletionCommand extends FlutterCommand {
|
||||||
|
@ -16,7 +16,7 @@ import '../bundle.dart';
|
|||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../devfs.dart';
|
import '../devfs.dart';
|
||||||
import '../device.dart';
|
import '../device.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
import '../test/coverage_collector.dart';
|
import '../test/coverage_collector.dart';
|
||||||
|
@ -15,7 +15,7 @@ import '../base/logger.dart';
|
|||||||
import '../base/net.dart';
|
import '../base/net.dart';
|
||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../dart/pub.dart';
|
import '../dart/pub.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
|
|
||||||
/// Map from package name to package version, used to artificially pin a pub
|
/// Map from package name to package version, used to artificially pin a pub
|
||||||
|
@ -9,7 +9,7 @@ import 'package:meta/meta.dart';
|
|||||||
import '../application_package.dart';
|
import '../application_package.dart';
|
||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../build_info.dart';
|
import '../build_info.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
|
|
||||||
abstract class FuchsiaApp extends ApplicationPackage {
|
abstract class FuchsiaApp extends ApplicationPackage {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// @dart = 2.8
|
// @dart = 2.8
|
||||||
|
|
||||||
import '../base/process.dart';
|
import '../base/process.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import 'fuchsia_device.dart';
|
import 'fuchsia_device.dart';
|
||||||
|
|
||||||
|
@ -4,35 +4,21 @@
|
|||||||
|
|
||||||
// @dart = 2.8
|
// @dart = 2.8
|
||||||
|
|
||||||
import 'package:process/process.dart';
|
|
||||||
|
|
||||||
import 'android/android_sdk.dart';
|
import 'android/android_sdk.dart';
|
||||||
import 'android/android_studio.dart';
|
import 'android/android_studio.dart';
|
||||||
import 'android/gradle_utils.dart';
|
import 'android/gradle_utils.dart';
|
||||||
import 'artifacts.dart';
|
import 'artifacts.dart';
|
||||||
import 'base/bot_detector.dart';
|
import 'base/bot_detector.dart';
|
||||||
import 'base/config.dart';
|
|
||||||
import 'base/context.dart';
|
import 'base/context.dart';
|
||||||
import 'base/error_handling_io.dart';
|
|
||||||
import 'base/file_system.dart';
|
|
||||||
import 'base/io.dart';
|
import 'base/io.dart';
|
||||||
import 'base/logger.dart';
|
|
||||||
import 'base/net.dart';
|
import 'base/net.dart';
|
||||||
import 'base/os.dart';
|
|
||||||
import 'base/platform.dart';
|
|
||||||
import 'base/process.dart';
|
|
||||||
import 'base/signals.dart';
|
|
||||||
import 'base/template.dart';
|
|
||||||
import 'base/terminal.dart';
|
|
||||||
import 'base/time.dart';
|
|
||||||
import 'base/user_messages.dart';
|
|
||||||
import 'build_system/build_system.dart';
|
import 'build_system/build_system.dart';
|
||||||
import 'cache.dart';
|
import 'cache.dart';
|
||||||
import 'device.dart';
|
import 'device.dart';
|
||||||
import 'doctor.dart';
|
import 'doctor.dart';
|
||||||
import 'fuchsia/fuchsia_sdk.dart';
|
import 'fuchsia/fuchsia_sdk.dart';
|
||||||
|
import 'globals_null_migrated.dart' as globals;
|
||||||
import 'ios/ios_workflow.dart';
|
import 'ios/ios_workflow.dart';
|
||||||
import 'ios/plist_parser.dart';
|
|
||||||
import 'ios/simulators.dart';
|
import 'ios/simulators.dart';
|
||||||
import 'ios/xcodeproj.dart';
|
import 'ios/xcodeproj.dart';
|
||||||
import 'macos/cocoapods.dart';
|
import 'macos/cocoapods.dart';
|
||||||
@ -44,24 +30,21 @@ import 'reporting/reporting.dart';
|
|||||||
import 'runner/local_engine.dart';
|
import 'runner/local_engine.dart';
|
||||||
import 'version.dart';
|
import 'version.dart';
|
||||||
|
|
||||||
|
export 'globals_null_migrated.dart';
|
||||||
|
|
||||||
Artifacts get artifacts => context.get<Artifacts>();
|
Artifacts get artifacts => context.get<Artifacts>();
|
||||||
BuildSystem get buildSystem => context.get<BuildSystem>();
|
BuildSystem get buildSystem => context.get<BuildSystem>();
|
||||||
Cache get cache => context.get<Cache>();
|
Cache get cache => context.get<Cache>();
|
||||||
Config get config => context.get<Config>();
|
|
||||||
CrashReporter get crashReporter => context.get<CrashReporter>();
|
CrashReporter get crashReporter => context.get<CrashReporter>();
|
||||||
Doctor get doctor => context.get<Doctor>();
|
Doctor get doctor => context.get<Doctor>();
|
||||||
HttpClientFactory get httpClientFactory => context.get<HttpClientFactory>();
|
|
||||||
Logger get logger => context.get<Logger>();
|
|
||||||
OperatingSystemUtils get os => context.get<OperatingSystemUtils>();
|
|
||||||
PersistentToolState get persistentToolState => PersistentToolState.instance;
|
PersistentToolState get persistentToolState => PersistentToolState.instance;
|
||||||
Signals get signals => context.get<Signals>() ?? LocalSignals.instance;
|
|
||||||
Usage get flutterUsage => context.get<Usage>();
|
Usage get flutterUsage => context.get<Usage>();
|
||||||
DeviceManager get deviceManager => context.get<DeviceManager>();
|
DeviceManager get deviceManager => context.get<DeviceManager>();
|
||||||
|
|
||||||
FlutterProjectFactory get projectFactory {
|
FlutterProjectFactory get projectFactory {
|
||||||
return context.get<FlutterProjectFactory>() ?? FlutterProjectFactory(
|
return context.get<FlutterProjectFactory>() ?? FlutterProjectFactory(
|
||||||
logger: logger,
|
logger: globals.logger,
|
||||||
fileSystem: fs,
|
fileSystem: globals.fs,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,30 +52,6 @@ CocoaPodsValidator get cocoapodsValidator => context.get<CocoaPodsValidator>();
|
|||||||
|
|
||||||
LocalEngineLocator get localEngineLocator => context.get<LocalEngineLocator>();
|
LocalEngineLocator get localEngineLocator => context.get<LocalEngineLocator>();
|
||||||
|
|
||||||
/// Currently active implementation of the file system.
|
|
||||||
///
|
|
||||||
/// By default it uses local disk-based implementation. Override this in tests
|
|
||||||
/// with [MemoryFileSystem].
|
|
||||||
FileSystem get fs => ErrorHandlingFileSystem(
|
|
||||||
delegate: context.get<FileSystem>() ?? localFileSystem,
|
|
||||||
platform: platform,
|
|
||||||
);
|
|
||||||
|
|
||||||
FileSystemUtils get fsUtils => context.get<FileSystemUtils>() ?? FileSystemUtils(
|
|
||||||
fileSystem: fs,
|
|
||||||
platform: platform,
|
|
||||||
);
|
|
||||||
|
|
||||||
const ProcessManager _kLocalProcessManager = LocalProcessManager();
|
|
||||||
|
|
||||||
/// The active process manager.
|
|
||||||
ProcessManager get processManager => context.get<ProcessManager>() ?? _kLocalProcessManager;
|
|
||||||
ProcessUtils get processUtils => context.get<ProcessUtils>();
|
|
||||||
|
|
||||||
const Platform _kLocalPlatform = LocalPlatform();
|
|
||||||
|
|
||||||
Platform get platform => context.get<Platform>() ?? _kLocalPlatform;
|
|
||||||
|
|
||||||
AndroidStudio get androidStudio => context.get<AndroidStudio>();
|
AndroidStudio get androidStudio => context.get<AndroidStudio>();
|
||||||
AndroidSdk get androidSdk => context.get<AndroidSdk>();
|
AndroidSdk get androidSdk => context.get<AndroidSdk>();
|
||||||
CocoaPods get cocoaPods => context.get<CocoaPods>();
|
CocoaPods get cocoaPods => context.get<CocoaPods>();
|
||||||
@ -100,22 +59,14 @@ FlutterVersion get flutterVersion => context.get<FlutterVersion>();
|
|||||||
FuchsiaArtifacts get fuchsiaArtifacts => context.get<FuchsiaArtifacts>();
|
FuchsiaArtifacts get fuchsiaArtifacts => context.get<FuchsiaArtifacts>();
|
||||||
IOSSimulatorUtils get iosSimulatorUtils => context.get<IOSSimulatorUtils>();
|
IOSSimulatorUtils get iosSimulatorUtils => context.get<IOSSimulatorUtils>();
|
||||||
IOSWorkflow get iosWorkflow => context.get<IOSWorkflow>();
|
IOSWorkflow get iosWorkflow => context.get<IOSWorkflow>();
|
||||||
UserMessages get userMessages => context.get<UserMessages>();
|
|
||||||
Xcode get xcode => context.get<Xcode>();
|
Xcode get xcode => context.get<Xcode>();
|
||||||
XcodeProjectInterpreter get xcodeProjectInterpreter => context.get<XcodeProjectInterpreter>();
|
XcodeProjectInterpreter get xcodeProjectInterpreter => context.get<XcodeProjectInterpreter>();
|
||||||
|
|
||||||
XCDevice get xcdevice => context.get<XCDevice>();
|
XCDevice get xcdevice => context.get<XCDevice>();
|
||||||
|
|
||||||
final OutputPreferences _default = OutputPreferences(
|
|
||||||
wrapText: stdio.hasTerminal ?? false,
|
|
||||||
showColor: platform.stdoutSupportsAnsi,
|
|
||||||
stdio: stdio,
|
|
||||||
);
|
|
||||||
OutputPreferences get outputPreferences => context.get<OutputPreferences>() ?? _default;
|
|
||||||
|
|
||||||
final BotDetector _defaultBotDetector = BotDetector(
|
final BotDetector _defaultBotDetector = BotDetector(
|
||||||
httpClientFactory: context.get<HttpClientFactory>() ?? () => HttpClient(),
|
httpClientFactory: context.get<HttpClientFactory>() ?? () => HttpClient(),
|
||||||
platform: platform,
|
platform: globals.platform,
|
||||||
persistentToolState: persistentToolState,
|
persistentToolState: persistentToolState,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -123,105 +74,5 @@ BotDetector get botDetector => context.get<BotDetector>() ?? _defaultBotDetector
|
|||||||
|
|
||||||
Future<bool> get isRunningOnBot => botDetector.isRunningOnBot;
|
Future<bool> get isRunningOnBot => botDetector.isRunningOnBot;
|
||||||
|
|
||||||
/// The current system clock instance.
|
|
||||||
SystemClock get systemClock => context.get<SystemClock>();
|
|
||||||
|
|
||||||
ProcessInfo get processInfo => context.get<ProcessInfo>();
|
|
||||||
|
|
||||||
/// Display an error level message to the user. Commands should use this if they
|
|
||||||
/// fail in some way.
|
|
||||||
///
|
|
||||||
/// Set [emphasis] to true to make the output bold if it's supported.
|
|
||||||
/// Set [color] to a [TerminalColor] to color the output, if the logger
|
|
||||||
/// supports it. The [color] defaults to [TerminalColor.red].
|
|
||||||
void printError(
|
|
||||||
String message, {
|
|
||||||
StackTrace stackTrace,
|
|
||||||
bool emphasis,
|
|
||||||
TerminalColor color,
|
|
||||||
int indent,
|
|
||||||
int hangingIndent,
|
|
||||||
bool wrap,
|
|
||||||
}) {
|
|
||||||
logger.printError(
|
|
||||||
message,
|
|
||||||
stackTrace: stackTrace,
|
|
||||||
emphasis: emphasis ?? false,
|
|
||||||
color: color,
|
|
||||||
indent: indent,
|
|
||||||
hangingIndent: hangingIndent,
|
|
||||||
wrap: wrap,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Display normal output of the command. This should be used for things like
|
|
||||||
/// progress messages, success messages, or just normal command output.
|
|
||||||
///
|
|
||||||
/// Set `emphasis` to true to make the output bold if it's supported.
|
|
||||||
///
|
|
||||||
/// Set `newline` to false to skip the trailing linefeed.
|
|
||||||
///
|
|
||||||
/// If `indent` is provided, each line of the message will be prepended by the
|
|
||||||
/// specified number of whitespaces.
|
|
||||||
void printStatus(
|
|
||||||
String message, {
|
|
||||||
bool emphasis,
|
|
||||||
bool newline,
|
|
||||||
TerminalColor color,
|
|
||||||
int indent,
|
|
||||||
int hangingIndent,
|
|
||||||
bool wrap,
|
|
||||||
}) {
|
|
||||||
logger.printStatus(
|
|
||||||
message,
|
|
||||||
emphasis: emphasis ?? false,
|
|
||||||
color: color,
|
|
||||||
newline: newline ?? true,
|
|
||||||
indent: indent,
|
|
||||||
hangingIndent: hangingIndent,
|
|
||||||
wrap: wrap,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Use this for verbose tracing output. Users can turn this output on in order
|
|
||||||
/// to help diagnose issues with the toolchain or with their setup.
|
|
||||||
void printTrace(String message) => logger.printTrace(message);
|
|
||||||
|
|
||||||
AnsiTerminal get terminal {
|
|
||||||
return context?.get<AnsiTerminal>() ?? _defaultAnsiTerminal;
|
|
||||||
}
|
|
||||||
|
|
||||||
final AnsiTerminal _defaultAnsiTerminal = AnsiTerminal(
|
|
||||||
stdio: stdio,
|
|
||||||
platform: platform,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// The global Stdio wrapper.
|
|
||||||
Stdio get stdio => context.get<Stdio>() ?? (_stdioInstance ??= Stdio());
|
|
||||||
Stdio _stdioInstance;
|
|
||||||
|
|
||||||
PlistParser get plistParser => context.get<PlistParser>() ?? (
|
|
||||||
_plistInstance ??= PlistParser(
|
|
||||||
fileSystem: fs,
|
|
||||||
processManager: processManager,
|
|
||||||
logger: logger,
|
|
||||||
));
|
|
||||||
PlistParser _plistInstance;
|
|
||||||
|
|
||||||
/// The global template renderer.
|
|
||||||
TemplateRenderer get templateRenderer => context.get<TemplateRenderer>();
|
|
||||||
|
|
||||||
/// Gradle utils in the current [AppContext].
|
/// Gradle utils in the current [AppContext].
|
||||||
GradleUtils get gradleUtils => context.get<GradleUtils>();
|
GradleUtils get gradleUtils => context.get<GradleUtils>();
|
||||||
|
|
||||||
ShutdownHooks get shutdownHooks => context.get<ShutdownHooks>();
|
|
||||||
|
|
||||||
// Unless we're in a test of this class's signal handling features, we must
|
|
||||||
// have only one instance created with the singleton LocalSignals instance
|
|
||||||
// and the catchable signals it considers to be fatal.
|
|
||||||
LocalFileSystem _instance;
|
|
||||||
LocalFileSystem get localFileSystem => _instance ??= LocalFileSystem(
|
|
||||||
LocalSignals.instance,
|
|
||||||
Signals.defaultExitSignals,
|
|
||||||
shutdownHooks,
|
|
||||||
);
|
|
||||||
|
161
packages/flutter_tools/lib/src/globals_null_migrated.dart
Normal file
161
packages/flutter_tools/lib/src/globals_null_migrated.dart
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
|
import 'base/config.dart';
|
||||||
|
import 'base/context.dart';
|
||||||
|
import 'base/error_handling_io.dart';
|
||||||
|
import 'base/file_system.dart';
|
||||||
|
import 'base/io.dart';
|
||||||
|
import 'base/logger.dart';
|
||||||
|
import 'base/net.dart';
|
||||||
|
import 'base/os.dart';
|
||||||
|
import 'base/platform.dart';
|
||||||
|
import 'base/process.dart';
|
||||||
|
import 'base/signals.dart';
|
||||||
|
import 'base/template.dart';
|
||||||
|
import 'base/terminal.dart';
|
||||||
|
import 'base/time.dart';
|
||||||
|
import 'base/user_messages.dart';
|
||||||
|
import 'ios/plist_parser.dart';
|
||||||
|
|
||||||
|
Config get config => context.get<Config>()!;
|
||||||
|
HttpClientFactory get httpClientFactory => context.get<HttpClientFactory>()!;
|
||||||
|
Logger get logger => context.get<Logger>()!;
|
||||||
|
OperatingSystemUtils get os => context.get<OperatingSystemUtils>()!;
|
||||||
|
Signals get signals => context.get<Signals>() ?? LocalSignals.instance;
|
||||||
|
|
||||||
|
/// Currently active implementation of the file system.
|
||||||
|
///
|
||||||
|
/// By default it uses local disk-based implementation. Override this in tests
|
||||||
|
/// with [MemoryFileSystem].
|
||||||
|
FileSystem get fs => ErrorHandlingFileSystem(
|
||||||
|
delegate: context.get<FileSystem>() ?? localFileSystem,
|
||||||
|
platform: platform,
|
||||||
|
);
|
||||||
|
|
||||||
|
FileSystemUtils get fsUtils => context.get<FileSystemUtils>() ?? FileSystemUtils(
|
||||||
|
fileSystem: fs,
|
||||||
|
platform: platform,
|
||||||
|
);
|
||||||
|
|
||||||
|
const ProcessManager _kLocalProcessManager = LocalProcessManager();
|
||||||
|
|
||||||
|
/// The active process manager.
|
||||||
|
ProcessManager get processManager => context.get<ProcessManager>() ?? _kLocalProcessManager;
|
||||||
|
ProcessUtils get processUtils => context.get<ProcessUtils>()!;
|
||||||
|
|
||||||
|
const Platform _kLocalPlatform = LocalPlatform();
|
||||||
|
Platform get platform => context.get<Platform>() ?? _kLocalPlatform;
|
||||||
|
|
||||||
|
UserMessages get userMessages => context.get<UserMessages>()!;
|
||||||
|
|
||||||
|
final OutputPreferences _default = OutputPreferences(
|
||||||
|
wrapText: stdio.hasTerminal,
|
||||||
|
showColor: platform.stdoutSupportsAnsi,
|
||||||
|
stdio: stdio,
|
||||||
|
);
|
||||||
|
OutputPreferences get outputPreferences => context.get<OutputPreferences>() ?? _default;
|
||||||
|
|
||||||
|
/// The current system clock instance.
|
||||||
|
SystemClock get systemClock => context.get<SystemClock>() ?? _systemClock;
|
||||||
|
SystemClock _systemClock = const SystemClock();
|
||||||
|
|
||||||
|
ProcessInfo get processInfo => context.get<ProcessInfo>()!;
|
||||||
|
|
||||||
|
/// Display an error level message to the user. Commands should use this if they
|
||||||
|
/// fail in some way.
|
||||||
|
///
|
||||||
|
/// Set [emphasis] to true to make the output bold if it's supported.
|
||||||
|
/// Set [color] to a [TerminalColor] to color the output, if the logger
|
||||||
|
/// supports it. The [color] defaults to [TerminalColor.red].
|
||||||
|
void printError(
|
||||||
|
String message, {
|
||||||
|
StackTrace? stackTrace,
|
||||||
|
bool? emphasis,
|
||||||
|
TerminalColor? color,
|
||||||
|
int? indent,
|
||||||
|
int? hangingIndent,
|
||||||
|
bool? wrap,
|
||||||
|
}) {
|
||||||
|
logger.printError(
|
||||||
|
message,
|
||||||
|
stackTrace: stackTrace,
|
||||||
|
emphasis: emphasis ?? false,
|
||||||
|
color: color,
|
||||||
|
indent: indent,
|
||||||
|
hangingIndent: hangingIndent,
|
||||||
|
wrap: wrap,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Display normal output of the command. This should be used for things like
|
||||||
|
/// progress messages, success messages, or just normal command output.
|
||||||
|
///
|
||||||
|
/// Set `emphasis` to true to make the output bold if it's supported.
|
||||||
|
///
|
||||||
|
/// Set `newline` to false to skip the trailing linefeed.
|
||||||
|
///
|
||||||
|
/// If `indent` is provided, each line of the message will be prepended by the
|
||||||
|
/// specified number of whitespaces.
|
||||||
|
void printStatus(
|
||||||
|
String message, {
|
||||||
|
bool? emphasis,
|
||||||
|
bool? newline,
|
||||||
|
TerminalColor? color,
|
||||||
|
int? indent,
|
||||||
|
int? hangingIndent,
|
||||||
|
bool? wrap,
|
||||||
|
}) {
|
||||||
|
logger.printStatus(
|
||||||
|
message,
|
||||||
|
emphasis: emphasis ?? false,
|
||||||
|
color: color,
|
||||||
|
newline: newline ?? true,
|
||||||
|
indent: indent,
|
||||||
|
hangingIndent: hangingIndent,
|
||||||
|
wrap: wrap,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Use this for verbose tracing output. Users can turn this output on in order
|
||||||
|
/// to help diagnose issues with the toolchain or with their setup.
|
||||||
|
void printTrace(String message) => logger.printTrace(message);
|
||||||
|
|
||||||
|
AnsiTerminal get terminal {
|
||||||
|
return context.get<AnsiTerminal>() ?? _defaultAnsiTerminal;
|
||||||
|
}
|
||||||
|
|
||||||
|
final AnsiTerminal _defaultAnsiTerminal = AnsiTerminal(
|
||||||
|
stdio: stdio,
|
||||||
|
platform: platform,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// The global Stdio wrapper.
|
||||||
|
Stdio get stdio => context.get<Stdio>() ?? (_stdioInstance ??= Stdio());
|
||||||
|
Stdio? _stdioInstance;
|
||||||
|
|
||||||
|
PlistParser get plistParser => context.get<PlistParser>() ?? (
|
||||||
|
_plistInstance ??= PlistParser(
|
||||||
|
fileSystem: fs,
|
||||||
|
processManager: processManager,
|
||||||
|
logger: logger,
|
||||||
|
));
|
||||||
|
PlistParser? _plistInstance;
|
||||||
|
|
||||||
|
/// The global template renderer.
|
||||||
|
TemplateRenderer get templateRenderer => context.get<TemplateRenderer>()!;
|
||||||
|
|
||||||
|
ShutdownHooks? get shutdownHooks => context.get<ShutdownHooks>();
|
||||||
|
|
||||||
|
// Unless we're in a test of this class's signal handling features, we must
|
||||||
|
// have only one instance created with the singleton LocalSignals instance
|
||||||
|
// and the catchable signals it considers to be fatal.
|
||||||
|
LocalFileSystem? _instance;
|
||||||
|
LocalFileSystem get localFileSystem => _instance ??= LocalFileSystem(
|
||||||
|
LocalSignals.instance,
|
||||||
|
Signals.defaultExitSignals,
|
||||||
|
shutdownHooks,
|
||||||
|
);
|
@ -10,7 +10,7 @@ import '../application_package.dart';
|
|||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../build_info.dart';
|
import '../build_info.dart';
|
||||||
import '../cmake.dart';
|
import '../cmake.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
|
|
||||||
abstract class LinuxApp extends ApplicationPackage {
|
abstract class LinuxApp extends ApplicationPackage {
|
||||||
|
@ -10,7 +10,7 @@ import '../base/file_system.dart';
|
|||||||
import '../base/logger.dart';
|
import '../base/logger.dart';
|
||||||
import '../convert.dart';
|
import '../convert.dart';
|
||||||
import '../flutter_manifest.dart';
|
import '../flutter_manifest.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import 'gen_l10n_templates.dart';
|
import 'gen_l10n_templates.dart';
|
||||||
import 'gen_l10n_types.dart';
|
import 'gen_l10n_types.dart';
|
||||||
|
@ -11,7 +11,7 @@ import '../base/file_system.dart';
|
|||||||
import '../base/io.dart';
|
import '../base/io.dart';
|
||||||
import '../base/utils.dart';
|
import '../base/utils.dart';
|
||||||
import '../build_info.dart';
|
import '../build_info.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../ios/plist_parser.dart';
|
import '../ios/plist_parser.dart';
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import 'base/common.dart';
|
|||||||
import 'base/file_system.dart';
|
import 'base/file_system.dart';
|
||||||
import 'build_info.dart';
|
import 'build_info.dart';
|
||||||
import 'device.dart';
|
import 'device.dart';
|
||||||
import 'globals.dart' as globals;
|
import 'globals_null_migrated.dart' as globals;
|
||||||
import 'resident_devtools_handler.dart';
|
import 'resident_devtools_handler.dart';
|
||||||
import 'resident_runner.dart';
|
import 'resident_runner.dart';
|
||||||
import 'tracing.dart';
|
import 'tracing.dart';
|
||||||
|
@ -12,7 +12,7 @@ import '../base/file_system.dart';
|
|||||||
import '../base/io.dart';
|
import '../base/io.dart';
|
||||||
import '../base/process.dart';
|
import '../base/process.dart';
|
||||||
import '../base/utils.dart';
|
import '../base/utils.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../vmservice.dart';
|
import '../vmservice.dart';
|
||||||
|
|
||||||
import 'test_device.dart';
|
import 'test_device.dart';
|
||||||
|
@ -19,7 +19,7 @@ import '../compile.dart';
|
|||||||
import '../convert.dart';
|
import '../convert.dart';
|
||||||
import '../dart/language_version.dart';
|
import '../dart/language_version.dart';
|
||||||
import '../device.dart';
|
import '../device.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../test/test_wrapper.dart';
|
import '../test/test_wrapper.dart';
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import '../base/common.dart';
|
|||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../base/io.dart';
|
import '../base/io.dart';
|
||||||
import '../convert.dart';
|
import '../convert.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import 'test_compiler.dart';
|
import 'test_compiler.dart';
|
||||||
import 'test_config.dart';
|
import 'test_config.dart';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import '../base/file_system.dart';
|
|||||||
import '../base/utils.dart';
|
import '../base/utils.dart';
|
||||||
import '../build_info.dart';
|
import '../build_info.dart';
|
||||||
import '../cmake.dart';
|
import '../cmake.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals_null_migrated.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
|
|
||||||
abstract class WindowsApp extends ApplicationPackage {
|
abstract class WindowsApp extends ApplicationPackage {
|
||||||
|
@ -14,7 +14,7 @@ import 'package:flutter_tools/src/cache.dart';
|
|||||||
import 'package:flutter_tools/src/commands/assemble.dart';
|
import 'package:flutter_tools/src/commands/assemble.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/features.dart';
|
import 'package:flutter_tools/src/features.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
@ -18,7 +18,7 @@ import 'package:flutter_tools/src/cache.dart';
|
|||||||
import 'package:flutter_tools/src/commands/attach.dart';
|
import 'package:flutter_tools/src/commands/attach.dart';
|
||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
import 'package:flutter_tools/src/device_port_forwader.dart';
|
import 'package:flutter_tools/src/device_port_forwader.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/ios/devices.dart';
|
import 'package:flutter_tools/src/ios/devices.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/resident_runner.dart';
|
import 'package:flutter_tools/src/resident_runner.dart';
|
||||||
|
@ -35,16 +35,10 @@ void main() {
|
|||||||
group('general', () {
|
group('general', () {
|
||||||
MemoryFileSystem fs;
|
MemoryFileSystem fs;
|
||||||
Directory buildDirectory;
|
Directory buildDirectory;
|
||||||
FlutterProject projectUnderTest;
|
|
||||||
|
|
||||||
setUp(() {
|
FlutterProject setupProjectUnderTest(Directory currentDirectory) {
|
||||||
fs = MemoryFileSystem.test();
|
// This needs to be run within testWithoutContext and not setUp since FlutterProject uses context.
|
||||||
|
final FlutterProject projectUnderTest = FlutterProject.fromDirectory(currentDirectory);
|
||||||
final Directory currentDirectory = fs.currentDirectory;
|
|
||||||
buildDirectory = currentDirectory.childDirectory('build');
|
|
||||||
buildDirectory.createSync(recursive: true);
|
|
||||||
|
|
||||||
projectUnderTest = FlutterProject.fromDirectory(currentDirectory);
|
|
||||||
projectUnderTest.ios.xcodeWorkspace.createSync(recursive: true);
|
projectUnderTest.ios.xcodeWorkspace.createSync(recursive: true);
|
||||||
projectUnderTest.macos.xcodeWorkspace.createSync(recursive: true);
|
projectUnderTest.macos.xcodeWorkspace.createSync(recursive: true);
|
||||||
|
|
||||||
@ -65,9 +59,20 @@ void main() {
|
|||||||
projectUnderTest.windows.ephemeralDirectory.createSync(recursive: true);
|
projectUnderTest.windows.ephemeralDirectory.createSync(recursive: true);
|
||||||
projectUnderTest.flutterPluginsFile.createSync(recursive: true);
|
projectUnderTest.flutterPluginsFile.createSync(recursive: true);
|
||||||
projectUnderTest.flutterPluginsDependenciesFile.createSync(recursive: true);
|
projectUnderTest.flutterPluginsDependenciesFile.createSync(recursive: true);
|
||||||
|
|
||||||
|
return projectUnderTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
setUp(() {
|
||||||
|
fs = MemoryFileSystem.test();
|
||||||
|
|
||||||
|
final Directory currentDirectory = fs.currentDirectory;
|
||||||
|
buildDirectory = currentDirectory.childDirectory('build');
|
||||||
|
buildDirectory.createSync(recursive: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('$CleanCommand removes build and .dart_tool and ephemeral directories, cleans Xcode', () async {
|
testUsingContext('$CleanCommand removes build and .dart_tool and ephemeral directories, cleans Xcode', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest(fs.currentDirectory);
|
||||||
// Xcode is installed and version satisfactory.
|
// Xcode is installed and version satisfactory.
|
||||||
when(mockXcodeProjectInterpreter.isInstalled).thenReturn(true);
|
when(mockXcodeProjectInterpreter.isInstalled).thenReturn(true);
|
||||||
when(mockXcodeProjectInterpreter.majorVersion).thenReturn(1000);
|
when(mockXcodeProjectInterpreter.majorVersion).thenReturn(1000);
|
||||||
@ -102,6 +107,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('$CleanCommand cleans Xcode verbosely', () async {
|
testUsingContext('$CleanCommand cleans Xcode verbosely', () async {
|
||||||
|
setupProjectUnderTest(fs.currentDirectory);
|
||||||
// Xcode is installed and version satisfactory.
|
// Xcode is installed and version satisfactory.
|
||||||
when(mockXcodeProjectInterpreter.isInstalled).thenReturn(true);
|
when(mockXcodeProjectInterpreter.isInstalled).thenReturn(true);
|
||||||
when(mockXcodeProjectInterpreter.majorVersion).thenReturn(1000);
|
when(mockXcodeProjectInterpreter.majorVersion).thenReturn(1000);
|
||||||
|
@ -14,7 +14,7 @@ import 'package:flutter_tools/src/base/file_system.dart';
|
|||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/config.dart';
|
import 'package:flutter_tools/src/commands/config.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
|
@ -11,7 +11,7 @@ import 'package:flutter_tools/src/commands/create.dart';
|
|||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/doctor.dart';
|
import 'package:flutter_tools/src/doctor.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
@ -66,7 +66,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('set template type as usage value', () => testbed.run(() async {
|
testUsingContext('set template type as usage value', () => testbed.run(() async {
|
||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ void main() {
|
|||||||
expect(await command.usageValues, containsPair(CustomDimensions.commandCreateProjectType, 'plugin'));
|
expect(await command.usageValues, containsPair(CustomDimensions.commandCreateProjectType, 'plugin'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('set iOS host language type as usage value', () => testbed.run(() async {
|
testUsingContext('set iOS host language type as usage value', () => testbed.run(() async {
|
||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ void main() {
|
|||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('set Android host language type as usage value', () => testbed.run(() async {
|
testUsingContext('set Android host language type as usage value', () => testbed.run(() async {
|
||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import 'package:flutter_tools/src/base/utils.dart';
|
|||||||
import 'package:flutter_tools/src/commands/daemon.dart';
|
import 'package:flutter_tools/src/commands/daemon.dart';
|
||||||
import 'package:flutter_tools/src/features.dart';
|
import 'package:flutter_tools/src/features.dart';
|
||||||
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
|
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/ios/ios_workflow.dart';
|
import 'package:flutter_tools/src/ios/ios_workflow.dart';
|
||||||
import 'package:flutter_tools/src/resident_runner.dart';
|
import 'package:flutter_tools/src/resident_runner.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
@ -22,7 +22,7 @@ import 'package:flutter_tools/src/commands/doctor.dart';
|
|||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
import 'package:flutter_tools/src/doctor.dart';
|
import 'package:flutter_tools/src/doctor.dart';
|
||||||
import 'package:flutter_tools/src/features.dart';
|
import 'package:flutter_tools/src/features.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:flutter_tools/src/vscode/vscode.dart';
|
import 'package:flutter_tools/src/vscode/vscode.dart';
|
||||||
|
@ -9,7 +9,7 @@ import 'package:flutter_tools/src/base/file_system.dart';
|
|||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/template.dart';
|
import 'package:flutter_tools/src/template.dart';
|
||||||
import 'package:flutter_tools/src/commands/ide_config.dart';
|
import 'package:flutter_tools/src/commands/ide_config.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
@ -12,7 +12,7 @@ import 'package:flutter_tools/src/base/io.dart';
|
|||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/shell_completion.dart';
|
import 'package:flutter_tools/src/commands/shell_completion.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
@ -13,7 +13,7 @@ import 'package:flutter_tools/src/cache.dart';
|
|||||||
import 'package:flutter_tools/src/commands/build_aar.dart';
|
import 'package:flutter_tools/src/commands/build_aar.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
|
@ -16,7 +16,7 @@ import 'package:flutter_tools/src/cache.dart';
|
|||||||
import 'package:flutter_tools/src/commands/build_apk.dart';
|
import 'package:flutter_tools/src/commands/build_apk.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import 'package:flutter_tools/src/base/context.dart';
|
|||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build_appbundle.dart';
|
import 'package:flutter_tools/src/commands/build_appbundle.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
@ -17,7 +17,7 @@ import 'package:flutter_tools/src/features.dart';
|
|||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
@ -8,7 +8,7 @@ import 'package:args/command_runner.dart';
|
|||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/format.dart';
|
import 'package:flutter_tools/src/commands/format.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
@ -10,7 +10,7 @@ import 'package:flutter_tools/src/base/platform.dart';
|
|||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/upgrade.dart';
|
import 'package:flutter_tools/src/commands/upgrade.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/persistent_tool_state.dart';
|
import 'package:flutter_tools/src/persistent_tool_state.dart';
|
||||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
import 'package:flutter_tools/src/version.dart';
|
||||||
|
@ -9,7 +9,7 @@ import 'package:flutter_tools/src/android/android_studio.dart';
|
|||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/base/version.dart';
|
import 'package:flutter_tools/src/base/version.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import 'package:flutter_tools/src/base/io.dart';
|
|||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/base/user_messages.dart';
|
import 'package:flutter_tools/src/base/user_messages.dart';
|
||||||
import 'package:flutter_tools/src/doctor.dart';
|
import 'package:flutter_tools/src/doctor.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
@ -10,7 +10,7 @@ import 'package:flutter_tools/src/android/gradle_errors.dart';
|
|||||||
import 'package:flutter_tools/src/android/gradle_utils.dart';
|
import 'package:flutter_tools/src/android/gradle_utils.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import 'package:flutter_tools/src/base/logger.dart';
|
|||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
@ -17,7 +17,7 @@ import 'package:flutter_tools/src/base/user_messages.dart';
|
|||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/fuchsia/application_package.dart';
|
import 'package:flutter_tools/src/fuchsia/application_package.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/ios/application_package.dart';
|
import 'package:flutter_tools/src/ios/application_package.dart';
|
||||||
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
|
@ -12,7 +12,7 @@ import 'package:file/memory.dart';
|
|||||||
import 'package:flutter_tools/src/asset.dart';
|
import 'package:flutter_tools/src/asset.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
|
@ -12,7 +12,7 @@ import 'package:file/memory.dart';
|
|||||||
import 'package:flutter_tools/src/asset.dart';
|
import 'package:flutter_tools/src/asset.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
|
@ -13,7 +13,7 @@ import 'package:flutter_tools/src/base/file_system.dart';
|
|||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/bundle.dart';
|
import 'package:flutter_tools/src/bundle.dart';
|
||||||
import 'package:flutter_tools/src/devfs.dart';
|
import 'package:flutter_tools/src/devfs.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
|
@ -12,7 +12,7 @@ import 'package:file/memory.dart';
|
|||||||
import 'package:flutter_tools/src/asset.dart';
|
import 'package:flutter_tools/src/asset.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import 'package:flutter_tools/src/asset.dart';
|
import 'package:flutter_tools/src/asset.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/build_system/exceptions.dart';
|
import 'package:flutter_tools/src/build_system/exceptions.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import 'package:flutter_tools/src/build_system/build_system.dart';
|
|||||||
import 'package:flutter_tools/src/build_system/depfile.dart';
|
import 'package:flutter_tools/src/build_system/depfile.dart';
|
||||||
import 'package:flutter_tools/src/build_system/targets/common.dart';
|
import 'package:flutter_tools/src/build_system/targets/common.dart';
|
||||||
import 'package:flutter_tools/src/build_system/targets/web.dart';
|
import 'package:flutter_tools/src/build_system/targets/web.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
import '../../../src/common.dart';
|
import '../../../src/common.dart';
|
||||||
|
@ -10,7 +10,7 @@ import 'package:flutter_tools/src/build_info.dart';
|
|||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/bundle.dart';
|
import 'package:flutter_tools/src/bundle.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
|
@ -11,7 +11,7 @@ import 'package:flutter_tools/src/base/io.dart';
|
|||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/devtools_launcher.dart';
|
import 'package:flutter_tools/src/devtools_launcher.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/persistent_tool_state.dart';
|
import 'package:flutter_tools/src/persistent_tool_state.dart';
|
||||||
import 'package:flutter_tools/src/resident_runner.dart';
|
import 'package:flutter_tools/src/resident_runner.dart';
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import 'package:flutter_tools/src/fuchsia/fuchsia_pm.dart';
|
|||||||
import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart';
|
import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart';
|
||||||
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
|
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
|
||||||
import 'package:flutter_tools/src/fuchsia/tiles_ctl.dart';
|
import 'package:flutter_tools/src/fuchsia/tiles_ctl.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/vmservice.dart';
|
import 'package:flutter_tools/src/vmservice.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
@ -12,7 +12,7 @@ import 'package:flutter_tools/src/base/config.dart';
|
|||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/terminal.dart';
|
import 'package:flutter_tools/src/base/terminal.dart';
|
||||||
import 'package:flutter_tools/src/ios/code_signing.dart';
|
import 'package:flutter_tools/src/ios/code_signing.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
@ -13,7 +13,7 @@ import 'package:flutter_tools/src/build_info.dart';
|
|||||||
import 'package:flutter_tools/src/devfs.dart';
|
import 'package:flutter_tools/src/devfs.dart';
|
||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
import 'package:flutter_tools/src/device_port_forwader.dart';
|
import 'package:flutter_tools/src/device_port_forwader.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/ios/application_package.dart';
|
import 'package:flutter_tools/src/ios/application_package.dart';
|
||||||
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
||||||
import 'package:flutter_tools/src/ios/simulators.dart';
|
import 'package:flutter_tools/src/ios/simulators.dart';
|
||||||
|
@ -13,7 +13,7 @@ import 'package:flutter_tools/src/base/os.dart';
|
|||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/base/utils.dart';
|
import 'package:flutter_tools/src/base/utils.dart';
|
||||||
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/macos/application_package.dart';
|
import 'package:flutter_tools/src/macos/application_package.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ typedef InvokeProcess = Future<ProcessResult> Function();
|
|||||||
void main() {
|
void main() {
|
||||||
FileSystem fileSystem;
|
FileSystem fileSystem;
|
||||||
FakeProcessManager fakeProcessManager;
|
FakeProcessManager fakeProcessManager;
|
||||||
FlutterProject projectUnderTest;
|
|
||||||
CocoaPods cocoaPodsUnderTest;
|
CocoaPods cocoaPodsUnderTest;
|
||||||
BufferLogger logger;
|
BufferLogger logger;
|
||||||
TestUsage usage;
|
TestUsage usage;
|
||||||
@ -58,14 +57,19 @@ void main() {
|
|||||||
)).createSync(recursive: true);
|
)).createSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlutterProject setupProjectUnderTest() {
|
||||||
|
// This needs to be run within testWithoutContext and not setUp since FlutterProject uses context.
|
||||||
|
final FlutterProject projectUnderTest = FlutterProject.fromDirectory(fileSystem.directory('project'));
|
||||||
|
projectUnderTest.ios.xcodeProject.createSync(recursive: true);
|
||||||
|
projectUnderTest.macos.xcodeProject.createSync(recursive: true);
|
||||||
|
return projectUnderTest;
|
||||||
|
}
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
Cache.flutterRoot = 'flutter';
|
Cache.flutterRoot = 'flutter';
|
||||||
fileSystem = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]);
|
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]);
|
||||||
logger = BufferLogger.test();
|
logger = BufferLogger.test();
|
||||||
projectUnderTest = FlutterProject.fromDirectory(fileSystem.directory('project'));
|
|
||||||
projectUnderTest.ios.xcodeProject.createSync(recursive: true);
|
|
||||||
projectUnderTest.macos.xcodeProject.createSync(recursive: true);
|
|
||||||
usage = TestUsage();
|
usage = TestUsage();
|
||||||
cocoaPodsUnderTest = CocoaPods(
|
cocoaPodsUnderTest = CocoaPods(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
@ -173,13 +177,15 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('Setup Podfile', () {
|
group('Setup Podfile', () {
|
||||||
testWithoutContext('creates objective-c Podfile when not present', () async {
|
testUsingContext('creates objective-c Podfile when not present', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
await cocoaPodsUnderTest.setupPodfile(projectUnderTest.ios);
|
await cocoaPodsUnderTest.setupPodfile(projectUnderTest.ios);
|
||||||
|
|
||||||
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Objective-C iOS podfile template');
|
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Objective-C iOS podfile template');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('creates swift Podfile if swift', () async {
|
testUsingContext('creates swift Podfile if swift', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
final FakeXcodeProjectInterpreter fakeXcodeProjectInterpreter = FakeXcodeProjectInterpreter(buildSettings: <String, String>{
|
final FakeXcodeProjectInterpreter fakeXcodeProjectInterpreter = FakeXcodeProjectInterpreter(buildSettings: <String, String>{
|
||||||
'SWIFT_VERSION': '5.0',
|
'SWIFT_VERSION': '5.0',
|
||||||
});
|
});
|
||||||
@ -198,14 +204,16 @@ void main() {
|
|||||||
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Swift iOS podfile template');
|
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Swift iOS podfile template');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('creates macOS Podfile when not present', () async {
|
testUsingContext('creates macOS Podfile when not present', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
projectUnderTest.macos.xcodeProject.createSync(recursive: true);
|
projectUnderTest.macos.xcodeProject.createSync(recursive: true);
|
||||||
await cocoaPodsUnderTest.setupPodfile(projectUnderTest.macos);
|
await cocoaPodsUnderTest.setupPodfile(projectUnderTest.macos);
|
||||||
|
|
||||||
expect(projectUnderTest.macos.podfile.readAsStringSync(), 'macOS podfile template');
|
expect(projectUnderTest.macos.podfile.readAsStringSync(), 'macOS podfile template');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('does not recreate Podfile when already present', () async {
|
testUsingContext('does not recreate Podfile when already present', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
|
projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
|
||||||
|
|
||||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.directory('project'));
|
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.directory('project'));
|
||||||
@ -214,7 +222,8 @@ void main() {
|
|||||||
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Existing Podfile');
|
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Existing Podfile');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('does not create Podfile when we cannot interpret Xcode projects', () async {
|
testUsingContext('does not create Podfile when we cannot interpret Xcode projects', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
final CocoaPods cocoaPodsUnderTest = CocoaPods(
|
final CocoaPods cocoaPodsUnderTest = CocoaPods(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
processManager: fakeProcessManager,
|
processManager: fakeProcessManager,
|
||||||
@ -230,7 +239,8 @@ void main() {
|
|||||||
expect(projectUnderTest.ios.podfile.existsSync(), false);
|
expect(projectUnderTest.ios.podfile.existsSync(), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('includes Pod config in xcconfig files, if not present', () async {
|
testUsingContext('includes Pod config in xcconfig files, if not present', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
|
projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
|
||||||
projectUnderTest.ios.xcodeConfigFor('Debug')
|
projectUnderTest.ios.xcodeConfigFor('Debug')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
@ -252,7 +262,8 @@ void main() {
|
|||||||
expect(releaseContents, contains('Existing release config'));
|
expect(releaseContents, contains('Existing release config'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('does not include Pod config in xcconfig files, if legacy non-option include present', () async {
|
testUsingContext('does not include Pod config in xcconfig files, if legacy non-option include present', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
|
projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
|
||||||
|
|
||||||
const String legacyDebugInclude = '#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig';
|
const String legacyDebugInclude = '#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig';
|
||||||
@ -280,6 +291,7 @@ void main() {
|
|||||||
|
|
||||||
group('Update xcconfig', () {
|
group('Update xcconfig', () {
|
||||||
testUsingContext('includes Pod config in xcconfig files, if the user manually added Pod dependencies without using Flutter plugins', () async {
|
testUsingContext('includes Pod config in xcconfig files, if the user manually added Pod dependencies without using Flutter plugins', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
fileSystem.file(fileSystem.path.join('project', 'foo', '.packages'))
|
fileSystem.file(fileSystem.path.join('project', 'foo', '.packages'))
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('\n');
|
..writeAsStringSync('\n');
|
||||||
@ -315,7 +327,8 @@ void main() {
|
|||||||
podsIsInHomeDir();
|
podsIsInHomeDir();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('throwsToolExit if CocoaPods is not installed', () async {
|
testUsingContext('throwsToolExit if CocoaPods is not installed', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsNotInstalled();
|
pretendPodIsNotInstalled();
|
||||||
projectUnderTest.ios.podfile.createSync();
|
projectUnderTest.ios.podfile.createSync();
|
||||||
await expectLater(cocoaPodsUnderTest.processPods(
|
await expectLater(cocoaPodsUnderTest.processPods(
|
||||||
@ -326,7 +339,8 @@ void main() {
|
|||||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('throwsToolExit if CocoaPods install is broken', () async {
|
testUsingContext('throwsToolExit if CocoaPods install is broken', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsBroken();
|
pretendPodIsBroken();
|
||||||
projectUnderTest.ios.podfile.createSync();
|
projectUnderTest.ios.podfile.createSync();
|
||||||
await expectLater(cocoaPodsUnderTest.processPods(
|
await expectLater(cocoaPodsUnderTest.processPods(
|
||||||
@ -337,7 +351,8 @@ void main() {
|
|||||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('exits if Podfile creates the Flutter engine symlink', () async {
|
testUsingContext('exits if Podfile creates the Flutter engine symlink', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync('Existing Podfile');
|
..writeAsStringSync('Existing Podfile');
|
||||||
@ -353,7 +368,8 @@ void main() {
|
|||||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('exits if iOS Podfile parses .flutter-plugins', () async {
|
testUsingContext('exits if iOS Podfile parses .flutter-plugins', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync('plugin_pods = parse_KV_file(\'../.flutter-plugins\')');
|
..writeAsStringSync('plugin_pods = parse_KV_file(\'../.flutter-plugins\')');
|
||||||
@ -365,7 +381,8 @@ void main() {
|
|||||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('prints warning if macOS Podfile parses .flutter-plugins', () async {
|
testUsingContext('prints warning if macOS Podfile parses .flutter-plugins', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
fakeProcessManager.addCommand(
|
fakeProcessManager.addCommand(
|
||||||
@ -388,7 +405,8 @@ void main() {
|
|||||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('throws, if Podfile is missing.', () async {
|
testUsingContext('throws, if Podfile is missing.', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
await expectLater(cocoaPodsUnderTest.processPods(
|
await expectLater(cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
buildMode: BuildMode.debug,
|
buildMode: BuildMode.debug,
|
||||||
@ -396,7 +414,8 @@ void main() {
|
|||||||
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('throws, if specs repo is outdated.', () async {
|
testUsingContext('throws, if specs repo is outdated.', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
||||||
@ -440,7 +459,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('ffi failure on ARM macOS prompts gem install', () async {
|
testUsingContext('ffi failure on ARM macOS prompts gem install', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
||||||
@ -481,7 +501,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
expect(usage.events, contains(const TestUsageEvent('pod-install-failure', 'arm-ffi')));
|
expect(usage.events, contains(const TestUsageEvent('pod-install-failure', 'arm-ffi')));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('ffi failure on x86 macOS does not prompt gem install', () async {
|
testUsingContext('ffi failure on x86 macOS does not prompt gem install', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
||||||
@ -524,7 +545,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
expect(buffer.isEmpty, true);
|
expect(buffer.isEmpty, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('run pod install, if Podfile.lock is missing', () async {
|
testUsingContext('run pod install, if Podfile.lock is missing', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
projectUnderTest.ios.podfile
|
projectUnderTest.ios.podfile
|
||||||
@ -550,7 +572,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('runs iOS pod install, if Manifest.lock is missing', () async {
|
testUsingContext('runs iOS pod install, if Manifest.lock is missing', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
projectUnderTest.ios.podfile
|
projectUnderTest.ios.podfile
|
||||||
@ -575,7 +598,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('runs macOS pod install, if Manifest.lock is missing', () async {
|
testUsingContext('runs macOS pod install, if Manifest.lock is missing', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
projectUnderTest.macos.podfile
|
projectUnderTest.macos.podfile
|
||||||
@ -600,7 +624,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('runs pod install, if Manifest.lock different from Podspec.lock', () async {
|
testUsingContext('runs pod install, if Manifest.lock different from Podspec.lock', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
projectUnderTest.ios.podfile
|
projectUnderTest.ios.podfile
|
||||||
@ -628,7 +653,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('runs pod install, if flutter framework changed', () async {
|
testUsingContext('runs pod install, if flutter framework changed', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
projectUnderTest.ios.podfile
|
projectUnderTest.ios.podfile
|
||||||
@ -656,7 +682,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('runs pod install, if Podfile.lock is older than Podfile', () async {
|
testUsingContext('runs pod install, if Podfile.lock is older than Podfile', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
projectUnderTest.ios.podfile
|
projectUnderTest.ios.podfile
|
||||||
@ -686,7 +713,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('skips pod install, if nothing changed', () async {
|
testUsingContext('skips pod install, if nothing changed', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
projectUnderTest.ios.podfile
|
projectUnderTest.ios.podfile
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync('Existing Podfile');
|
..writeAsStringSync('Existing Podfile');
|
||||||
@ -705,7 +733,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('a failed pod install deletes Pods/Manifest.lock', () async {
|
testUsingContext('a failed pod install deletes Pods/Manifest.lock', () async {
|
||||||
|
final FlutterProject projectUnderTest = setupProjectUnderTest();
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
pretendPodVersionIs('1.10.0');
|
pretendPodVersionIs('1.10.0');
|
||||||
projectUnderTest.ios.podfile
|
projectUnderTest.ios.podfile
|
||||||
|
@ -14,7 +14,7 @@ import 'package:flutter_tools/src/base/platform.dart';
|
|||||||
import 'package:flutter_tools/src/base/time.dart';
|
import 'package:flutter_tools/src/base/time.dart';
|
||||||
import 'package:flutter_tools/src/base/utils.dart';
|
import 'package:flutter_tools/src/base/utils.dart';
|
||||||
import 'package:flutter_tools/src/features.dart';
|
import 'package:flutter_tools/src/features.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
||||||
import 'package:flutter_tools/src/plugins.dart';
|
import 'package:flutter_tools/src/plugins.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
@ -1307,7 +1307,7 @@ flutter:
|
|||||||
projectDir.childFile('pubspec.yaml')..createSync(recursive: true)..writeAsStringSync(yamlString);
|
projectDir.childFile('pubspec.yaml')..createSync(recursive: true)..writeAsStringSync(yamlString);
|
||||||
}
|
}
|
||||||
|
|
||||||
test('validatePubspecForPlugin works', () async {
|
testUsingContext('validatePubspecForPlugin works', () async {
|
||||||
const String pluginYaml = '''
|
const String pluginYaml = '''
|
||||||
flutter:
|
flutter:
|
||||||
plugin:
|
plugin:
|
||||||
@ -1333,7 +1333,7 @@ flutter:
|
|||||||
], androidIdentifier: 'AndroidPackage', webFileName: 'lib/SomeFile.dart');
|
], androidIdentifier: 'AndroidPackage', webFileName: 'lib/SomeFile.dart');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('createPlatformsYamlMap should create the correct map', () async {
|
testUsingContext('createPlatformsYamlMap should create the correct map', () async {
|
||||||
final YamlMap map = Plugin.createPlatformsYamlMap(<String>['ios', 'android', 'linux'], 'PluginClass', 'some.android.package');
|
final YamlMap map = Plugin.createPlatformsYamlMap(<String>['ios', 'android', 'linux'], 'PluginClass', 'some.android.package');
|
||||||
expect(map['ios'], <String, String> {
|
expect(map['ios'], <String, String> {
|
||||||
'pluginClass' : 'PluginClass'
|
'pluginClass' : 'PluginClass'
|
||||||
@ -1347,7 +1347,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('createPlatformsYamlMap should create empty map', () async {
|
testUsingContext('createPlatformsYamlMap should create empty map', () async {
|
||||||
final YamlMap map = Plugin.createPlatformsYamlMap(<String>[], null, null);
|
final YamlMap map = Plugin.createPlatformsYamlMap(<String>[], null, null);
|
||||||
expect(map.isEmpty, true);
|
expect(map.isEmpty, true);
|
||||||
});
|
});
|
||||||
|
@ -8,6 +8,7 @@ import 'package:file/file.dart';
|
|||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
|
import 'package:flutter_tools/src/base/os.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
@ -16,7 +17,7 @@ import 'package:flutter_tools/src/flutter_manifest.dart';
|
|||||||
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
||||||
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
|
||||||
@ -809,10 +810,16 @@ void _testInMemory(String description, Future<void> Function() testMethod) {
|
|||||||
..writeAsStringSync('{"configVersion":2,"packages":[]}');
|
..writeAsStringSync('{"configVersion":2,"packages":[]}');
|
||||||
// Transfer needed parts of the Flutter installation folder
|
// Transfer needed parts of the Flutter installation folder
|
||||||
// to the in-memory file system used during testing.
|
// to the in-memory file system used during testing.
|
||||||
|
final Logger logger = BufferLogger.test();
|
||||||
transfer(Cache(
|
transfer(Cache(
|
||||||
fileSystem: globals.fs,
|
fileSystem: globals.fs,
|
||||||
logger: globals.logger,
|
logger: logger,
|
||||||
osUtils: globals.os,
|
osUtils: OperatingSystemUtils(
|
||||||
|
fileSystem: globals.fs,
|
||||||
|
logger: logger,
|
||||||
|
platform: globals.platform,
|
||||||
|
processManager: globals.processManager,
|
||||||
|
),
|
||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
).getArtifactDirectory('gradle_wrapper'), testFileSystem);
|
).getArtifactDirectory('gradle_wrapper'), testFileSystem);
|
||||||
transfer(globals.fs.directory(Cache.flutterRoot)
|
transfer(globals.fs.directory(Cache.flutterRoot)
|
||||||
@ -840,11 +847,6 @@ void _testInMemory(String description, Future<void> Function() testMethod) {
|
|||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
final FlutterProjectFactory flutterProjectFactory = FlutterProjectFactory(
|
|
||||||
fileSystem: testFileSystem,
|
|
||||||
logger: globals.logger ?? BufferLogger.test(),
|
|
||||||
);
|
|
||||||
|
|
||||||
testUsingContext(
|
testUsingContext(
|
||||||
description,
|
description,
|
||||||
testMethod,
|
testMethod,
|
||||||
@ -853,11 +855,14 @@ void _testInMemory(String description, Future<void> Function() testMethod) {
|
|||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Cache: () => Cache(
|
Cache: () => Cache(
|
||||||
logger: globals.logger,
|
logger: globals.logger,
|
||||||
fileSystem: globals.fs,
|
fileSystem: testFileSystem,
|
||||||
osUtils: globals.os,
|
osUtils: globals.os,
|
||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
),
|
),
|
||||||
FlutterProjectFactory: () => flutterProjectFactory,
|
FlutterProjectFactory: () => FlutterProjectFactory(
|
||||||
|
fileSystem: testFileSystem,
|
||||||
|
logger: globals.logger ?? BufferLogger.test(),
|
||||||
|
),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import 'package:flutter_tools/src/base/context.dart';
|
|||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/error_handling_io.dart';
|
import 'package:flutter_tools/src/base/error_handling_io.dart';
|
||||||
import 'package:flutter_tools/src/base/process.dart';
|
import 'package:flutter_tools/src/base/process.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/testbed.dart';
|
import '../src/testbed.dart';
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/test/flutter_web_goldens.dart';
|
import 'package:flutter_tools/src/test/flutter_web_goldens.dart';
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
|
@ -9,7 +9,7 @@ import 'dart:typed_data';
|
|||||||
|
|
||||||
import 'package:flutter_tools/src/test/flutter_web_goldens.dart';
|
import 'package:flutter_tools/src/test/flutter_web_goldens.dart';
|
||||||
import 'package:flutter_tools/src/test/test_compiler.dart';
|
import 'package:flutter_tools/src/test/test_compiler.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import 'package:flutter_tools/src/compile.dart';
|
|||||||
import 'package:flutter_tools/src/isolated/devfs_web.dart';
|
import 'package:flutter_tools/src/isolated/devfs_web.dart';
|
||||||
import 'package:matcher/matcher.dart';
|
import 'package:matcher/matcher.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/testbed.dart';
|
import '../../src/testbed.dart';
|
||||||
|
@ -51,10 +51,11 @@ void main() {
|
|||||||
.map(_asFile);
|
.map(_asFile);
|
||||||
for (final File file in files) {
|
for (final File file in files) {
|
||||||
for (final String line in file.readAsLinesSync()) {
|
for (final String line in file.readAsLinesSync()) {
|
||||||
if (line.startsWith(RegExp(r'import.*globals.dart'))
|
if ((line.startsWith(RegExp(r'import.*globals.dart')) ||
|
||||||
&& !line.contains(r'as globals')) {
|
line.startsWith(RegExp(r'import.*globals_null_migrated.dart'))) &&
|
||||||
|
!line.contains(r'as globals')) {
|
||||||
final String relativePath = fileSystem.path.relative(file.path, from:flutterTools);
|
final String relativePath = fileSystem.path.relative(file.path, from:flutterTools);
|
||||||
fail('$relativePath imports globals.dart without a globals prefix.');
|
fail('$relativePath imports globals_null_migrated.dart or globals.dart without a globals prefix.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import 'dart:io' as io;
|
|||||||
|
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/android/android_builder.dart';
|
import 'package:flutter_tools/src/android/android_builder.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
|
@ -21,7 +21,7 @@ import 'package:flutter_tools/src/cache.dart';
|
|||||||
import 'package:flutter_tools/src/commands/create.dart';
|
import 'package:flutter_tools/src/commands/create.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/doctor.dart';
|
import 'package:flutter_tools/src/doctor.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||||
import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
|
import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
|
||||||
import 'package:flutter_tools/src/vmservice.dart';
|
import 'package:flutter_tools/src/vmservice.dart';
|
||||||
|
@ -31,7 +31,7 @@ import 'package:flutter_tools/src/persistent_tool_state.dart';
|
|||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import 'package:flutter_tools/src/android/android_sdk.dart' show AndroidSdk;
|
|||||||
import 'package:flutter_tools/src/base/file_system.dart' hide IOSink;
|
import 'package:flutter_tools/src/base/file_system.dart' hide IOSink;
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:flutter_tools/src/ios/devices.dart';
|
import 'package:flutter_tools/src/ios/devices.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import 'package:flutter_tools/src/flutter_manifest.dart';
|
import 'package:flutter_tools/src/flutter_manifest.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:yaml/yaml.dart';
|
import 'package:yaml/yaml.dart';
|
||||||
import 'common.dart';
|
import 'common.dart';
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import 'package:flutter_tools/src/context_runner.dart';
|
|||||||
import 'package:flutter_tools/src/dart/pub.dart';
|
import 'package:flutter_tools/src/dart/pub.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
import 'context.dart';
|
import 'context.dart';
|
||||||
|
@ -5,32 +5,39 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
/// Count the number of libraries that import globals.dart in lib and test.
|
/// Count the number of libraries that import globals_null_migrated.dart and globals.dart in lib and test.
|
||||||
///
|
///
|
||||||
/// This must be run from the flutter_tools project root directory.
|
/// This must be run from the flutter_tools project root directory.
|
||||||
void main() {
|
void main() {
|
||||||
final Directory sources = Directory(path.join(Directory.current.path, 'lib'));
|
final Directory sources = Directory(path.join(Directory.current.path, 'lib'));
|
||||||
final Directory tests = Directory(path.join(Directory.current.path, 'test'));
|
final Directory tests = Directory(path.join(Directory.current.path, 'test'));
|
||||||
final int sourceGlobals = countGlobalImports(sources);
|
countGlobalImports(sources);
|
||||||
final int testGlobals = countGlobalImports(tests);
|
countGlobalImports(tests);
|
||||||
print('lib/ contains $sourceGlobals libraries with global usage');
|
|
||||||
print('test/ contains $testGlobals libraries with global usage');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final RegExp globalImport = RegExp('import.*globals.dart\' as globals;');
|
final RegExp globalImport = RegExp(r"import.*(?:globals|globals_null_migrated)\.dart' as globals;");
|
||||||
|
final RegExp globalNullUnsafeImport = RegExp('import.*globals.dart\' as globals;');
|
||||||
|
|
||||||
int countGlobalImports(Directory directory) {
|
void countGlobalImports(Directory directory) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int nullUnsafeImportCount = 0;
|
||||||
for (final FileSystemEntity file in directory.listSync(recursive: true)) {
|
for (final FileSystemEntity file in directory.listSync(recursive: true)) {
|
||||||
if (!file.path.endsWith('.dart') || file is! File) {
|
if (!file.path.endsWith('.dart') || file is! File) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final bool hasImport = file.readAsLinesSync().any((String line) {
|
final List<String> fileLines = file.readAsLinesSync();
|
||||||
|
final bool hasImport = fileLines.any((String line) {
|
||||||
return globalImport.hasMatch(line);
|
return globalImport.hasMatch(line);
|
||||||
});
|
});
|
||||||
if (hasImport) {
|
if (hasImport) {
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
final bool hasUnsafeImport = fileLines.any((String line) {
|
||||||
|
return globalNullUnsafeImport.hasMatch(line);
|
||||||
|
});
|
||||||
|
if (hasUnsafeImport) {
|
||||||
|
nullUnsafeImportCount += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return count;
|
print('${path.basename(directory.path)} contains $count libraries with global usage ($nullUnsafeImportCount unsafe)');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user