File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -75,14 +75,35 @@ def _sha256sum2url_impl(ctx):
75
75
)
76
76
return [DefaultInfo (files = depset ([out ]), runfiles = ctx .runfiles (files = [out ]))]
77
77
78
- sha256sum2url = rule (
78
+ _sha256sum2url = rule (
79
79
implementation = _sha256sum2url_impl ,
80
80
attrs = {
81
81
"src" : attr .label (allow_single_file = True ),
82
82
"_sha256sum2url_sh" : attr .label (executable = True , cfg = "exec" , default = "//bazel:sha256sum2url_sh" ),
83
83
},
84
84
)
85
85
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
+
86
107
def rust_test_suite_with_extra_srcs (name , srcs , extra_srcs , ** kwargs ):
87
108
""" A rule for creating a test suite for a set of `rust_test` targets.
88
109
You can’t perform that action at this time.
0 commit comments