diff options
author | Yifan Hong <elsk@google.com> | 2023-04-13 10:27:34 -0700 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2023-04-14 18:58:02 +0000 |
commit | c091a2bc022091653c2bebdbee655c59b691b26e (patch) | |
tree | 07eb0648578e0a72a77f7ade358b36659cc09a57 /kleaf/bazel.py | |
parent | 910fd1a242509c6190fa3ac8f680767551274dbd (diff) | |
download | build-c091a2bc022091653c2bebdbee655c59b691b26e.tar.gz |
kleaf: Add --repo_prop argument to bazel wrapper.
This argument should point to a repo.prop file, generated
prior to building for build environments without the repo
binary. The file can be generated with this command:
repo forall -c 'echo "$REPO_PATH $REPO_LREV"'
If repo does exist on the host machine, it is unnecessary to provide
this file.
Bug: 277367919
Test: manual
Change-Id: I9918b84755adcfa5a447b48b3f0a0537712cba97
Diffstat (limited to 'kleaf/bazel.py')
-rwxr-xr-x | kleaf/bazel.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kleaf/bazel.py b/kleaf/bazel.py index 30bbdef..0f9e622 100755 --- a/kleaf/bazel.py +++ b/kleaf/bazel.py @@ -138,6 +138,13 @@ class BazelWrapper(object): parser.add_argument("--cache_dir", type=_require_absolute_path, default=absolute_cache_dir) + parser.add_argument( + "--repo_prop", + help="""Absolute path to repo.prop file, generated with """ + """`repo forall -c 'echo "$REPO_PATH $REPO_LREV"'`""", + type=_require_absolute_path, + default=None, + ) # known_args: List of arguments known by this bazel wrapper. These # are stripped from the final bazel invocation. @@ -168,6 +175,9 @@ class BazelWrapper(object): if self.known_args.make_jobs is not None: self.env["KLEAF_MAKE_JOBS"] = str(self.known_args.make_jobs) + if self.known_args.repo_prop is not None: + self.env["KLEAF_REPO_PROP"] = self.known_args.repo_prop + cache_dir_bazel_rc = f"{self.absolute_out_dir}/bazel/cache_dir.bazelrc" os.makedirs(os.path.dirname(cache_dir_bazel_rc), exist_ok=True) with open(cache_dir_bazel_rc, "w") as f: |