Fix `build_file` attribute on `http_dmg` repository rule. (#461)
Previously the use of `build_file` did nothing. This fixes that issue
and adds a regression test.
diff --git a/tools/http_dmg/http_dmg.bzl b/tools/http_dmg/http_dmg.bzl
index f02bfa3..47c9c4f 100644
--- a/tools/http_dmg/http_dmg.bzl
+++ b/tools/http_dmg/http_dmg.bzl
@@ -305,7 +305,7 @@
build_file_content = repository_ctx.attr.build_file_content
if repository_ctx.attr.build_file:
- repository_ctx.read(repository_ctx.path(repository_ctx.attr.build_file))
+ build_file_content = repository_ctx.read(repository_ctx.path(repository_ctx.attr.build_file))
repository_ctx.file("BUILD.bazel", content = build_file_content)
repository_ctx.file("WORKSPACE.bazel", content = """workspace(name = "{}")""".format(repository_ctx.name))
diff --git a/tools/http_dmg/private/tests/BUILD.firefox.bazel b/tools/http_dmg/private/tests/BUILD.firefox.bazel
new file mode 100644
index 0000000..1886749
--- /dev/null
+++ b/tools/http_dmg/private/tests/BUILD.firefox.bazel
@@ -0,0 +1,5 @@
+alias(
+ name = "info_plist",
+ actual = "Firefox.app/Contents/Info.plist",
+ visibility = ["//visibility:public"],
+)
diff --git a/tools/http_dmg/private/tests/http_dmg_test_deps.bzl b/tools/http_dmg/private/tests/http_dmg_test_deps.bzl
index 179ddf9..8bcdd8d 100644
--- a/tools/http_dmg/private/tests/http_dmg_test_deps.bzl
+++ b/tools/http_dmg/private/tests/http_dmg_test_deps.bzl
@@ -20,9 +20,8 @@
name = "http_dmg_test_firefox",
urls = ["https://ftp.mozilla.org/pub/firefox/releases/141.0.3/mac/en-US/Firefox%20141.0.3.dmg"],
integrity = "sha256-u5Is2mkFQ73aofvDs8ulCMYHdIMmQ0UrwmZZUzH0LbE=",
- build_file_content = _BUILD_FILE_CONTENT.format(
- file = "Firefox.app/Contents/Info.plist",
- ),
+ # Explicitly test `build_file`.
+ build_file = Label("//tools/http_dmg/private/tests:BUILD.firefox.bazel"),
)
http_dmg(