Download and handle product version of flutter patched sdk (#31063) * Support release/debug flavors of flutter_patched_sdk * Use [anyNamed] instead of [any] for mocking named arguments * Fix use of local engine in release mode
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart index 2c614d6..7ff4f34 100644 --- a/packages/flutter_tools/lib/src/artifacts.dart +++ b/packages/flutter_tools/lib/src/artifacts.dart
@@ -105,7 +105,7 @@ } // Returns the requested [artifact] for the [platform] and [mode] combination. - String getArtifactPath(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]); + String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }); // Returns which set of engine artifacts is currently used for the [platform] // and [mode] combination. @@ -116,7 +116,7 @@ class CachedArtifacts extends Artifacts { @override - String getArtifactPath(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]) { + String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) { platform ??= _currentHostPlatform; switch (platform) { case TargetPlatform.android_arm: @@ -173,9 +173,10 @@ } } - String _getFlutterPatchedSdkPath() { + String _getFlutterPatchedSdkPath(BuildMode mode) { final String engineArtifactsPath = cache.getArtifactDirectory('engine').path; - return fs.path.join(engineArtifactsPath, 'common', 'flutter_patched_sdk'); + return fs.path.join(engineArtifactsPath, 'common', + mode == BuildMode.release ? 'flutter_patched_sdk_product' : 'flutter_patched_sdk'); } String _getFlutterWebSdkPath() { @@ -200,11 +201,11 @@ case Artifact.engineDartBinary: return fs.path.join(dartSdkPath, 'bin', _artifactToFileName(artifact)); case Artifact.platformKernelDill: - return fs.path.join(_getFlutterPatchedSdkPath(), _artifactToFileName(artifact)); + return fs.path.join(_getFlutterPatchedSdkPath(mode), _artifactToFileName(artifact)); case Artifact.platformLibrariesJson: - return fs.path.join(_getFlutterPatchedSdkPath(), 'lib', _artifactToFileName(artifact)); + return fs.path.join(_getFlutterPatchedSdkPath(mode), 'lib', _artifactToFileName(artifact)); case Artifact.flutterPatchedSdkPath: - return _getFlutterPatchedSdkPath(); + return _getFlutterPatchedSdkPath(mode); case Artifact.flutterWebSdk: return _getFlutterWebSdkPath(); case Artifact.dart2jsSnapshot: @@ -262,7 +263,7 @@ String _hostEngineOutPath; @override - String getArtifactPath(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]) { + String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) { switch (artifact) { case Artifact.snapshotDart: return fs.path.join(_engineSrcPath, 'flutter', 'lib', 'snapshot', _artifactToFileName(artifact)); @@ -274,13 +275,17 @@ case Artifact.vmSnapshotData: return fs.path.join(engineOutPath, 'gen', 'flutter', 'lib', 'snapshot', _artifactToFileName(artifact)); case Artifact.platformKernelDill: - return fs.path.join(_getFlutterPatchedSdkPath(), _artifactToFileName(artifact)); + return fs.path.join(_getFlutterPatchedSdkPath(mode), _artifactToFileName(artifact)); case Artifact.platformLibrariesJson: - return fs.path.join(_getFlutterPatchedSdkPath(), 'lib', _artifactToFileName(artifact)); + return fs.path.join(_getFlutterPatchedSdkPath(mode), 'lib', _artifactToFileName(artifact)); case Artifact.flutterFramework: return fs.path.join(engineOutPath, _artifactToFileName(artifact)); case Artifact.flutterPatchedSdkPath: - return _getFlutterPatchedSdkPath(); + // When using local engine always use [BuildMode.debug] regardless of + // what was specified in [mode] argument because local engine will + // have only one flutter_patched_sdk in standard location, that + // is happen to be what debug(non-release) mode is using. + return _getFlutterPatchedSdkPath(BuildMode.debug); case Artifact.flutterWebSdk: return _getFlutterWebSdkPath(); case Artifact.frontendServerSnapshotForEngineDartSdk: @@ -303,8 +308,9 @@ return fs.path.basename(engineOutPath); } - String _getFlutterPatchedSdkPath() { - return fs.path.join(engineOutPath, 'flutter_patched_sdk'); + String _getFlutterPatchedSdkPath(BuildMode buildMode) { + return fs.path.join(engineOutPath, + buildMode == BuildMode.release ? 'flutter_patched_sdk_product' : 'flutter_patched_sdk'); } String _getFlutterWebSdkPath() { @@ -356,7 +362,7 @@ final File flutterPatchedSdk; @override - String getArtifactPath(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]) { + String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) { if (artifact == Artifact.frontendServerSnapshotForEngineDartSdk && frontendServer != null) { return frontendServer.path; } @@ -369,7 +375,7 @@ if (artifact == Artifact.flutterPatchedSdkPath && flutterPatchedSdk != null) { return flutterPatchedSdk.path; } - return parent.getArtifactPath(artifact, platform, mode); + return parent.getArtifactPath(artifact, platform: platform, mode: mode); } @override
diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart index 90c4259..578c82e 100644 --- a/packages/flutter_tools/lib/src/base/build.dart +++ b/packages/flutter_tools/lib/src/base/build.dart
@@ -43,7 +43,7 @@ static String getSnapshotterPath(SnapshotType snapshotType) { return artifacts.getArtifactPath( - Artifact.genSnapshot, snapshotType.platform, snapshotType.mode); + Artifact.genSnapshot, platform: snapshotType.platform, mode: snapshotType.mode); } Future<int> run({ @@ -317,7 +317,7 @@ final String depfilePath = fs.path.join(outputPath, 'kernel_compile.d'); final KernelCompiler kernelCompiler = await kernelCompilerFactory.create(flutterProject); final CompilerOutput compilerOutput = await _timedStep('frontend', () => kernelCompiler.compile( - sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), + sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode), mainPath: mainPath, packagesPath: packagesPath, outputFilePath: getKernelPathForTransformerOptions( @@ -391,8 +391,8 @@ final Directory outputDir = fs.directory(outputPath); outputDir.createSync(recursive: true); - final String engineVmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, null, buildMode); - final String engineIsolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData, null, buildMode); + final String engineVmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: buildMode); + final String engineIsolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: buildMode); final String isolateSnapshotData = fs.path.join(outputDir.path, 'isolate_snapshot_data'); final String isolateSnapshotInstructions = fs.path.join(outputDir.path, 'isolate_snapshot_instr');
diff --git a/packages/flutter_tools/lib/src/bundle.dart b/packages/flutter_tools/lib/src/bundle.dart index 8cff1b2..7e2fe44 100644 --- a/packages/flutter_tools/lib/src/bundle.dart +++ b/packages/flutter_tools/lib/src/bundle.dart
@@ -103,7 +103,7 @@ ensureDirectoryExists(applicationKernelFilePath); final KernelCompiler kernelCompiler = await kernelCompilerFactory.create(flutterProject); final CompilerOutput compilerOutput = await kernelCompiler.compile( - sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), + sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode), incrementalCompilerByteStorePath: compilationTraceFilePath != null ? null : fs.path.absolute(getIncrementalCompilerByteStoreDirectory()), mainPath: fs.file(mainPath).absolute.path, @@ -202,15 +202,15 @@ final Map<String, DevFSContent> assetEntries = Map<String, DevFSContent>.from(assetBundle.entries); if (kernelContent != null) { if (compilationTraceFilePath != null) { - final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, null, buildMode); + final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: buildMode); final String isolateSnapshotData = fs.path.join(getBuildDirectory(), _kIsolateSnapshotData); final String isolateSnapshotInstr = fs.path.join(getBuildDirectory(), _kIsolateSnapshotInstr); assetEntries[_kVMSnapshotData] = DevFSFileContent(fs.file(vmSnapshotData)); assetEntries[_kIsolateSnapshotData] = DevFSFileContent(fs.file(isolateSnapshotData)); assetEntries[_kIsolateSnapshotInstr] = DevFSFileContent(fs.file(isolateSnapshotInstr)); } else { - final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, null, buildMode); - final String isolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData, null, buildMode); + final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: buildMode); + final String isolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: buildMode); assetEntries[_kKernelKey] = kernelContent; assetEntries[_kVMSnapshotData] = DevFSFileContent(fs.file(vmSnapshotData)); assetEntries[_kIsolateSnapshotData] = DevFSFileContent(fs.file(isolateSnapshotData));
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart index bfdb74c..dcfe070 100644 --- a/packages/flutter_tools/lib/src/cache.dart +++ b/packages/flutter_tools/lib/src/cache.dart
@@ -609,6 +609,7 @@ List<List<String>> getBinaryDirs() { final List<List<String>> binaryDirs = <List<String>>[ <String>['common', 'flutter_patched_sdk.zip'], + <String>['common', 'flutter_patched_sdk_product.zip'], ]; if (cache.includeAllPlatforms) { binaryDirs.addAll(<List<String>>[
diff --git a/packages/flutter_tools/lib/src/commands/attach.dart b/packages/flutter_tools/lib/src/commands/attach.dart index 0031a4c..43f15a1 100644 --- a/packages/flutter_tools/lib/src/commands/attach.dart +++ b/packages/flutter_tools/lib/src/commands/attach.dart
@@ -216,6 +216,7 @@ viewFilter: argResults['isolate-filter'], target: argResults['target'], targetModel: TargetModel(argResults['target-model']), + buildMode: getBuildMode(), ); flutterDevice.observatoryUris = <Uri>[ observatoryUri ]; final List<FlutterDevice> flutterDevices = <FlutterDevice>[flutterDevice];
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index a4e1524..08e5207 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -351,6 +351,7 @@ dillOutputPath: dillOutputPath, viewFilter: isolateFilter, target: target, + buildMode: options.buildInfo.mode, ); ResidentRunner runner;
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart index e013079..926154c 100644 --- a/packages/flutter_tools/lib/src/commands/run.dart +++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -369,6 +369,7 @@ viewFilter: argResults['isolate-filter'], experimentalFlags: expFlags, target: argResults['target'], + buildMode: getBuildMode(), ); flutterDevices.add(flutterDevice); }
diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart index 3261776..c929186 100644 --- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart +++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
@@ -23,7 +23,8 @@ final RegExp _varExpr = RegExp(r'\$\(([^)]*)\)'); String flutterFrameworkDir(BuildMode mode) { - return fs.path.normalize(fs.path.dirname(artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, mode))); + return fs.path.normalize(fs.path.dirname(artifacts.getArtifactPath( + Artifact.flutterFramework, platform: TargetPlatform.ios, mode: mode))); } /// Writes or rewrites Xcode property files with the specified information.
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 2fd1b19..47b7964 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -38,9 +38,10 @@ TargetModel targetModel = TargetModel.flutter, List<String> experimentalFlags, ResidentCompiler generator, + @required BuildMode buildMode, }) : assert(trackWidgetCreation != null), generator = generator ?? ResidentCompiler( - artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), + artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode), trackWidgetCreation: trackWidgetCreation, fileSystemRoots: fileSystemRoots, fileSystemScheme: fileSystemScheme, @@ -60,6 +61,7 @@ TargetModel targetModel = TargetModel.flutter, List<String> experimentalFlags, ResidentCompiler generator, + @required BuildMode buildMode, }) async { ResidentCompiler generator; final FlutterProject flutterProject = await FlutterProject.current(); @@ -69,7 +71,7 @@ ); } else { generator = ResidentCompiler( - artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), + artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode), trackWidgetCreation: trackWidgetCreation, fileSystemRoots: fileSystemRoots, fileSystemScheme: fileSystemScheme, @@ -87,6 +89,7 @@ experimentalFlags: experimentalFlags, targetModel: targetModel, generator: generator, + buildMode: buildMode, ); }
diff --git a/packages/flutter_tools/test/android/gradle_test.dart b/packages/flutter_tools/test/android/gradle_test.dart index c25d2ad..d9cbefe 100644 --- a/packages/flutter_tools/test/android/gradle_test.dart +++ b/packages/flutter_tools/test/android/gradle_test.dart
@@ -252,7 +252,8 @@ String expectedBuildName, String expectedBuildNumber, }) async { - when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.android_arm, any)).thenReturn('engine'); + when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, + platform: TargetPlatform.android_arm, mode: anyNamed('mode'))).thenReturn('engine'); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'android_arm')); final File manifestFile = fs.file('path/to/project/pubspec.yaml');
diff --git a/packages/flutter_tools/test/artifacts_test.dart b/packages/flutter_tools/test/artifacts_test.dart index 00b17e4..fcc6c8f 100644 --- a/packages/flutter_tools/test/artifacts_test.dart +++ b/packages/flutter_tools/test/artifacts_test.dart
@@ -28,7 +28,7 @@ testUsingContext('getArtifactPath', () { expect( - artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, BuildMode.release), + artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release), fs.path.join(tempDir.path, 'bin', 'cache', 'artifacts', 'engine', 'ios-release', 'Flutter.framework'), ); expect( @@ -78,7 +78,7 @@ testUsingContext('getArtifactPath', () { expect( - artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, BuildMode.release), + artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release), fs.path.join(tempDir.path, 'out', 'android_debug_unopt', 'Flutter.framework'), ); expect(
diff --git a/packages/flutter_tools/test/base/build_test.dart b/packages/flutter_tools/test/base/build_test.dart index 41ed0d9..facb0fd 100644 --- a/packages/flutter_tools/test/base/build_test.dart +++ b/packages/flutter_tools/test/base/build_test.dart
@@ -114,7 +114,8 @@ mockXcode = MockXcode(); bufferLogger = BufferLogger(); for (BuildMode mode in BuildMode.values) { - when(mockArtifacts.getArtifactPath(Artifact.snapshotDart, any, mode)).thenReturn(kSnapshotDart); + when(mockArtifacts.getArtifactPath(Artifact.snapshotDart, + platform: anyNamed('platform'), mode: mode)).thenReturn(kSnapshotDart); } }); @@ -552,9 +553,11 @@ mockArtifacts = MockArtifacts(); for (BuildMode mode in BuildMode.values) { - when(mockArtifacts.getArtifactPath(Artifact.vmSnapshotData, null, mode)) + when(mockArtifacts.getArtifactPath(Artifact.vmSnapshotData, + platform: anyNamed('platform'), mode: mode)) .thenReturn(kEngineVmSnapshotData); - when(mockArtifacts.getArtifactPath(Artifact.isolateSnapshotData, null, mode)) + when(mockArtifacts.getArtifactPath(Artifact.isolateSnapshotData, + platform: anyNamed('platform'), mode: mode)) .thenReturn(kEngineIsolateSnapshotData); } });
diff --git a/packages/flutter_tools/test/hot_test.dart b/packages/flutter_tools/test/hot_test.dart index 37ac83f..4868321 100644 --- a/packages/flutter_tools/test/hot_test.dart +++ b/packages/flutter_tools/test/hot_test.dart
@@ -5,6 +5,7 @@ import 'dart:async'; import 'package:flutter_tools/src/artifacts.dart'; +import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/devfs.dart'; import 'package:flutter_tools/src/device.dart'; import 'package:flutter_tools/src/resident_runner.dart'; @@ -130,7 +131,7 @@ when(mockDevice.supportsHotRestart).thenReturn(false); // Trigger hot restart. final List<FlutterDevice> devices = <FlutterDevice>[ - FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs, + FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs, ]; final OperationResult result = await HotRunner(devices).restart(fullRestart: true); // Expect hot restart failed. @@ -151,8 +152,8 @@ when(mockHotDevice.supportsHotRestart).thenReturn(true); // Trigger hot restart. final List<FlutterDevice> devices = <FlutterDevice>[ - FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs, - FlutterDevice(mockHotDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs, + FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs, + FlutterDevice(mockHotDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs, ]; final OperationResult result = await HotRunner(devices).restart(fullRestart: true); // Expect hot restart failed. @@ -173,8 +174,8 @@ when(mockHotDevice.supportsHotRestart).thenReturn(true); // Trigger a restart. final List<FlutterDevice> devices = <FlutterDevice>[ - FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs, - FlutterDevice(mockHotDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs, + FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs, + FlutterDevice(mockHotDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs, ]; final OperationResult result = await HotRunner(devices).restart(fullRestart: true); // Expect hot restart was successful. @@ -190,7 +191,7 @@ when(mockDevice.supportsHotReload).thenReturn(true); when(mockDevice.supportsHotRestart).thenReturn(true); final List<FlutterDevice> devices = <FlutterDevice>[ - FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false), + FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug), ]; final OperationResult result = await HotRunner(devices).restart(fullRestart: true); expect(result.isOk, false); @@ -207,7 +208,7 @@ when(mockDevice.supportsHotRestart).thenReturn(true); // Trigger hot restart. final List<FlutterDevice> devices = <FlutterDevice>[ - FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs, + FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs, ]; final OperationResult result = await HotRunner(devices).restart(fullRestart: true); // Expect hot restart successful. @@ -233,7 +234,7 @@ when(mockDevice.supportsHotRestart).thenReturn(true); when(mockDevice.supportsStopApp).thenReturn(false); final List<FlutterDevice> devices = <FlutterDevice>[ - FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false), + FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug), ]; await HotRunner(devices).cleanupAfterSignal(); expect(shutdownTestingConfig.shutdownHookCalled, true); @@ -248,7 +249,7 @@ when(mockDevice.supportsHotRestart).thenReturn(true); when(mockDevice.supportsStopApp).thenReturn(false); final List<FlutterDevice> devices = <FlutterDevice>[ - FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false), + FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug), ]; await HotRunner(devices).preStop(); expect(shutdownTestingConfig.shutdownHookCalled, true);
diff --git a/packages/flutter_tools/test/ios/xcodeproj_test.dart b/packages/flutter_tools/test/ios/xcodeproj_test.dart index ed4fa5e..86e33f4 100644 --- a/packages/flutter_tools/test/ios/xcodeproj_test.dart +++ b/packages/flutter_tools/test/ios/xcodeproj_test.dart
@@ -282,7 +282,8 @@ } testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async { - when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine'); + when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, + platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, targetPlatform: TargetPlatform.ios); @@ -300,7 +301,8 @@ }); testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async { - when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine'); + when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, + platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, trackWidgetCreation: true, targetPlatform: TargetPlatform.ios); final FlutterProject project = await FlutterProject.fromPath('path/to/project'); @@ -317,7 +319,8 @@ }); testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async { - when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine'); + when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, + platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, targetPlatform: TargetPlatform.ios); final FlutterProject project = await FlutterProject.fromPath('path/to/project'); @@ -334,7 +337,8 @@ }); testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async { - when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine'); + when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, + platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile')); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, targetPlatform: TargetPlatform.ios); @@ -366,7 +370,8 @@ String expectedBuildName, String expectedBuildNumber, }) async { - when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine'); + when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, + platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios')); final File manifestFile = fs.file('path/to/project/pubspec.yaml');
diff --git a/packages/flutter_tools/test/resident_runner_test.dart b/packages/flutter_tools/test/resident_runner_test.dart index 2a20530..a4c96b3 100644 --- a/packages/flutter_tools/test/resident_runner_test.dart +++ b/packages/flutter_tools/test/resident_runner_test.dart
@@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:async'; +import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/device.dart'; import 'package:flutter_tools/src/resident_runner.dart'; import 'package:mockito/mockito.dart'; @@ -53,7 +54,7 @@ // TODO(jacobr): make these tests run with `trackWidgetCreation: true` as // well as the default flags. return TestRunner( - <FlutterDevice>[FlutterDevice(MockDevice(), trackWidgetCreation: false)], + <FlutterDevice>[FlutterDevice(MockDevice(), trackWidgetCreation: false, buildMode: BuildMode.debug)], ); }