[Impeller] Build Impeller iOS runtime stage shaders when Impeller is enabled (#113689)

diff --git a/packages/flutter_tools/lib/src/build_system/targets/assets.dart b/packages/flutter_tools/lib/src/build_system/targets/assets.dart
index d719a1c..4d7ff2a 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/assets.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/assets.dart
@@ -32,6 +32,7 @@
   required TargetPlatform targetPlatform,
   BuildMode? buildMode,
   required ShaderTarget shaderTarget,
+  List<File> additionalInputs = const <File>[],
 }) async {
   // Check for an SkSL bundle.
   final String? shaderBundlePath = environment.defines[kBundleSkSLPath] ?? environment.inputs[kBundleSkSLPath];
@@ -65,6 +66,7 @@
     // An asset manifest with no assets would have zero inputs if not
     // for this pubspec file.
     pubspecFile,
+    ...additionalInputs,
   ];
   final List<File> outputs = <File>[];
 
diff --git a/packages/flutter_tools/lib/src/build_system/targets/ios.dart b/packages/flutter_tools/lib/src/build_system/targets/ios.dart
index 644d48a..9d54b55 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/ios.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/ios.dart
@@ -10,7 +10,7 @@
 import '../../base/file_system.dart';
 import '../../base/io.dart';
 import '../../build_info.dart';
-import '../../globals.dart' as globals show xcode;
+import '../../globals.dart' as globals;
 import '../../macos/xcode.dart';
 import '../../project.dart';
 import '../../reporting/reporting.dart';
@@ -509,12 +509,28 @@
         .copySync(dsymOutputBinary.path);
     }
 
+    final FlutterProject flutterProject = FlutterProject.fromDirectory(environment.projectDir);
+
+    bool isImpellerEnabled() {
+      if (!flutterProject.ios.infoPlist.existsSync()) {
+        return false;
+      }
+      final Map<String, Object> info = globals.plistParser.parseFile(flutterProject.ios.infoPlist.path);
+
+      final Object? enableImpeller = info['FLTEnableImpeller'];
+      return enableImpeller is bool && enableImpeller;
+    }
+
     // Copy the assets.
     final Depfile assetDepfile = await copyAssets(
       environment,
       assetDirectory,
       targetPlatform: TargetPlatform.ios,
-      shaderTarget: ShaderTarget.sksl,
+      shaderTarget: isImpellerEnabled() ? ShaderTarget.impelleriOS : ShaderTarget.sksl,
+      additionalInputs: <File>[
+        flutterProject.ios.infoPlist,
+        flutterProject.ios.appFrameworkInfoPlist,
+      ],
     );
     final DepfileService depfileService = DepfileService(
       fileSystem: environment.fileSystem,
@@ -526,8 +542,6 @@
     );
 
     // Copy the plist from either the project or module.
-    // TODO(zanderso): add plist to inputs
-    final FlutterProject flutterProject = FlutterProject.fromDirectory(environment.projectDir);
     flutterProject.ios.appFrameworkInfoPlist
       .copySync(environment.outputDir
       .childDirectory('App.framework')
diff --git a/packages/flutter_tools/lib/src/build_system/targets/shader_compiler.dart b/packages/flutter_tools/lib/src/build_system/targets/shader_compiler.dart
index 194d2f2..b63307f 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/shader_compiler.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/shader_compiler.dart
@@ -21,8 +21,8 @@
 
 /// The output shader format that should be used by the [ShaderCompiler].
 enum ShaderTarget {
-  impellerAndroid('--opengl-es'),
-  impelleriOS('--metal-ios'),
+  impellerAndroid('--runtime-stage-gles'),
+  impelleriOS('--runtime-stage-metal'),
   sksl('--sksl');
 
   const ShaderTarget(this.target);
diff --git a/packages/flutter_tools/lib/src/xcode_project.dart b/packages/flutter_tools/lib/src/xcode_project.dart
index 77d1d7b..1b0e328 100644
--- a/packages/flutter_tools/lib/src/xcode_project.dart
+++ b/packages/flutter_tools/lib/src/xcode_project.dart
@@ -131,6 +131,8 @@
 
   File get appFrameworkInfoPlist => _flutterLibRoot.childDirectory('Flutter').childFile('AppFrameworkInfo.plist');
 
+  File get infoPlist => _editableDirectory.childDirectory('Runner').childFile('Info.plist');
+
   Directory get symlinks => _flutterLibRoot.childDirectory('.symlinks');
 
   /// True, if the app project is using swift.
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart
index 39ff525..7fca295 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart
@@ -81,7 +81,7 @@
       FakeCommand(
         command: <String>[
           impellerc,
-          '--metal-ios',
+          '--runtime-stage-metal',
           '--iplr',
           '--sl=$outputPath',
           '--spirv=$outputPath.spirv',
@@ -117,7 +117,7 @@
       FakeCommand(
         command: <String>[
           impellerc,
-          '--opengl-es',
+          '--runtime-stage-gles',
           '--iplr',
           '--sl=$outputPath',
           '--spirv=$outputPath.spirv',
@@ -275,7 +275,7 @@
       FakeCommand(
         command: <String>[
           impellerc,
-          '--opengl-es',
+          '--runtime-stage-gles',
           '--iplr',
           '--sl=/.tmp_rand0/0.8255140718871702.temp',
           '--spirv=/.tmp_rand0/0.8255140718871702.temp.spirv',