Skip to content

Commit 87f0deb

Browse files
authored
Merge pull request #11 from dtolnay/devcomponent
Propagate rust_dev component name to ci_llvm
2 parents b6d3340 + dc9adb2 commit 87f0deb

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

stage0/defs.bzl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Stage0Info = provider(
1313
},
1414
)
1515

16+
CiArtifactInfo = provider(
17+
fields = {
18+
"component": str,
19+
},
20+
)
21+
1622
def _stage0_parse_impl(
1723
actions: AnalysisActions,
1824
stage0_artifact: ArtifactValue) -> list[Provider]:
@@ -284,7 +290,10 @@ def _ci_artifact_impl(ctx: AnalysisContext) -> list[Provider]:
284290
),
285291
)
286292

287-
return [DefaultInfo(default_output = download)]
293+
return [
294+
DefaultInfo(default_output = download),
295+
CiArtifactInfo(component = ctx.attrs.component),
296+
]
288297

289298
ci_artifact = rule(
290299
impl = _ci_artifact_impl,
@@ -300,14 +309,15 @@ ci_artifact = rule(
300309

301310
def _ci_llvm_impl(ctx: AnalysisContext) -> list[Provider]:
302311
rust_dev = ctx.attrs.rust_dev[DefaultInfo].default_outputs[0]
312+
component = ctx.attrs.rust_dev[CiArtifactInfo].component
303313

304314
contents, _ = unarchive(
305315
ctx = ctx,
306316
archive = rust_dev,
307317
output_name = "ci-llvm",
308318
ext_type = "tar.xz",
309319
excludes = [],
310-
strip_prefix = "rust-dev-nightly-{}/rust-dev".format(targets.exec_triple(ctx)),
320+
strip_prefix = "{}-{}/rust-dev".format(component, targets.exec_triple(ctx)),
311321
exec_deps = ctx.attrs._exec_deps[HttpArchiveExecDeps],
312322
prefer_local = False,
313323
sub_targets = {},
@@ -318,7 +328,7 @@ def _ci_llvm_impl(ctx: AnalysisContext) -> list[Provider]:
318328
ci_llvm = rule(
319329
impl = _ci_llvm_impl,
320330
attrs = {
321-
"rust_dev": attrs.dep(),
331+
"rust_dev": attrs.dep(providers = [DefaultInfo, CiArtifactInfo]),
322332
"_exec_deps": attrs.default_only(attrs.exec_dep(providers = [HttpArchiveExecDeps], default = "//platforms/exec:http_archive")),
323333
"_exec_os_type": attrs.default_only(attrs.dep(providers = [OsLookup], default = "//platforms/exec:os_lookup")),
324334
},

0 commit comments

Comments
 (0)