[repo_util] Use monorepo module to check build

Bug: None
Change-Id: Ia4e9682d56166f5d0211f87cee832b1443b47b1d
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/53725
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: William Hesse <whesse@google.com>
diff --git a/recipe_modules/repo_util/__init__.py b/recipe_modules/repo_util/__init__.py
index 8829015..2a50391 100644
--- a/recipe_modules/repo_util/__init__.py
+++ b/recipe_modules/repo_util/__init__.py
@@ -4,6 +4,7 @@
     'depot_tools/gclient',
     'depot_tools/git',
     'flutter/cache',
+    'flutter/monorepo',
     'flutter/retry',
     'flutter/shard_util_v2',
     'fuchsia/utils',
diff --git a/recipe_modules/repo_util/api.py b/recipe_modules/repo_util/api.py
index 3db0df7..6c01a83 100644
--- a/recipe_modules/repo_util/api.py
+++ b/recipe_modules/repo_util/api.py
@@ -452,7 +452,8 @@
          ] = 'https://storage.googleapis.com/flutter_archives_v2'
     env_prefixes = {'PATH': ['%s' % str(flutter_bin), '%s' % str(dart_bin)]}
     flutter_exe = 'flutter.bat' if self.m.platform.is_win else 'flutter'
-    if not self.m.properties.get('gn_artifacts', False):
+    if (not self.m.monorepo.is_monorepo_ci_build and
+        not self.m.monorepo.is_monorepo_try_build):
       self.m.step('flutter config --clear-features',
                   [flutter_bin.join(flutter_exe), 'config', '--clear-features'],
       )
diff --git a/recipe_modules/repo_util/examples/full.expected/mac.json b/recipe_modules/repo_util/examples/full.expected/mac.json
index 3e3674c..7db883a 100644
--- a/recipe_modules/repo_util/examples/full.expected/mac.json
+++ b/recipe_modules/repo_util/examples/full.expected/mac.json
@@ -757,6 +757,14 @@
     "name": "git rev-parse"
   },
   {
+    "cmd": [
+      "[START_DIR]/flutter/bin/flutter",
+      "config",
+      "--clear-features"
+    ],
+    "name": "flutter config --clear-features"
+  },
+  {
     "cmd": [],
     "name": "Identify branches (7)"
   },
