internal/rosa: extra inputs in alternative path
All checks were successful
Test / Create distribution (push) Successful in 1m5s
Test / Sandbox (push) Successful in 2m49s
Test / ShareFS (push) Successful in 3m45s
Test / Hakurei (push) Successful in 3m51s
Test / Sandbox (race detector) (push) Successful in 5m29s
Test / Hakurei (race detector) (push) Successful in 6m34s
Test / Flake checks (push) Successful in 1m23s

This works around particularly unwieldy build systems.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-21 15:02:53 +09:00
parent 40b33f9fc7
commit 1acb5b0105
2 changed files with 17 additions and 2 deletions

View File

@@ -142,6 +142,8 @@ var (
IdentInputs = unique.Make(Ident("inputs")) IdentInputs = unique.Make(Ident("inputs"))
// IdentRuntime has the same semantics as [IdentInputs]. // IdentRuntime has the same semantics as [IdentInputs].
IdentRuntime = unique.Make(Ident("runtime")) IdentRuntime = unique.Make(Ident("runtime"))
// IdentExtra has the same semantics as [IdentInputs].
IdentExtra = unique.Make(Ident("extra"))
// IdentSource is a special argument in a package declaration where an // IdentSource is a special argument in a package declaration where an
// assignment of a [Val] with a single [Ident] passes through the evaluator. // assignment of a [Val] with a single [Ident] passes through the evaluator.
IdentSource = unique.Make(Ident("source")) IdentSource = unique.Make(Ident("source"))
@@ -291,6 +293,7 @@ func evaluateAny(d PF, s []Frame, expr, rp any) bool {
for _, special := range [...]unique.Handle[Ident]{ for _, special := range [...]unique.Handle[Ident]{
IdentInputs, IdentInputs,
IdentRuntime, IdentRuntime,
IdentExtra,
} { } {
if slices.Contains(names, special) { if slices.Contains(names, special) {
if len(names) != 1 || len(arg.V) != 1 || arg.R { if len(names) != 1 || len(arg.V) != 1 || arg.R {

View File

@@ -926,7 +926,7 @@ func (ctx *evalContext) pf(
sourceA any sourceA any
helper Helper helper Helper
inputs, runtimes azalea.Array inputs, runtimes, extra azalea.Array
) )
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{ if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
k("description"): &meta.Description, k("description"): &meta.Description,
@@ -952,14 +952,17 @@ func (ctx *evalContext) pf(
k("exec"): &helper, k("exec"): &helper,
k("inputs"): &inputs, k("inputs"): &inputs,
k("runtime"): &runtimes, k("runtime"): &runtimes,
k("extra"): &extra,
}); err != nil { }); err != nil {
return return
} }
var inputsH P var inputsH, extraH P
if inputsH, err = toHandles(inputs); err != nil { if inputsH, err = toHandles(inputs); err != nil {
return return
} else if meta.Dependencies, err = toHandles(runtimes); err != nil { } else if meta.Dependencies, err = toHandles(runtimes); err != nil {
return return
} else if extraH, err = toHandles(extra); err != nil {
return
} }
meta.ID = int(anitya) meta.ID = int(anitya)
@@ -981,6 +984,15 @@ func (ctx *evalContext) pf(
}) })
} }
for _, h := range extraH {
_, a := ctx.t.MustLoad(h)
attr.Paths = append(attr.Paths, pkg.Path(
AbsUsrSrc.Append("extra", h.String()),
attr.Writable,
a,
))
}
for _, pair := range files { for _, pair := range files {
var pathname *check.Absolute var pathname *check.Absolute
if pathname, err = check.NewAbs(pair[0]); err != nil { if pathname, err = check.NewAbs(pair[0]); err != nil {