forked from kubernetes/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_infra.bzl
22 lines (21 loc) · 915 Bytes
/
test_infra.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def _http_archive_with_pkg_path_impl(ctx):
"""Implements the http_archive_with_pkg_path build rule."""
ctx.execute(["mkdir", "-p", ctx.attr.pkg_path])
ctx.download_and_extract(
url=ctx.attr.url,
sha256=ctx.attr.sha256,
stripPrefix=ctx.attr.strip_prefix,
output=ctx.attr.pkg_path)
ctx.file(ctx.attr.pkg_path+"/BUILD.bazel", ctx.attr.build_file_content)
# http_archive_with_pkg_path extends the built-in new_http_archive with a
# pkg_path field, which can be used to specify the package installation path.
http_archive_with_pkg_path = repository_rule(
implementation = _http_archive_with_pkg_path_impl,
attrs = {
"build_file_content": attr.string(mandatory=True),
"pkg_path": attr.string(mandatory=True),
"sha256": attr.string(),
"strip_prefix": attr.string(mandatory=True),
"url": attr.string(mandatory=True),
},
)