The console's build tool has the command's three shapes: a repository, a base (--on), everything behind
Rebuilding the forty-three modules that stand on the runtime image took forty-three tool calls because the seat verb only knew a repository. `on` rebuilds every module built on a base, `behind` rebuilds what is older than its source, both asked and not waited for, the daemon taking each result in (issue 176). Nothing is required any more; a build naming nothing is refused by the command's usage.
This commit is contained in:
@@ -102,6 +102,15 @@ func argvFor(verb string, args map[string]any) ([]string, error) {
|
|||||||
// the answer the caller needs.
|
// the answer the caller needs.
|
||||||
return []string{"rotate"}, nil
|
return []string{"rotate"}, nil
|
||||||
case "build":
|
case "build":
|
||||||
|
// Three shapes, as the command has them: a repository, a base every module built on it
|
||||||
|
// is rebuilt from (`--on`), or everything behind its source (`--behind`). Asked, not
|
||||||
|
// waited for, the same as a single build.
|
||||||
|
if on := str("on"); on != "" {
|
||||||
|
return []string{"build", "--on", on, "--wait", "0"}, nil
|
||||||
|
}
|
||||||
|
if b := str("behind"); b != "" && b != "no" && b != "false" {
|
||||||
|
return []string{"build", "--behind", "--wait", "0"}, nil
|
||||||
|
}
|
||||||
if err := need("repository"); err != nil {
|
if err := need("repository"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,3 +139,19 @@ func TestAJSONVerbsAnswerIsItsStandardOutput(t *testing.T) {
|
|||||||
t.Fatalf("stderr and stdout are both what the command said: %s", answer.Output)
|
t.Fatalf("stderr and stdout are both what the command said: %s", answer.Output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The build tool has the command's three shapes (ADR 0157's follow-up, 2026-10-01): a repository, a
|
||||||
|
// base whose dependents are rebuilt, or everything behind its source — each asked, not waited for.
|
||||||
|
func TestTheBuildToolRebuildsWhatStandsOnABase(t *testing.T) {
|
||||||
|
argv, _ := argvFor("build", map[string]any{"on": "mesh-tools"})
|
||||||
|
if strings.Join(argv, " ") != "build --on mesh-tools --wait 0" {
|
||||||
|
t.Fatalf("a base: %v", argv)
|
||||||
|
}
|
||||||
|
argv, _ = argvFor("build", map[string]any{"behind": "yes"})
|
||||||
|
if strings.Join(argv, " ") != "build --behind --wait 0" {
|
||||||
|
t.Fatalf("behind: %v", argv)
|
||||||
|
}
|
||||||
|
if _, err := argvFor("build", map[string]any{}); err == nil {
|
||||||
|
t.Fatal("a build naming nothing was accepted")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -113,10 +113,12 @@ var ControllerVerbs = []Verb{
|
|||||||
{Name: "build", Description: "Have the build machine build a repository. Answers at once with the build's id: " +
|
{Name: "build", Description: "Have the build machine build a repository. Answers at once with the build's id: " +
|
||||||
"`builds` with that id follows it line by line, and the module is registered when the outcome comes.",
|
"`builds` with that id follows it line by line, and the module is registered when the outcome comes.",
|
||||||
Input: schema(map[string]string{
|
Input: schema(map[string]string{
|
||||||
|
"on": "instead of a repository: a module whose artifacts others stand on; every module built on it is rebuilt (the rebuild a changed base needs)",
|
||||||
|
"behind": "instead of a repository: \"yes\" rebuilds every module the mesh holds older than its source has",
|
||||||
"repository": "the repository's URL, or its path on the forge holding the git seat (owner/name)",
|
"repository": "the repository's URL, or its path on the forge holding the git seat (owner/name)",
|
||||||
"path": "the module's directory inside it (optional)",
|
"path": "the module's directory inside it (optional)",
|
||||||
"ref": "the branch, tag or commit to build (optional)",
|
"ref": "the branch, tag or commit to build (optional)",
|
||||||
}, []string{"repository"})},
|
}, nil)},
|
||||||
}
|
}
|
||||||
|
|
||||||
// schema is a JSON schema for an object of string properties, which is every argument the verbs
|
// schema is a JSON schema for an object of string properties, which is every argument the verbs
|
||||||
|
|||||||
Reference in New Issue
Block a user