Unverified Commit d1459384 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Migrate flutter_cache to null safety (#85242)

parent 4bd47ce6
......@@ -11,15 +11,12 @@ import 'fuchsia/fuchsia_sdk.dart';
import 'ios/simulators.dart';
import 'macos/xcdevice.dart';
import 'reporting/crash_reporting.dart';
import 'runner/local_engine.dart';
export 'globals_null_migrated.dart';
CrashReporter get crashReporter => context.get<CrashReporter>();
Doctor get doctor => context.get<Doctor>();
DeviceManager get deviceManager => context.get<DeviceManager>();
LocalEngineLocator get localEngineLocator => context.get<LocalEngineLocator>();
FuchsiaArtifacts get fuchsiaArtifacts => context.get<FuchsiaArtifacts>();
IOSSimulatorUtils get iosSimulatorUtils => context.get<IOSSimulatorUtils>();
......
......@@ -35,6 +35,7 @@ import 'macos/xcode.dart';
import 'persistent_tool_state.dart';
import 'project.dart';
import 'reporting/reporting.dart';
import 'runner/local_engine.dart';
import 'version.dart';
/// The flutter GitHub repository.
......@@ -56,6 +57,7 @@ Usage get flutterUsage => context.get<Usage>()!;
XcodeProjectInterpreter? get xcodeProjectInterpreter => context.get<XcodeProjectInterpreter>();
Xcode? get xcode => context.get<Xcode>();
IOSWorkflow? get iosWorkflow => context.get<IOSWorkflow>();
LocalEngineLocator? get localEngineLocator => context.get<LocalEngineLocator>();
PersistentToolState? get persistentToolState => PersistentToolState.instance;
......
......@@ -159,7 +159,11 @@ void main() {
testWithoutContext('Gradle wrapper will delete .properties/NOTICES if they exist', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Cache cache = Cache.test(fileSystem: fileSystem, processManager: FakeProcessManager.any());
final Directory artifactDir = fileSystem.systemTempDirectory.createTempSync('flutter_cache_test_artifact.');
final FakeSecondaryCache cache = FakeSecondaryCache()
..artifactDirectory = artifactDir
..version = '123456';
final OperatingSystemUtils operatingSystemUtils = OperatingSystemUtils(
processManager: FakeProcessManager.any(),
platform: FakePlatform(),
......@@ -167,10 +171,9 @@ void main() {
fileSystem: fileSystem,
);
final GradleWrapper gradleWrapper = GradleWrapper(cache);
final Directory directory = cache.getCacheDir(fileSystem.path.join('artifacts', 'gradle_wrapper'));
final File propertiesFile = fileSystem.file(fileSystem.path.join(directory.path, 'gradle', 'wrapper', 'gradle-wrapper.properties'))
final File propertiesFile = fileSystem.file(fileSystem.path.join(artifactDir.path, 'gradle', 'wrapper', 'gradle-wrapper.properties'))
..createSync(recursive: true);
final File noticeFile = fileSystem.file(fileSystem.path.join(directory.path, 'NOTICE'))
final File noticeFile = fileSystem.file(fileSystem.path.join(artifactDir.path, 'NOTICE'))
..createSync(recursive: true);
await gradleWrapper.updateInner(FakeArtifactUpdater(), fileSystem, operatingSystemUtils);
......@@ -429,10 +432,9 @@ void main() {
testWithoutContext('FlutterRunnerDebugSymbols downloads Flutter runner debug symbols', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Cache cache = Cache.test(
fileSystem: fileSystem,
processManager: FakeProcessManager.any(),
);
final Cache cache = FakeSecondaryCache()
..version = '123456';
final FakeVersionedPackageResolver packageResolver = FakeVersionedPackageResolver();
final FlutterRunnerDebugSymbols flutterRunnerDebugSymbols = FlutterRunnerDebugSymbols(
cache,
......@@ -443,8 +445,8 @@ void main() {
await flutterRunnerDebugSymbols.updateInner(FakeArtifactUpdater(), fileSystem, FakeOperatingSystemUtils());
expect(packageResolver.resolved, <List<String>>[
<String>['fuchsia-debug-symbols-x64', null],
<String>['fuchsia-debug-symbols-arm64', null],
<String>['fuchsia-debug-symbols-x64', '123456'],
<String>['fuchsia-debug-symbols-arm64', '123456'],
]);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment