Support flatland

Tiles now supports running under flatland. This change adds a
run mode that matches.

Change-Id: Id4dbee6a99f872cc5f199e51afc38ba4a715926c
Reviewed-on: https://fuchsia-review.googlesource.com/c/fargo/+/569347
Reviewed-by: Marc Khouri <mnck@google.com>
diff --git a/src/command_line.rs b/src/command_line.rs
index a33611e..0706d28 100644
--- a/src/command_line.rs
+++ b/src/command_line.rs
@@ -188,6 +188,10 @@
     #[structopt(long)]
     run_with_tiles: bool,
 
+    /// Use tiles_ctl add --flatland to run the binary.
+    #[structopt(long)]
+    run_with_flatland_tiles: bool,
+
     /// Use session_control add to run the binary.
     #[structopt(long)]
     run_with_session_control: bool,
@@ -245,6 +249,10 @@
     #[structopt(long)]
     run_with_tiles: bool,
 
+    /// Use tiles_ctl add --flatland to run the binary.
+    #[structopt(long)]
+    run_with_flatland_tiles: bool,
+
     /// Use Use sessionctl to run the binary.
     #[structopt(long)]
     run_with_session_control: bool,
@@ -603,6 +611,7 @@
                 run.run_with_ffx_component,
                 run.run_with_ffx_test,
                 run.run_with_tiles,
+                run.run_with_flatland_tiles,
                 run.run_with_session_control,
             );
             return run_binary(
@@ -627,6 +636,7 @@
                 run_on_target.run_with_ffx_component,
                 run_on_target.run_with_ffx_test,
                 run_on_target.run_with_tiles,
+                run_on_target.run_with_flatland_tiles,
                 run_on_target.run_with_session_control,
             );
 
@@ -735,7 +745,7 @@
                 // file.
                 false
             };
-            let run_mode = run_switches_to_mode(false, is_v2_component, false, false);
+            let run_mode = run_switches_to_mode(false, is_v2_component, false, false, false);
 
             return run_tests(
                 &run_cargo_options
diff --git a/src/lib.rs b/src/lib.rs
index 199e902..1eaef45 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -57,6 +57,7 @@
 
     let mut command_string = match run_mode {
         RunMode::Tiles => "tiles_ctl add ".to_string(),
+        RunMode::TilesFlatland => "tiles_ctl --flatland add ".to_string(),
         RunMode::SessionControl => {
             format!("session_control add ")
         }
@@ -241,6 +242,7 @@
     FfxComponent,
     FfxTest,
     Tiles,
+    TilesFlatland,
     SessionControl,
 }
 
@@ -253,10 +255,13 @@
     ffx_component: bool,
     ffx_test: bool,
     tiles: bool,
+    flatland_tiles: bool,
     session_control: bool,
 ) -> RunMode {
     if tiles {
         RunMode::Tiles
+    } else if flatland_tiles {
+        RunMode::TilesFlatland
     } else if session_control {
         RunMode::SessionControl
     } else if ffx_component {
@@ -461,6 +466,7 @@
 ) -> Result<String, Error> {
     let sandbox_file_path;
     let tiles_arg = format!("--{}", RUN_WITH_TILES);
+    let flatland_tiles_arg = "--run-with-flatland-tiles";
     let session_control_arg = format!("--{}", RUN_WITH_SESSION_CONTROL,);
     let manifest_path_absolute;
     let manifest_path_string;
@@ -512,6 +518,7 @@
 
     match options.run_mode {
         RunMode::Tiles => runner_args.push(&tiles_arg),
+        RunMode::TilesFlatland => runner_args.push(&flatland_tiles_arg),
         RunMode::SessionControl => runner_args.push(&session_control_arg),
         RunMode::Run => runner_args.push(&run_arg),
         RunMode::FfxComponent => runner_args.push(&run_with_ffx_component_arg),