diff options
author | Klaus Aehlig <aehlig@google.com> | 2018-02-01 06:55:56 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-01 06:57:25 -0800 |
commit | 5a50a7c403e567b850d5037d1ee0dad96be0b39d (patch) | |
tree | 30dbf38a3f2d0da6c362d6387f2f5ea720abbda8 /tools | |
parent | 109e4b4dc9e786e3a2d8d7cb245d18320dbe9216 (diff) |
http_archive: allow top-level BUILD files to be overridden
..by the `build_file` parameter, even if the external repository contains a
top-level BUILD file. While there, also add a test verifying that this is
also possible via the `build_file_content`.
Change-Id: I1b875c147cfcd6f1c70b8efeb10c2b406eeacf6a
PiperOrigin-RevId: 184134041
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build_defs/repo/http.bzl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/build_defs/repo/http.bzl b/tools/build_defs/repo/http.bzl index dea59dc057..ade8f68889 100644 --- a/tools/build_defs/repo/http.bzl +++ b/tools/build_defs/repo/http.bzl @@ -67,8 +67,12 @@ def _http_archive_impl(ctx): _patch(ctx) ctx.file("WORKSPACE", "workspace(name = \"{name}\")\n".format(name=ctx.name)) if ctx.attr.build_file: + bash_exe = ctx.os.environ["BAZEL_SH"] if "BAZEL_SH" in ctx.os.environ else "bash" + ctx.execute([bash_exe, "-c", "rm -f BUILD BUILD.bazel"]) ctx.symlink(ctx.attr.build_file, "BUILD") elif ctx.attr.build_file_content: + bash_exe = ctx.os.environ["BAZEL_SH"] if "BAZEL_SH" in ctx.os.environ else "bash" + ctx.execute([bash_exe, "-c", "rm -f BUILD.bazel"]) ctx.file("BUILD", ctx.attr.build_file_content) |