Add bazel launcher
This adds a launcher script for bazel. Design doc discussing it is
here: go/cros-build:bazel-launcher-proposal
BUG=b:253268519
TEST=unit tests
TEST=bin/bazel --project metallurgy --help
Change-Id: I13bf14ac709d6e5b9cf2c66c25c61fd4441056d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4718365
Reviewed-by: Aaron Massey <aaronmassey@google.com>
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Shuhei Takahashi <nya@chromium.org>
diff --git a/scripts/bazel_unittest.py b/scripts/bazel_unittest.py
new file mode 100644
index 0000000..e60f558
--- /dev/null
+++ b/scripts/bazel_unittest.py
@@ -0,0 +1,25 @@
+# Copyright 2023 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Tests for bazel launcher."""
+
+
+from chromite.scripts import bazel
+
+
+def test_parse_known_args():
+ """Test the parser will parse only known arguments."""
+ script_args = ["--project", "fwsdk"]
+ bazel_args = [
+ "run",
+ ":flash_brya",
+ "--sandbox_debug",
+ "--",
+ "--some_arg",
+ "--project",
+ "ignore_this_value",
+ ]
+ opts, args = bazel.parse_arguments(script_args + bazel_args)
+ assert opts.project == "fwsdk"
+ assert args == bazel_args