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
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:
@@ -142,6 +142,8 @@ var (
|
||||
IdentInputs = unique.Make(Ident("inputs"))
|
||||
// IdentRuntime has the same semantics as [IdentInputs].
|
||||
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
|
||||
// assignment of a [Val] with a single [Ident] passes through the evaluator.
|
||||
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]{
|
||||
IdentInputs,
|
||||
IdentRuntime,
|
||||
IdentExtra,
|
||||
} {
|
||||
if slices.Contains(names, special) {
|
||||
if len(names) != 1 || len(arg.V) != 1 || arg.R {
|
||||
|
||||
@@ -926,7 +926,7 @@ func (ctx *evalContext) pf(
|
||||
sourceA any
|
||||
helper Helper
|
||||
|
||||
inputs, runtimes azalea.Array
|
||||
inputs, runtimes, extra azalea.Array
|
||||
)
|
||||
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
|
||||
k("description"): &meta.Description,
|
||||
@@ -952,14 +952,17 @@ func (ctx *evalContext) pf(
|
||||
k("exec"): &helper,
|
||||
k("inputs"): &inputs,
|
||||
k("runtime"): &runtimes,
|
||||
k("extra"): &extra,
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
var inputsH P
|
||||
var inputsH, extraH P
|
||||
if inputsH, err = toHandles(inputs); err != nil {
|
||||
return
|
||||
} else if meta.Dependencies, err = toHandles(runtimes); err != nil {
|
||||
return
|
||||
} else if extraH, err = toHandles(extra); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
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 {
|
||||
var pathname *check.Absolute
|
||||
if pathname, err = check.NewAbs(pair[0]); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user