Skip to content

Commit 1b971ae

Browse files
committed
Merge branch 'levsha/-IDX-2606-Proper-tags-for-sha256sum2url-rule-' into 'master'
[IDX-2606] Proper tags for sha256sum2url rule. This rule requires network to talk to bazel cache. It is also better to mark it as manual so build that don't require it will not wait for it. See merge request dfinity-lab/public/ic!12612
2 parents dce8328 + df93a87 commit 1b971ae

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

bazel/defs.bzl

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,35 @@ def _sha256sum2url_impl(ctx):
7575
)
7676
return [DefaultInfo(files = depset([out]), runfiles = ctx.runfiles(files = [out]))]
7777

78-
sha256sum2url = rule(
78+
_sha256sum2url = rule(
7979
implementation = _sha256sum2url_impl,
8080
attrs = {
8181
"src": attr.label(allow_single_file = True),
8282
"_sha256sum2url_sh": attr.label(executable = True, cfg = "exec", default = "//bazel:sha256sum2url_sh"),
8383
},
8484
)
8585

86+
def sha256sum2url(name, src, tags = [], **kwargs):
87+
"""
88+
Returns cas url pointing to the artifact which checksum is returned by src.
89+
90+
The rule waits until the cache will return http/200 for this artifact.
91+
The rule adds "requires-network" as it needs to talk to bazel cache and "manual" to only be performed
92+
when its result is requested (directly or by another rule) to not wait when not required.
93+
94+
Args:
95+
name: the name of the rule
96+
src: the label that returns the file with sha256 checksum of requested artifact.
97+
tags: additinal tags.
98+
**kwargs: the rest of arguments to be passed to the underlying rule.
99+
"""
100+
_sha256sum2url(
101+
name = name,
102+
src = src,
103+
tags = tags + ["requires-network", "manual"],
104+
**kwargs
105+
)
106+
86107
def rust_test_suite_with_extra_srcs(name, srcs, extra_srcs, **kwargs):
87108
""" A rule for creating a test suite for a set of `rust_test` targets.
88109

0 commit comments

Comments
 (0)