B-D14b/W4.8: the toolchain gate takes the build modules a part finds, as it finds them (issue 1966)
Design 47 *A module's registration*, "No part fixes a name" (b229f5c4 lines 482-485): the indexer finds the build modules from the seat list's acts and the manifests, after the gate is made, so the gate takes them by UseModules and passes its reports on again. Row in TestToolchainGate: a module given later passes on at the assignments only once given (fails without UseModules). Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ Builds: design 47 G §364, §428, §535
This commit is contained in:
@@ -60,6 +60,19 @@ func NewToolchainGate(modules []string, forward func(module, key string, value [
|
||||
return g
|
||||
}
|
||||
|
||||
// UseModules replaces the build modules whose reports the gate passes on again when the assignments moves (a part that
|
||||
// finds them from the seat list and the manifests, as the indexer does, gives them at each change), and passes every
|
||||
// report it holds on again. It answers whether what it passed on changed.
|
||||
func (g *ToolchainGate) UseModules(modules []string) bool {
|
||||
g.mu.Lock()
|
||||
defer g.mu.Unlock()
|
||||
g.modules = map[string]bool{}
|
||||
for _, m := range modules {
|
||||
g.modules[m] = true
|
||||
}
|
||||
return g.all()
|
||||
}
|
||||
|
||||
// Toolchain takes one change of a build module's toolchains bucket in and answers whether what it passed on changed.
|
||||
func (g *ToolchainGate) Toolchain(module, key string, value []byte, deleted bool) bool {
|
||||
g.mu.Lock()
|
||||
|
||||
@@ -112,6 +112,23 @@ func TestToolchainGate(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("build modules given later pass their reports on when the assignments moves", func(t *testing.T) {
|
||||
set := &ToolchainSet{}
|
||||
gate := NewToolchainGate(nil, set.Put, func(string, ...any) {})
|
||||
gate.Settled()
|
||||
k, v := placing(t, "novox", GoBuildModule)
|
||||
gate.Assignments(k, v, false, old)
|
||||
key, value := gateReport(t, "ace", "v26.12.1", placed.Add(time.Minute))
|
||||
gate.Toolchain(NodeBuildModule, key, value, false) // ace is not placed: left out
|
||||
k, v = placing(t, "ace", NodeBuildModule)
|
||||
if gate.Assignments(k, v, false, placed) || len(set.Entries("typescript")) != 0 {
|
||||
t.Fatalf("a module the gate was not given passed on at the assignments: %v", set.Entries("typescript"))
|
||||
}
|
||||
if !gate.UseModules([]string{NodeBuildModule}) || len(set.Entries("typescript")) != 1 {
|
||||
t.Fatalf("given mesh-build-node, ace's report placed since is passed on; entries %v", set.Entries("typescript"))
|
||||
}
|
||||
})
|
||||
|
||||
for _, c := range []struct {
|
||||
name string
|
||||
at time.Time // when ace wrote its report
|
||||
|
||||
Reference in New Issue
Block a user