A host the mesh builds knows what it was built for
novox/hq 04-ISSUES/161. The mesh compiled the host, published it, delivered it, and the launcher started it — and it would have refused the first declaration it was asked to apply, because it asks which system it was built for before applying anything and the answer was empty. The Makefile links that in. The mesh's toolchain deliberately takes nothing from the module, so it linked in nothing. The system is the stated exception, and ADR 0142 says why: the target is a property of the artifact rather than of the recipe, because a compiled binary is per system and a toolchain accepting it from the module would be accepting a build instruction. So the toolchain names the variable it fills and the artifact supplies the value. Named in the toolchain rather than inferred, and empty for a language whose output is not pinned to a system — which is every interpreted one, and a manifest declaring a system for those is already refused.
This commit is contained in:
@@ -877,6 +877,14 @@ func compile(ctx context.Context, run Runner, tree string, chain Toolchain,
|
||||
base,
|
||||
}
|
||||
invocation = append(invocation, chain.Compile...)
|
||||
// What it was built for, linked in. The compile line carries `-ldflags` already; this appends a
|
||||
// second one, which the Go linker accepts and merges. A host with no system refuses every
|
||||
// declaration before it applies anything (novox/hq 04-ISSUES/161), and it is the artifact that
|
||||
// knows — the target is a property of the artifact rather than of the recipe (ADR 0142).
|
||||
if chain.SystemStamp != "" && strings.TrimSpace(a.System) != "" {
|
||||
invocation = append(invocation, "-ldflags",
|
||||
"-X "+chain.SystemStamp+"="+strings.TrimSpace(a.System))
|
||||
}
|
||||
if chain.OutputFlag != "" {
|
||||
// A compiler pointed at a package is told the file to write, not the directory: the name a
|
||||
// machine runs it by is not always the name of the package that built it. The host's command
|
||||
|
||||
Reference in New Issue
Block a user