Skip to content

Commit 6368fde

Browse files
authored
[sysroot] Support integrity and strip attributes (#587)
1 parent 5ff9773 commit 6368fde

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

toolchain/sysroot.bzl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ def _sysroot_impl(rctx):
1010

1111
_, _, archive = urls[0].rpartition("/")
1212

13-
rctx.download(urls, archive, sha256 = rctx.attr.sha256)
13+
rctx.download(
14+
urls,
15+
archive,
16+
integrity = rctx.attr.integrity,
17+
sha256 = rctx.attr.sha256,
18+
)
1419

1520
# Source directories are more efficient than file groups for 2 reasons:
1621
# - They can be symlinked into a local sandbox with a single symlink instead of 1-per-file
@@ -39,6 +44,8 @@ def _sysroot_impl(rctx):
3944
archive,
4045
"--directory",
4146
"sysroot",
47+
"--strip-components",
48+
str(rctx.attr.strip_components),
4249
]
4350

4451
for include in rctx.attr.include_patterns:
@@ -63,7 +70,11 @@ sysroot = repository_rule(
6370
attrs = {
6471
"url": attr.string(),
6572
"urls": attr.string_list(),
73+
"strip_components": attr.int(
74+
doc = "Number of components to strip when extracting (similar to strip_prefix).",
75+
),
6676
"sha256": attr.string(),
77+
"integrity": attr.string(),
6778
"include_patterns": attr.string_list(),
6879
"exclude_patterns": attr.string_list(),
6980
},

0 commit comments

Comments
 (0)