From 89692884a1ac0077a1d62917e22a5d5e4383b9d9 Mon Sep 17 00:00:00 2001 From: Christopher Fujino Date: Tue, 7 Nov 2023 17:53:22 -0800 Subject: [PATCH] [flutter_tools] Fix local engine preview device (#138046) Fixes https://github.com/flutter/flutter/issues/137982 --- packages/flutter_tools/lib/src/artifacts.dart | 7 ++++++- .../flutter_tools/test/general.shard/artifacts_test.dart | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart index 7f3e6abaeeba1..7b70f107a6226 100644 --- a/packages/flutter_tools/lib/src/artifacts.dart +++ b/packages/flutter_tools/lib/src/artifacts.dart @@ -1028,7 +1028,12 @@ class CachedLocalEngineArtifacts implements Artifacts { case Artifact.flutterToolsFileGenerators: return _getFileGeneratorsPath(); case Artifact.flutterPreviewDevice: - throw UnimplementedError('The preview device is not supported with local engine builds'); + return _backupCache.getArtifactPath( + artifact, + platform: platform, + mode: mode, + environmentType: environmentType, + ); } } diff --git a/packages/flutter_tools/test/general.shard/artifacts_test.dart b/packages/flutter_tools/test/general.shard/artifacts_test.dart index dc39ffe002c8c..bb0915c25ddda 100644 --- a/packages/flutter_tools/test/general.shard/artifacts_test.dart +++ b/packages/flutter_tools/test/general.shard/artifacts_test.dart @@ -329,6 +329,14 @@ void main() { 'snapshots', 'frontend_server_aot.dart.snapshot') ); + expect( + artifacts.getArtifactPath( + Artifact.flutterPreviewDevice, + platform: TargetPlatform.windows_x64, + ), + fileSystem.path.join('root', 'bin', 'cache', 'artifacts', + 'flutter_preview', 'flutter_preview.exe'), + ); fileSystem.file(fileSystem.path.join('/out', 'host_debug_unopt', 'impellerc')) .createSync(recursive: true);