forked from firka/flutter
Migrate a few tool libraries to null safety (#83862)
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:package_config/package_config.dart';
|
||||
|
||||
@@ -30,7 +28,7 @@ class DartPluginRegistrantTarget extends Target {
|
||||
|
||||
DartPluginRegistrantTarget._(this._project);
|
||||
|
||||
final FlutterProject _project;
|
||||
final FlutterProject? _project;
|
||||
|
||||
@override
|
||||
Future<void> build(Environment environment) async {
|
||||
@@ -66,11 +64,11 @@ class DartPluginRegistrantTarget extends Target {
|
||||
if (!environment.generateDartPluginRegistry) {
|
||||
return true;
|
||||
}
|
||||
final String platformName = environment.defines[kTargetPlatform];
|
||||
final String? platformName = environment.defines[kTargetPlatform];
|
||||
if (platformName == null) {
|
||||
return true;
|
||||
}
|
||||
final TargetPlatform targetPlatform = getTargetPlatformForName(platformName);
|
||||
final TargetPlatform? targetPlatform = getTargetPlatformForName(platformName);
|
||||
// TODO(egarciad): Support Android and iOS.
|
||||
// https://github.com/flutter/flutter/issues/52267
|
||||
return targetPlatform != TargetPlatform.darwin &&
|
||||
|
||||
@@ -9,7 +9,6 @@ import 'device.dart';
|
||||
import 'doctor.dart';
|
||||
import 'fuchsia/fuchsia_sdk.dart';
|
||||
import 'ios/simulators.dart';
|
||||
import 'macos/cocoapods_validator.dart';
|
||||
import 'macos/xcdevice.dart';
|
||||
import 'reporting/crash_reporting.dart';
|
||||
import 'runner/local_engine.dart';
|
||||
@@ -20,8 +19,6 @@ CrashReporter get crashReporter => context.get<CrashReporter>();
|
||||
Doctor get doctor => context.get<Doctor>();
|
||||
DeviceManager get deviceManager => context.get<DeviceManager>();
|
||||
|
||||
CocoaPodsValidator get cocoapodsValidator => context.get<CocoaPodsValidator>();
|
||||
|
||||
LocalEngineLocator get localEngineLocator => context.get<LocalEngineLocator>();
|
||||
FuchsiaArtifacts get fuchsiaArtifacts => context.get<FuchsiaArtifacts>();
|
||||
IOSSimulatorUtils get iosSimulatorUtils => context.get<IOSSimulatorUtils>();
|
||||
|
||||
@@ -30,6 +30,7 @@ import 'ios/ios_workflow.dart';
|
||||
import 'ios/plist_parser.dart';
|
||||
import 'ios/xcodeproj.dart';
|
||||
import 'macos/cocoapods.dart';
|
||||
import 'macos/cocoapods_validator.dart';
|
||||
import 'macos/xcode.dart';
|
||||
import 'persistent_tool_state.dart';
|
||||
import 'project.dart';
|
||||
@@ -39,6 +40,7 @@ import 'version.dart';
|
||||
Artifacts? get artifacts => context.get<Artifacts>();
|
||||
BuildSystem? get buildSystem => context.get<BuildSystem>();
|
||||
Cache get cache => context.get<Cache>()!;
|
||||
CocoaPodsValidator? get cocoapodsValidator => context.get<CocoaPodsValidator>();
|
||||
Config get config => context.get<Config>()!;
|
||||
HttpClientFactory? get httpClientFactory => context.get<HttpClientFactory>();
|
||||
Logger get logger => context.get<Logger>()!;
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
import '../application_package.dart';
|
||||
import '../base/file_system.dart';
|
||||
import '../build_info.dart';
|
||||
@@ -14,7 +10,7 @@ import '../globals_null_migrated.dart' as globals;
|
||||
import '../project.dart';
|
||||
|
||||
abstract class LinuxApp extends ApplicationPackage {
|
||||
LinuxApp({@required String projectBundleId}) : super(id: projectBundleId);
|
||||
LinuxApp({required String projectBundleId}) : super(id: projectBundleId);
|
||||
|
||||
/// Creates a new [LinuxApp] from a linux sub project.
|
||||
factory LinuxApp.fromLinuxProject(LinuxProject project) {
|
||||
@@ -40,7 +36,7 @@ abstract class LinuxApp extends ApplicationPackage {
|
||||
|
||||
class PrebuiltLinuxApp extends LinuxApp {
|
||||
PrebuiltLinuxApp({
|
||||
@required String executable,
|
||||
required String executable,
|
||||
}) : _executable = executable,
|
||||
super(projectBundleId: executable);
|
||||
|
||||
@@ -54,13 +50,13 @@ class PrebuiltLinuxApp extends LinuxApp {
|
||||
}
|
||||
|
||||
class BuildableLinuxApp extends LinuxApp {
|
||||
BuildableLinuxApp({this.project}) : super(projectBundleId: project.parent.manifest.appName);
|
||||
BuildableLinuxApp({required this.project}) : super(projectBundleId: project.parent.manifest.appName);
|
||||
|
||||
final LinuxProject project;
|
||||
|
||||
@override
|
||||
String executable(BuildMode buildMode) {
|
||||
final String binaryName = getCmakeExecutableName(project);
|
||||
final String? binaryName = getCmakeExecutableName(project);
|
||||
return globals.fs.path.join(
|
||||
getLinuxBuildDirectory(),
|
||||
getNameForBuildMode(buildMode),
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import '../artifacts.dart';
|
||||
import '../base/analyze_size.dart';
|
||||
import '../base/common.dart';
|
||||
@@ -32,7 +30,7 @@ Future<void> buildLinux(
|
||||
LinuxProject linuxProject,
|
||||
BuildInfo buildInfo, {
|
||||
String target = 'lib/main.dart',
|
||||
SizeAnalyzer sizeAnalyzer,
|
||||
SizeAnalyzer? sizeAnalyzer,
|
||||
bool needCrossBuild = false,
|
||||
TargetPlatform targetPlatform = TargetPlatform.linux_x64,
|
||||
String targetSysroot = '/',
|
||||
@@ -56,13 +54,14 @@ Future<void> buildLinux(
|
||||
// step.
|
||||
final Map<String, String> environmentConfig = buildInfo.toEnvironmentConfig();
|
||||
environmentConfig['FLUTTER_TARGET'] = target;
|
||||
if (globals.artifacts is LocalEngineArtifacts) {
|
||||
final LocalEngineArtifacts localEngineArtifacts = globals.artifacts as LocalEngineArtifacts;
|
||||
final Artifacts? artifacts = globals.artifacts;
|
||||
if (artifacts is LocalEngineArtifacts) {
|
||||
final LocalEngineArtifacts localEngineArtifacts = artifacts;
|
||||
final String engineOutPath = localEngineArtifacts.engineOutPath;
|
||||
environmentConfig['FLUTTER_ENGINE'] = globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath));
|
||||
environmentConfig['LOCAL_ENGINE'] = globals.fs.path.basename(engineOutPath);
|
||||
}
|
||||
writeGeneratedCmakeConfig(Cache.flutterRoot, linuxProject, environmentConfig);
|
||||
writeGeneratedCmakeConfig(Cache.flutterRoot!, linuxProject, environmentConfig);
|
||||
|
||||
createPluginSymlinks(linuxProject.parent);
|
||||
|
||||
@@ -70,7 +69,7 @@ Future<void> buildLinux(
|
||||
'Building Linux application...',
|
||||
);
|
||||
try {
|
||||
final String buildModeName = getNameForBuildMode(buildInfo.mode ?? BuildMode.release);
|
||||
final String buildModeName = getNameForBuildMode(buildInfo.mode);
|
||||
final Directory buildDirectory =
|
||||
globals.fs.directory(getLinuxBuildDirectory(targetPlatform)).childDirectory(buildModeName);
|
||||
await _runCmake(buildModeName, linuxProject.cmakeFile.parent, buildDirectory,
|
||||
@@ -85,7 +84,7 @@ Future<void> buildLinux(
|
||||
.childFile('snapshot.$arch.json');
|
||||
final File precompilerTrace = globals.fs.directory(buildInfo.codeSizeDirectory)
|
||||
.childFile('trace.$arch.json');
|
||||
final Map<String, Object> output = await sizeAnalyzer.analyzeAotSnapshot(
|
||||
final Map<String, Object?> output = await sizeAnalyzer.analyzeAotSnapshot(
|
||||
aotSnapshot: codeSizeFile,
|
||||
// This analysis is only supported for release builds.
|
||||
outputDirectory: globals.fs.directory(
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import '../base/fingerprint.dart';
|
||||
import '../build_info.dart';
|
||||
import '../cache.dart';
|
||||
import '../flutter_plugins.dart';
|
||||
import '../globals.dart' as globals;
|
||||
import '../globals_null_migrated.dart' as globals;
|
||||
import '../project.dart';
|
||||
|
||||
/// For a given build, determines whether dependencies have changed since the
|
||||
@@ -32,7 +30,7 @@ Future<void> processPodsIfNeeded(
|
||||
xcodeProject.podfile.path,
|
||||
xcodeProject.generatedXcodePropertiesFile.path,
|
||||
globals.fs.path.join(
|
||||
Cache.flutterRoot,
|
||||
Cache.flutterRoot!,
|
||||
'packages',
|
||||
'flutter_tools',
|
||||
'bin',
|
||||
@@ -43,11 +41,11 @@ Future<void> processPodsIfNeeded(
|
||||
logger: globals.logger,
|
||||
);
|
||||
|
||||
final bool didPodInstall = await globals.cocoaPods.processPods(
|
||||
final bool didPodInstall = await globals.cocoaPods?.processPods(
|
||||
xcodeProject: xcodeProject,
|
||||
buildMode: buildMode,
|
||||
dependenciesChanged: !fingerprinter.doesFingerprintMatch(),
|
||||
);
|
||||
) == true;
|
||||
if (didPodInstall) {
|
||||
fingerprinter.writeFingerprint();
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import '../base/user_messages.dart';
|
||||
import '../doctor_validator.dart';
|
||||
import 'cocoapods.dart';
|
||||
@@ -32,7 +30,7 @@ class CocoaPodsValidator extends DoctorValidator {
|
||||
|
||||
ValidationType status = ValidationType.installed;
|
||||
if (cocoaPodsStatus == CocoaPodsStatus.recommended) {
|
||||
messages.add(ValidationMessage(_userMessages.cocoaPodsVersion(await _cocoaPods.cocoaPodsVersionText)));
|
||||
messages.add(ValidationMessage(_userMessages.cocoaPodsVersion((await _cocoaPods.cocoaPodsVersionText).toString())));
|
||||
} else {
|
||||
if (cocoaPodsStatus == CocoaPodsStatus.notInstalled) {
|
||||
status = ValidationType.missing;
|
||||
@@ -50,7 +48,7 @@ class CocoaPodsValidator extends DoctorValidator {
|
||||
_userMessages.cocoaPodsUnknownVersion(unknownCocoaPodsConsequence, cocoaPodsInstallInstructions)));
|
||||
} else {
|
||||
status = ValidationType.partial;
|
||||
final String currentVersionText = await _cocoaPods.cocoaPodsVersionText;
|
||||
final String currentVersionText = (await _cocoaPods.cocoaPodsVersionText).toString();
|
||||
messages.add(ValidationMessage.hint(
|
||||
_userMessages.cocoaPodsOutdated(currentVersionText, cocoaPodsRecommendedVersion.toString(), noCocoaPodsConsequence, cocoaPodsInstallInstructions)));
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import '../../base/common.dart';
|
||||
import '../../base/file_system.dart';
|
||||
import '../../base/logger.dart';
|
||||
@@ -38,7 +36,7 @@ class RemoveMacOSFrameworkLinkAndEmbeddingMigration extends ProjectMigrator {
|
||||
}
|
||||
|
||||
@override
|
||||
String migrateLine(String line) {
|
||||
String? migrateLine(String line) {
|
||||
// App.framework Frameworks reference.
|
||||
// isa = PBXFrameworksBuildPhase;
|
||||
// files = (
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import '../base/file_system.dart';
|
||||
import '../base/logger.dart';
|
||||
import '../base/project_migrator.dart';
|
||||
@@ -51,8 +49,8 @@ class CmakeCustomCommandMigration extends ProjectMigrator {
|
||||
final Iterable<RegExpMatch> matches = addCustomCommand.allMatches(originalProjectContents);
|
||||
|
||||
for (final RegExpMatch match in matches) {
|
||||
final String addCustomCommandOriginal = match.group(1);
|
||||
if (addCustomCommandOriginal?.contains('VERBATIM') == false) {
|
||||
final String? addCustomCommandOriginal = match.group(1);
|
||||
if (addCustomCommandOriginal != null && addCustomCommandOriginal.contains('VERBATIM') == false) {
|
||||
final String addCustomCommandReplacement = '$addCustomCommandOriginal\n VERBATIM';
|
||||
newProjectContents = newProjectContents.replaceAll(addCustomCommandOriginal, addCustomCommandReplacement);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:package_config/package_config.dart';
|
||||
|
||||
import '../artifacts.dart';
|
||||
@@ -31,11 +28,11 @@ import '../dart/package_map.dart';
|
||||
/// For more information on local engines, see CONTRIBUTING.md.
|
||||
class LocalEngineLocator {
|
||||
LocalEngineLocator({
|
||||
@required Platform platform,
|
||||
@required Logger logger,
|
||||
@required FileSystem fileSystem,
|
||||
@required String flutterRoot,
|
||||
@required UserMessages userMessages,
|
||||
required Platform platform,
|
||||
required Logger logger,
|
||||
required FileSystem fileSystem,
|
||||
required String flutterRoot,
|
||||
required UserMessages userMessages,
|
||||
}) : _platform = platform,
|
||||
_logger = logger,
|
||||
_fileSystem = fileSystem,
|
||||
@@ -49,7 +46,7 @@ class LocalEngineLocator {
|
||||
final UserMessages _userMessages;
|
||||
|
||||
/// Returns the engine build path of a local engine if one is located, otherwise `null`.
|
||||
Future<EngineBuildPaths> findEnginePath(String engineSourcePath, String localEngine, String packagePath) async {
|
||||
Future<EngineBuildPaths?> findEnginePath(String? engineSourcePath, String? localEngine, String? packagePath) async {
|
||||
engineSourcePath ??= _platform.environment[kFlutterEngineEnvironmentVariableName];
|
||||
|
||||
if (engineSourcePath == null && localEngine != null) {
|
||||
@@ -89,15 +86,15 @@ class LocalEngineLocator {
|
||||
return null;
|
||||
}
|
||||
|
||||
String _findEngineSourceByLocalEngine(String localEngine) {
|
||||
String? _findEngineSourceByLocalEngine(String localEngine) {
|
||||
// When the local engine is an absolute path to a variant inside the
|
||||
// out directory, parse the engine source.
|
||||
// --local-engine /path/to/cache/builder/src/out/host_debug_unopt
|
||||
if (_fileSystem.path.isAbsolute(localEngine)) {
|
||||
final Directory localEngineDirectory = _fileSystem.directory(localEngine);
|
||||
final Directory outDirectory = localEngineDirectory?.parent;
|
||||
final Directory srcDirectory = outDirectory?.parent;
|
||||
if (localEngineDirectory.existsSync() && outDirectory?.basename == 'out' && srcDirectory?.basename == 'src') {
|
||||
final Directory outDirectory = localEngineDirectory.parent;
|
||||
final Directory srcDirectory = outDirectory.parent;
|
||||
if (localEngineDirectory.existsSync() && outDirectory.basename == 'out' && srcDirectory.basename == 'src') {
|
||||
_logger.printTrace('Parsed engine source from local engine as ${srcDirectory.path}.');
|
||||
return srcDirectory.path;
|
||||
}
|
||||
@@ -105,7 +102,7 @@ class LocalEngineLocator {
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<String> _findEngineSourceByPackageConfig(String packagePath) async {
|
||||
Future<String?> _findEngineSourceByPackageConfig(String? packagePath) async {
|
||||
final PackageConfig packageConfig = await loadPackageConfigWithLogging(
|
||||
_fileSystem.file(
|
||||
// TODO(jonahwilliams): update to package_config
|
||||
@@ -115,7 +112,7 @@ class LocalEngineLocator {
|
||||
throwOnError: false,
|
||||
);
|
||||
// Skip if sky_engine is the version in bin/cache.
|
||||
Uri engineUri = packageConfig[kFlutterEnginePackageName]?.packageUriRoot;
|
||||
Uri? engineUri = packageConfig[kFlutterEnginePackageName]?.packageUriRoot;
|
||||
final String cachedPath = _fileSystem.path.join(_flutterRoot, 'bin', 'cache', 'pkg', kFlutterEnginePackageName, 'lib');
|
||||
if (engineUri != null && _fileSystem.identicalSync(cachedPath, engineUri.path)) {
|
||||
_logger.printTrace('Local engine auto-detection sky_engine in $packagePath is the same version in bin/cache.');
|
||||
@@ -125,16 +122,17 @@ class LocalEngineLocator {
|
||||
// determine the engineSourcePath by sky_engine setting. A typical engine Uri
|
||||
// looks like:
|
||||
// file://flutter-engine-local-path/src/out/host_debug_unopt/gen/dart-pkg/sky_engine/lib/
|
||||
String engineSourcePath;
|
||||
if (engineUri?.path != null) {
|
||||
engineSourcePath = _fileSystem.directory(engineUri.path)
|
||||
?.parent
|
||||
?.parent
|
||||
?.parent
|
||||
?.parent
|
||||
?.parent
|
||||
?.parent
|
||||
?.path;
|
||||
String? engineSourcePath;
|
||||
final String? engineUriPath = engineUri?.path;
|
||||
if (engineUriPath != null) {
|
||||
engineSourcePath = _fileSystem.directory(engineUriPath)
|
||||
.parent
|
||||
.parent
|
||||
.parent
|
||||
.parent
|
||||
.parent
|
||||
.parent
|
||||
.path;
|
||||
if (engineSourcePath != null && (engineSourcePath == _fileSystem.path.dirname(engineSourcePath) || engineSourcePath.isEmpty)) {
|
||||
engineSourcePath = null;
|
||||
throwToolExit(
|
||||
@@ -166,7 +164,7 @@ class LocalEngineLocator {
|
||||
return 'host_$tmpBasename';
|
||||
}
|
||||
|
||||
EngineBuildPaths _findEngineBuildPath(String localEngine, String enginePath) {
|
||||
EngineBuildPaths _findEngineBuildPath(String? localEngine, String enginePath) {
|
||||
if (localEngine == null) {
|
||||
throwToolExit(_userMessages.runnerLocalEngineRequired, exitCode: 2);
|
||||
}
|
||||
@@ -188,7 +186,7 @@ class LocalEngineLocator {
|
||||
return EngineBuildPaths(targetEngine: engineBuildPath, hostEngine: engineHostBuildPath);
|
||||
}
|
||||
|
||||
String _tryEnginePath(String enginePath) {
|
||||
String? _tryEnginePath(String enginePath) {
|
||||
if (_fileSystem.isDirectorySync(_fileSystem.path.join(enginePath, 'out'))) {
|
||||
return enginePath;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:process/process.dart';
|
||||
|
||||
import '../artifacts.dart';
|
||||
@@ -21,9 +18,9 @@ import '../base/process.dart';
|
||||
/// apps.
|
||||
class UwpTool {
|
||||
UwpTool({
|
||||
@required Artifacts artifacts,
|
||||
@required Logger logger,
|
||||
@required ProcessManager processManager,
|
||||
required Artifacts artifacts,
|
||||
required Logger logger,
|
||||
required ProcessManager processManager,
|
||||
}) : _artifacts = artifacts,
|
||||
_logger = logger,
|
||||
_processUtils = ProcessUtils(processManager: processManager, logger: logger);
|
||||
@@ -58,7 +55,7 @@ class UwpTool {
|
||||
///
|
||||
/// If no installed application on the system matches the specified package
|
||||
/// name, returns null.
|
||||
Future<String/*?*/> getPackageFamilyName(String packageName) async {
|
||||
Future<String?> getPackageFamilyName(String packageName) async {
|
||||
for (final String packageFamily in await listApps()) {
|
||||
if (packageFamily.startsWith(packageName)) {
|
||||
return packageFamily;
|
||||
@@ -70,7 +67,7 @@ class UwpTool {
|
||||
/// Launches the app with the specified package family name.
|
||||
///
|
||||
/// On success, returns the process ID of the launched app, otherwise null.
|
||||
Future<int/*?*/> launchApp(String packageFamily, List<String> args) async {
|
||||
Future<int?> launchApp(String packageFamily, List<String> args) async {
|
||||
final List<String> launchCommand = <String>[
|
||||
_binaryPath,
|
||||
'launch',
|
||||
@@ -82,7 +79,7 @@ class UwpTool {
|
||||
return null;
|
||||
}
|
||||
// Read the process ID from stdout.
|
||||
final int processId = int.tryParse(result.stdout.trim());
|
||||
final int? processId = int.tryParse(result.stdout.trim());
|
||||
_logger.printTrace('Launched application $packageFamily with process ID $processId');
|
||||
return processId;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:flutter_tools/src/base/user_messages.dart';
|
||||
import 'package:flutter_tools/src/doctor_validator.dart';
|
||||
import 'package:flutter_tools/src/macos/cocoapods.dart';
|
||||
@@ -15,7 +13,7 @@ import '../../src/common.dart';
|
||||
void main() {
|
||||
group('CocoaPods validation', () {
|
||||
testWithoutContext('Emits installed status when CocoaPods is installed', () async {
|
||||
final CocoaPodsValidator workflow = CocoaPodsValidator(FakeCocoaPods(CocoaPodsStatus.recommended), UserMessages());
|
||||
final CocoaPodsValidator workflow = CocoaPodsValidator(FakeCocoaPods(CocoaPodsStatus.recommended, '1000.0.0'), UserMessages());
|
||||
final ValidationResult result = await workflow.validate();
|
||||
expect(result.type, ValidationType.installed);
|
||||
});
|
||||
@@ -55,6 +53,6 @@ class FakeCocoaPods extends Fake implements CocoaPods {
|
||||
final CocoaPodsStatus _evaluateCocoaPodsInstallation;
|
||||
|
||||
@override
|
||||
Future<String> get cocoaPodsVersionText async => _cocoaPodsVersionText;
|
||||
final String _cocoaPodsVersionText;
|
||||
Future<String?> get cocoaPodsVersionText async => _cocoaPodsVersionText;
|
||||
final String? _cocoaPodsVersionText;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
@@ -11,17 +9,16 @@ import 'package:flutter_tools/src/base/project_migrator.dart';
|
||||
import 'package:flutter_tools/src/macos/migrations/remove_macos_framework_link_and_embedding_migration.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:test/fake.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
|
||||
void main() {
|
||||
TestUsage testUsage;
|
||||
MemoryFileSystem memoryFileSystem;
|
||||
BufferLogger testLogger;
|
||||
FakeMacOSProject macOSProject;
|
||||
File xcodeProjectInfoFile;
|
||||
late TestUsage testUsage;
|
||||
late MemoryFileSystem memoryFileSystem;
|
||||
late BufferLogger testLogger;
|
||||
late FakeMacOSProject macOSProject;
|
||||
late File xcodeProjectInfoFile;
|
||||
|
||||
setUp(() {
|
||||
testUsage = TestUsage();
|
||||
@@ -160,11 +157,11 @@ keep this 2
|
||||
|
||||
class FakeMacOSProject extends Fake implements MacOSProject {
|
||||
@override
|
||||
File xcodeProjectInfoFile;
|
||||
File xcodeProjectInfoFile = MemoryFileSystem.test().file('xcodeProjectInfoFile');
|
||||
}
|
||||
|
||||
class FakeMacOSMigrator extends ProjectMigrator {
|
||||
FakeMacOSMigrator({@required this.succeeds}) : super(null);
|
||||
FakeMacOSMigrator({required this.succeeds}) : super(BufferLogger.test());
|
||||
|
||||
final bool succeeds;
|
||||
|
||||
|
||||
@@ -2,17 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/base/project_migrator.dart';
|
||||
import 'package:flutter_tools/src/base/terminal.dart';
|
||||
import 'package:flutter_tools/src/migrations/cmake_custom_command_migration.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:test/fake.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
@@ -32,20 +28,17 @@ void main () {
|
||||
});
|
||||
|
||||
group('migrate add_custom_command() to use VERBATIM', () {
|
||||
MemoryFileSystem memoryFileSystem;
|
||||
BufferLogger testLogger;
|
||||
FakeCmakeProject mockCmakeProject;
|
||||
File managedCmakeFile;
|
||||
late MemoryFileSystem memoryFileSystem;
|
||||
late BufferLogger testLogger;
|
||||
late FakeCmakeProject mockCmakeProject;
|
||||
late File managedCmakeFile;
|
||||
|
||||
setUp(() {
|
||||
memoryFileSystem = MemoryFileSystem.test();
|
||||
managedCmakeFile = memoryFileSystem.file('CMakeLists.txtx');
|
||||
|
||||
testLogger = BufferLogger(
|
||||
terminal: AnsiTerminal(
|
||||
stdio: null,
|
||||
platform: const LocalPlatform(),
|
||||
),
|
||||
terminal: Terminal.test(),
|
||||
outputPreferences: OutputPreferences.test(),
|
||||
);
|
||||
|
||||
@@ -186,8 +179,8 @@ class FakeCmakeProject extends Fake implements CmakeBasedProject {
|
||||
}
|
||||
|
||||
class FakeCmakeMigrator extends ProjectMigrator {
|
||||
FakeCmakeMigrator({@required this.succeeds})
|
||||
: super(null);
|
||||
FakeCmakeMigrator({required this.succeeds})
|
||||
: super(BufferLogger.test());
|
||||
|
||||
final bool succeeds;
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
@@ -246,8 +244,8 @@ void main() {
|
||||
}
|
||||
|
||||
Matcher matchesEngineBuildPaths({
|
||||
String hostEngine,
|
||||
String targetEngine,
|
||||
String? hostEngine,
|
||||
String? targetEngine,
|
||||
}) {
|
||||
return const TypeMatcher<EngineBuildPaths>()
|
||||
.having((EngineBuildPaths paths) => paths.hostEngine, 'hostEngine', hostEngine)
|
||||
|
||||
Reference in New Issue
Block a user