Bazel clean to fix failures on bots

The bots seem to be getting into an inconsistent filesystem state which
should be resolved by bazel cleaning before building LiteRT-LM.

Bug: 4978767611
Change-Id: I8a9d82b7225ec3c1a028fb6ec304602019683df5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/334536
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Natalie Chouinard <chouinard@google.com>
diff --git a/third_party/litert-lm/build_litert_lm.py b/third_party/litert-lm/build_litert_lm.py
index 600878a..8885714 100644
--- a/third_party/litert-lm/build_litert_lm.py
+++ b/third_party/litert-lm/build_litert_lm.py
@@ -164,6 +164,11 @@
             env['CC'] = str(llvm_bin_dir / 'clang')
             env['CXX'] = str(llvm_bin_dir / 'clang++')
 
+        # Unconditionally clean the Bazel workspace before building to prevent
+        # filesystem inconsistency errors on the bots.
+        clean_cmd = [str(bazelisk_path), 'clean']
+        subprocess.run(clean_cmd, cwd=litert_lm_dir, env=env)
+
         proc = subprocess.run(build_cmd, cwd=litert_lm_dir, env=env)
         if proc.returncode != 0:
             print("Error: Bazel build failed.", file=sys.stderr)