diff --git a/recipe_modules/repo_util/examples/full.expected/monorepo.json b/recipe_modules/repo_util/examples/full.expected/monorepo.json
index 68437ca..f50a76f 100644
--- a/recipe_modules/repo_util/examples/full.expected/monorepo.json
+++ b/recipe_modules/repo_util/examples/full.expected/monorepo.json
@@ -1109,26 +1109,6 @@
   },
   {
     "cmd": [
-      "[START_DIR]/flutter/bin/flutter",
-      "config",
-      "--clear-features"
-    ],
-    "luci_context": {
-      "realm": {
-        "name": "dart:ci.sandbox"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "flutter config --clear-features"
-  },
-  {
-    "cmd": [
       "vpython3",
       "-u",
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
diff --git a/recipe_modules/repo_util/examples/full.expected/monorepo_first_bot_update_failed.json b/recipe_modules/repo_util/examples/full.expected/monorepo_first_bot_update_failed.json
index 5b0a46c..ac81fc1 100644
--- a/recipe_modules/repo_util/examples/full.expected/monorepo_first_bot_update_failed.json
+++ b/recipe_modules/repo_util/examples/full.expected/monorepo_first_bot_update_failed.json
@@ -1109,26 +1109,6 @@
   },
   {
     "cmd": [
-      "[START_DIR]/flutter/bin/flutter",
-      "config",
-      "--clear-features"
-    ],
-    "luci_context": {
-      "realm": {
-        "name": "dart:ci.sandbox"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "flutter config --clear-features"
-  },
-  {
-    "cmd": [
       "vpython3",
       "-u",
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
diff --git a/recipe_modules/repo_util/examples/full.expected/monorepo_release.json b/recipe_modules/repo_util/examples/full.expected/monorepo_release.json
index e6cef17..fea7558 100644
--- a/recipe_modules/repo_util/examples/full.expected/monorepo_release.json
+++ b/recipe_modules/repo_util/examples/full.expected/monorepo_release.json
@@ -1332,26 +1332,6 @@
     "name": "git rev-parse"
   },
   {
-    "cmd": [
-      "[START_DIR]/flutter/bin/flutter",
-      "config",
-      "--clear-features"
-    ],
-    "luci_context": {
-      "realm": {
-        "name": "dart:ci.sandbox"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "flutter config --clear-features"
-  },
-  {
     "cmd": [],
     "name": "Identify branches (7)"
   },
diff --git a/recipe_modules/repo_util/examples/full.expected/monorepo_tryjob.json b/recipe_modules/repo_util/examples/full.expected/monorepo_tryjob.json
index b447103..7dc2421 100644
--- a/recipe_modules/repo_util/examples/full.expected/monorepo_tryjob.json
+++ b/recipe_modules/repo_util/examples/full.expected/monorepo_tryjob.json
@@ -1110,26 +1110,6 @@
   },
   {
     "cmd": [
-      "[START_DIR]/flutter/bin/flutter",
-      "config",
-      "--clear-features"
-    ],
-    "luci_context": {
-      "realm": {
-        "name": "dart:ci.sandbox"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "flutter config --clear-features"
-  },
-  {
-    "cmd": [
       "vpython3",
       "-u",
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
diff --git a/recipe_modules/repo_util/examples/full.expected/monorepo_wrong_host.json b/recipe_modules/repo_util/examples/full.expected/monorepo_wrong_host.json
index e2486e6..db22404 100644
--- a/recipe_modules/repo_util/examples/full.expected/monorepo_wrong_host.json
+++ b/recipe_modules/repo_util/examples/full.expected/monorepo_wrong_host.json
@@ -1109,26 +1109,6 @@
   },
   {
     "cmd": [
-      "[START_DIR]/flutter/bin/flutter",
-      "config",
-      "--clear-features"
-    ],
-    "luci_context": {
-      "realm": {
-        "name": "project:ci"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "flutter config --clear-features"
-  },
-  {
-    "cmd": [
       "vpython3",
       "-u",
       "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
diff --git a/recipe_modules/repo_util/examples/full.expected/win.json b/recipe_modules/repo_util/examples/full.expected/win.json
index 459503c..60b2fb3 100644
--- a/recipe_modules/repo_util/examples/full.expected/win.json
+++ b/recipe_modules/repo_util/examples/full.expected/win.json
@@ -757,6 +757,14 @@
     "name": "git rev-parse"
   },
   {
+    "cmd": [
+      "[START_DIR]\\flutter\\bin\\flutter.bat",
+      "config",
+      "--clear-features"
+    ],
+    "name": "flutter config --clear-features"
+  },
+  {
     "cmd": [],
     "name": "Identify branches (7)"
   },
diff --git a/recipes/engine_v2/tester.expected/monorepo.json b/recipes/engine_v2/tester.expected/monorepo.json
index f8833c3..2e29e1b 100644
--- a/recipes/engine_v2/tester.expected/monorepo.json
+++ b/recipes/engine_v2/tester.expected/monorepo.json
@@ -499,26 +499,6 @@
   },
   {
     "cmd": [
-      "[CACHE]/builder/flutter/bin/flutter",
-      "config",
-      "--clear-features"
-    ],
-    "luci_context": {
-      "realm": {
-        "name": "dart:ci.sandbox"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "flutter config --clear-features"
-  },
-  {
-    "cmd": [
       "flutter",
       "update-packages",
       "-v"
diff --git a/recipes/engine_v2/tester.expected/monorepo_framework_tests.json b/recipes/engine_v2/tester.expected/monorepo_framework_tests.json
index 0a1b1e5..4a8eab1 100644
--- a/recipes/engine_v2/tester.expected/monorepo_framework_tests.json
+++ b/recipes/engine_v2/tester.expected/monorepo_framework_tests.json
@@ -499,26 +499,6 @@
   },
   {
     "cmd": [
-      "[CACHE]/builder/flutter/bin/flutter",
-      "config",
-      "--clear-features"
-    ],
-    "luci_context": {
-      "realm": {
-        "name": "dart:ci.sandbox"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "flutter config --clear-features"
-  },
-  {
-    "cmd": [
       "cipd",
       "ensure",
       "-root",
diff --git a/recipes/engine_v2/tester.expected/monorepo_tryjob.json b/recipes/engine_v2/tester.expected/monorepo_tryjob.json
index 4d77b00..34d9a44 100644
--- a/recipes/engine_v2/tester.expected/monorepo_tryjob.json
+++ b/recipes/engine_v2/tester.expected/monorepo_tryjob.json
@@ -272,26 +272,6 @@
   },
   {
     "cmd": [
-      "[CACHE]/builder/flutter/bin/flutter",
-      "config",
-      "--clear-features"
-    ],
-    "luci_context": {
-      "realm": {
-        "name": "dart:ci.sandbox"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "flutter config --clear-features"
-  },
-  {
-    "cmd": [
       "flutter",
       "update-packages",
       "-v"
diff --git a/recipes/engine_v2/tester.expected/monorepo_web_tests.json b/recipes/engine_v2/tester.expected/monorepo_web_tests.json
index f513ef6..66445ba 100644
--- a/recipes/engine_v2/tester.expected/monorepo_web_tests.json
+++ b/recipes/engine_v2/tester.expected/monorepo_web_tests.json
@@ -498,26 +498,6 @@
     "name": "git rev-parse"
   },
   {
-    "cmd": [
-      "[CACHE]/builder/flutter/bin/flutter",
-      "config",
-      "--clear-features"
-    ],
-    "luci_context": {
-      "realm": {
-        "name": "dart:ci.sandbox"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "flutter config --clear-features"
-  },
-  {
     "cmd": [],
     "name": "Chrome and driver dependency"
   },