From 74a8729d753059da9478b8ee2799dac8ba330f66 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Wed, 17 Apr 2024 15:44:11 -0700 Subject: kleaf: Fix tools/bazel --help. Do not attach any --bazelrc flags when running tools/bazel --help. Add back integration test now that the issue in Bazel about JDK_JAVA_OPTIONS is fixed. Bug: 293357796 Test: TH Change-Id: Ib65c245ecda54d1fa1c655f3dc365407570d73ec --- kleaf/bazel.py | 10 ++++++---- kleaf/tests/integration_test/integration_test.py | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/kleaf/bazel.py b/kleaf/bazel.py index ec2d1b0a..9a876276 100755 --- a/kleaf/bazel.py +++ b/kleaf/bazel.py @@ -326,6 +326,9 @@ class BazelWrapper(KleafHelpPrinter): def _handle_bazelrc(self): """Rewrite bazelrc files.""" + if self.known_startup_options.help: + return + self.gen_bazelrc_dir = self.absolute_out_dir / "bazel/bazelrc" os.makedirs(self.gen_bazelrc_dir, exist_ok=True) @@ -370,10 +373,9 @@ class BazelWrapper(KleafHelpPrinter): build --//build/kernel/kleaf:cache_dir={shlex.quote(str(self.known_args.cache_dir))} """)) - if not self.known_startup_options.help: - self.transformed_startup_options += self._transform_bazelrc_files([ - cache_dir_bazelrc, - ]) + self.transformed_startup_options += self._transform_bazelrc_files([ + cache_dir_bazelrc, + ]) self.transformed_startup_options += self._transform_bazelrc_files([ # Toolchains and platforms diff --git a/kleaf/tests/integration_test/integration_test.py b/kleaf/tests/integration_test/integration_test.py index 28d5f852..f874d552 100644 --- a/kleaf/tests/integration_test/integration_test.py +++ b/kleaf/tests/integration_test/integration_test.py @@ -605,7 +605,6 @@ class QuickIntegrationTest(KleafIntegrationTestBase): self.assertNotIn("DECLARED_SET", stderr) self.assertNotIn("DECLARED_UNSET", stderr) - @unittest.skip("b/293357796") def test_dash_dash_help(self): """Test that `bazel --help` works.""" self._check_output("--help", [], use_bazelrc=False) -- cgit v1.2.3