SD5, BG11, BLD10: the build modules' shared code moves into the delivery SDK
All of mesh-build-go's buildstep Go module leaves mesh-catalog for modules/mesh-delivery-sdk: the step run, fetch and release and the regenerate-and-compare step as the package steprun, the CPU share as steprun/buildcpu, the conformance kit as steprun/conformance, the seat generator as seatgen with cmd/seatgen, and cmd/mesh-pack. The three build modules and the builder's and checker's tests import the SDK and keep no copy; the SDK requires nothing of mesh-catalog. Code the build modules share is the delivery domain's SDK, not one module's package. It carries the build-module round's two new files of that package (dropdetected.go247c422f, storedbuilds.go904b8aed). Builds: design 47 G §464, §680, §327, §420, §495 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -10,9 +10,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep"
|
||||
buildrun "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildrun"
|
||||
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
|
||||
"git.novox.be/novox/mesh-sdk/go/forgekey"
|
||||
"git.novox.be/novox/mesh-sdk/go/health"
|
||||
)
|
||||
@@ -38,21 +38,21 @@ type Module struct {
|
||||
Work string
|
||||
Run forgekey.Runner
|
||||
// RemoteBase is where repositories are fetched from, "ssh://mesh-forge/" when empty; FetchOptions are the options of
|
||||
// the SDK's fetch and merge. A test points them at a local repository (buildstep.AllowFileRemote).
|
||||
// the SDK's fetch and merge. A test points them at a local repository (steprun.AllowFileRemote).
|
||||
RemoteBase string
|
||||
FetchOptions []buildstep.Option
|
||||
FetchOptions []steprun.Option
|
||||
Clock func() time.Time
|
||||
// Toolchains and Steps are the Put of the states of those names.
|
||||
Toolchains, Steps buildstep.Put
|
||||
Toolchains, Steps steprun.Put
|
||||
// ReadSteps and ReadToolchainsState read those two states back for the read tools (issue 1562).
|
||||
// Held is the puller whose running asks a step-end tool will not end (issue 1890); nil in a test.
|
||||
Held *buildstep.Puller
|
||||
Held *steprun.Puller
|
||||
ReadSteps, ReadToolchainsState StateRead
|
||||
// Detected and ReadDetected are the Put and the read of the state detected-steps (design 47 G §326, §414).
|
||||
Detected buildstep.Put
|
||||
Detected steprun.Put
|
||||
ReadDetected func(key string) (json.RawMessage, error)
|
||||
// Pauses is the Put of the pauses state, which keeps the node's pause key without an age; ReadPauses reads it back.
|
||||
Pauses buildstep.Put
|
||||
Pauses steprun.Put
|
||||
ReadPauses StateRead
|
||||
// ForgetPause deletes one key of the pauses state: a dropped ask's, once it is refused (the seat's verb drop).
|
||||
ForgetPause func(key string) error
|
||||
@@ -68,14 +68,14 @@ type Module struct {
|
||||
HTTP *http.Client
|
||||
// Call asks a registry seat's verb over the bus, the publish of a done build (publish.go): stdio.Ask when nil; a
|
||||
// test's fake holder.
|
||||
Call buildstep.SeatCall
|
||||
Call steprun.SeatCall
|
||||
// Bubblewrap reads the installed bubblewrap's version (ProbeBubblewrap): a step is refused, and the module is
|
||||
// unhealthy, while it is missing or older than BubblewrapLeast. Nil probes nothing.
|
||||
Bubblewrap func(ctx context.Context) (string, error)
|
||||
|
||||
// Floor refuses every step while the work or toolchain cache filesystem has less free than it (issue 1839); main
|
||||
// sets floorOf(node), and a zero Floor checks nothing.
|
||||
Floor buildstep.Floor
|
||||
Floor steprun.Floor
|
||||
|
||||
// Settings is the module's settings file, which holds the node's build capacity (sdkstep.CapacitySetting); Capacity,
|
||||
// when set, answers it instead (a test).
|
||||
@@ -83,7 +83,7 @@ type Module struct {
|
||||
Capacity func() int
|
||||
|
||||
spacesOnce sync.Once
|
||||
workspaces *buildstep.Workspaces
|
||||
workspaces *steprun.Workspaces
|
||||
mu sync.Mutex // guards Recipe
|
||||
install sync.Mutex // one install at a time
|
||||
}
|
||||
@@ -97,13 +97,13 @@ func (m *Module) recipe() Recipe {
|
||||
// guard is the SDK guard for the version the probe just read: the module names no Node version (ADR 0477 §2), so the
|
||||
// version wanted is the one installed and the guard refuses only when node cannot be run, writing the installed
|
||||
// version to <node>.typescript of the toolchains state every time.
|
||||
func (m *Module) guard(r Recipe, installed string, probeErr error) buildstep.Guard {
|
||||
return buildstep.Guard{Language: "typescript", Want: installed, Recipe: r.Version(), Node: m.Node, Put: m.reportingPut(),
|
||||
func (m *Module) guard(r Recipe, installed string, probeErr error) steprun.Guard {
|
||||
return steprun.Guard{Language: "typescript", Want: installed, Recipe: r.Version(), Node: m.Node, Put: m.reportingPut(),
|
||||
Probe: func(context.Context) (string, error) { return installed, probeErr }}
|
||||
}
|
||||
|
||||
// Check reads the installed toolchain, writes <node>.typescript of the toolchains state and answers nil, or the
|
||||
// refusal when node cannot be run (buildstep.Guard.Check); another version than another node's is no refusal (ADR 0477
|
||||
// refusal when node cannot be run (steprun.Guard.Check); another version than another node's is no refusal (ADR 0477
|
||||
// §2). It runs at start, before every step, at every health look and every CheckRound.
|
||||
func (m *Module) Check(ctx context.Context) error {
|
||||
_, err := m.check(ctx)
|
||||
@@ -115,7 +115,7 @@ func (m *Module) check(ctx context.Context) (string, error) {
|
||||
if m.Reload != nil {
|
||||
r, err := m.Reload()
|
||||
if err != nil {
|
||||
return "", &buildstep.Refusal{Text: err.Error()}
|
||||
return "", &steprun.Refusal{Text: err.Error()}
|
||||
}
|
||||
m.mu.Lock()
|
||||
m.Recipe = r
|
||||
@@ -186,7 +186,7 @@ func (m *Module) Health(ctx context.Context) health.Answer {
|
||||
// step refused with the cause named.
|
||||
func (m *Module) Long(tool string, run func(ctx context.Context, args map[string]any) (any, error)) func(map[string]any) (any, error) {
|
||||
return func(args map[string]any) (any, error) {
|
||||
id, err := buildstep.Start(m.Ctx, m.Steps, m.Node, tool, func(ctx context.Context) (any, error) {
|
||||
id, err := steprun.Start(m.Ctx, m.Steps, m.Node, tool, func(ctx context.Context) (any, error) {
|
||||
if err := m.Prepare(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -265,7 +265,7 @@ const ToolchainReported = "toolchain.reported"
|
||||
|
||||
// reportingPut is the toolchains Put that then emits toolchain.reported with the node and the language. A write that
|
||||
// failed emits nothing; an emit that failed is said and does not refuse the step.
|
||||
func (m *Module) reportingPut() buildstep.Put {
|
||||
func (m *Module) reportingPut() steprun.Put {
|
||||
return func(key string, value any) (uint64, error) {
|
||||
rev, err := m.Toolchains(key, value)
|
||||
if err != nil || m.Emit == nil {
|
||||
|
||||
Reference in New Issue
Block a user