1
0
forked from rosa/hakurei

internal/rosa: use type P in helper interface

This is easier to type and serialises correctly.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-03-31 23:45:01 +09:00
parent 6b78df8714
commit 52b1a5a725
6 changed files with 9 additions and 11 deletions

View File

@@ -144,11 +144,11 @@ func (attr *CMakeHelper) name(name, version string) string {
} }
// extra returns a hardcoded slice of [CMake] and [Ninja]. // extra returns a hardcoded slice of [CMake] and [Ninja].
func (attr *CMakeHelper) extra(int) []PArtifact { func (attr *CMakeHelper) extra(int) P {
if attr != nil && attr.Make { if attr != nil && attr.Make {
return []PArtifact{CMake, Make} return P{CMake, Make}
} }
return []PArtifact{CMake, Ninja} return P{CMake, Ninja}
} }
// wantsChmod returns false. // wantsChmod returns false.

View File

@@ -36,7 +36,7 @@ func init() {
Description: "a message bus system", Description: "a message bus system",
Website: "https://www.freedesktop.org/wiki/Software/dbus/", Website: "https://www.freedesktop.org/wiki/Software/dbus/",
Dependencies: []PArtifact{ Dependencies: P{
GLib, GLib,
Libexpat, Libexpat,
}, },

View File

@@ -84,8 +84,8 @@ func (*MakeHelper) name(name, version string) string {
} }
// extra returns make and other optional dependencies. // extra returns make and other optional dependencies.
func (attr *MakeHelper) extra(flag int) []PArtifact { func (attr *MakeHelper) extra(flag int) P {
extra := []PArtifact{Make} extra := P{Make}
if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 { if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 {
extra = append(extra, extra = append(extra,
Gawk, Gawk,

View File

@@ -72,9 +72,7 @@ func (*MesonHelper) name(name, version string) string {
} }
// extra returns hardcoded meson runtime dependencies. // extra returns hardcoded meson runtime dependencies.
func (*MesonHelper) extra(int) []PArtifact { func (*MesonHelper) extra(int) P { return P{Meson} }
return []PArtifact{Meson}
}
// wantsChmod returns false. // wantsChmod returns false.
func (*MesonHelper) wantsChmod() bool { return false } func (*MesonHelper) wantsChmod() bool { return false }

View File

@@ -135,7 +135,7 @@ func (t Toolchain) newViaPerlMakeMaker(
{"PREFIX", "/system"}, {"PREFIX", "/system"},
}, },
Check: []string{"test"}, Check: []string{"test"},
}, slices.Concat(extra, []PArtifact{ }, slices.Concat(extra, P{
Perl, Perl,
})...) })...)
} }

View File

@@ -409,7 +409,7 @@ type Helper interface {
// name returns the value passed to the name argument of [Toolchain.New]. // name returns the value passed to the name argument of [Toolchain.New].
name(name, version string) string name(name, version string) string
// extra returns helper-specific dependencies. // extra returns helper-specific dependencies.
extra(flag int) []PArtifact extra(flag int) P
// wantsChmod returns whether the source directory should be made writable. // wantsChmod returns whether the source directory should be made writable.
wantsChmod() bool wantsChmod() bool