Files
mesh-delivery/modules/mesh-delivery-checker/internal/check/buildseats.go
T
jschoubben 71a35a6376 MV1: move contracts and sdk under modules/, importers follow
The delivery repository's contracts and SDK live under modules/ as
mesh-delivery-contracts and mesh-delivery-sdk, their Go module paths
renamed to match the folders (the TypeScript names already did), and
every importer in mesh-delivery, mesh-catalog, mesh-host, mesh-tools
and mesh-sdk follows in the same group: a design as it should be, one
path per module, checked by the group's check building every importer.

Builds: design 47 G §427, §88

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:09:56 +01:00

57 lines
2.1 KiB
Go

package check
import (
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"mesh-delivery-checker/rules"
)
// **The checker names no build module** (design 47 G A-82): a build module is the holder of a build seat found on the seat list
// (buildrun.BuildSeats), by the language of the toolchain its seat's acting rule `build` names. The checker's own logic keys on
// that language: the Go repositories and the manifests are judged by the build module of Go, a TypeScript module's by that of
// TypeScript.
// Languages of the toolchains the checker's logic is keyed on (the `on` of the build seats' acting rules).
const (
languageGo = rules.LanguageGo
languageTypeScript = rules.LanguageTypeScript
)
// buildModuleOf is the module that holds the build seat building a language's artifacts; the seat's name while no module is
// known to hold it or the seat list is not read, so a failure always names where it is.
func (j *Examiner) buildModuleOf(language string) string {
if m, err := j.Seats.For(language, ""); err == nil {
return m.Module
}
for _, m := range j.Seats.All() {
if m.Toolchain == language {
return m.Seat
}
}
ask := buildstep.AskGo
if language == languageTypeScript {
ask = buildstep.AskNode
}
seat, _ := buildstep.BuildSeat(ask)
return seat
}
// goModule is the build module the Go repositories are judged by.
func (j *Examiner) goModule() string { return j.buildModuleOf(languageGo) }
// goModule is the build module the manifests, the module graph and the checking program are judged by.
func (st *state) goModule() string { return st.j.goModule() }
// languageOf is the language of the toolchain a build module builds with, empty for a module no build seat names.
func (j *Examiner) languageOf(module string) string {
l, _ := j.Seats.LanguageOf(module)
return l
}
// askLanguageOf is the language of the asks the module's build seat takes (buildstep.AskGo, buildstep.AskNode, ...).
func (j *Examiner) askLanguageOf(module string) string {
if m, ok := j.Seats.OfModule(module); ok {
return m.AskLanguage()
}
return ""
}