feat(nwsync): emit blobs and per-artifact NSYM, assemble merged manifests
Adds `crucible nwsync emit` and `crucible nwsync assemble`, the split replacement for upstream nwn_nwsync_write, which cannot be used because it wants every hak, the TLK and the module present in one run on one disk. emit explodes one artifact — a .hak/.erf or a loose file such as the TLK — into NWSync blobs (NWCompressedBuffer framing, magic NSYC, zstd) plus a NSYM v3 manifest describing only that artifact, with the same .json sidecar upstream writes. Blob names are the sha1 of the uncompressed bytes, restypes nss/ndb/gic are always skipped, an unresolvable restype is a hard error, a resource over 15 MB fails closed, and no latest or .origin file is ever written. assemble merges the per-artifact manifests into one, reading no bulk data. The merge rule is resref shadowing, not concatenation: a resref present in more than one artifact resolves to the earliest artifact in --order, the way the game resolves it. It refuses to merge across mismatched emitter versions, and takes --group-id from the caller (1 current, 2 testing; 0 is absent). Refs #53.
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/buildinfo"
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/depot"
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/menu"
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/nwsync"
|
||||
)
|
||||
|
||||
// Exit codes follow the sysexits(3) convention so CI can distinguish
|
||||
@@ -104,6 +105,16 @@ var Registry = []Builder{
|
||||
},
|
||||
Wired: true,
|
||||
},
|
||||
{
|
||||
Name: "nwsync",
|
||||
Bin: "crucible-nwsync",
|
||||
Summary: "publish NWSync blobs and manifests (emit/assemble)",
|
||||
Commands: []Command{
|
||||
{Name: "emit", Summary: "explode one artifact into blobs plus its own NSYM manifest", Usage: "crucible nwsync emit <artifact> --out DIR"},
|
||||
{Name: "assemble", Summary: "merge per-artifact NSYM manifests into one", Usage: "crucible nwsync assemble --order NAMES --entries DIR --out DIR [--group-id N]"},
|
||||
},
|
||||
Wired: true,
|
||||
},
|
||||
{
|
||||
Name: "assets",
|
||||
Bin: "crucible-assets",
|
||||
@@ -241,7 +252,7 @@ var Registry = []Builder{
|
||||
"2da-to-module [flags] <input.2da> [output.json]",
|
||||
"json-to-2da <input.json> <output.2da>",
|
||||
},
|
||||
Aliases: []CommandAlias{{Name: "convert-topdata"}},
|
||||
Aliases: []CommandAlias{{Name: "convert-topdata"}},
|
||||
},
|
||||
},
|
||||
Wired: true,
|
||||
@@ -392,7 +403,7 @@ func runBuilder(name string, args []string, out, errw io.Writer) int {
|
||||
}
|
||||
}
|
||||
if b.Wired {
|
||||
// depot and assets are self-contained builders: they parse their own
|
||||
// depot, assets and nwsync are self-contained builders: they parse their own
|
||||
// subcommands and own their exit contract, bypassing the
|
||||
// b.Commands/delegateLegacy legacy routing entirely.
|
||||
switch b.Name {
|
||||
@@ -400,6 +411,8 @@ func runBuilder(name string, args []string, out, errw io.Writer) int {
|
||||
return depot.Run(args, out, errw, os.Getenv)
|
||||
case "assets":
|
||||
return assets.Run(args, out, errw, os.Getenv)
|
||||
case "nwsync":
|
||||
return nwsync.Run(args, out, errw)
|
||||
}
|
||||
}
|
||||
if !b.Wired {
|
||||
|
||||
@@ -148,6 +148,10 @@ func TestBuilderHelpIsOK(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// selfContained builders parse their own subcommands instead of delegating to
|
||||
// the legacy internal/app surface.
|
||||
var selfContained = map[string]bool{"depot": true, "assets": true, "nwsync": true}
|
||||
|
||||
func TestCanonicalCommandSurface(t *testing.T) {
|
||||
want := map[string][]string{
|
||||
"depot": {"status", "push", "verify", "get", "pull"},
|
||||
@@ -156,6 +160,7 @@ func TestCanonicalCommandSurface(t *testing.T) {
|
||||
"module": {"build", "extract", "validate", "compare", "manifest"},
|
||||
"topdata": {"validate", "build", "package", "compare", "convert"},
|
||||
"wiki": {"build", "deploy"},
|
||||
"nwsync": {"emit", "assemble"},
|
||||
}
|
||||
for _, builder := range Registry {
|
||||
got := builder.subcommands()
|
||||
@@ -173,10 +178,10 @@ func TestRegistryCommandNamesAndAliasesAreUnambiguous(t *testing.T) {
|
||||
for _, builder := range Registry {
|
||||
seen := map[string]bool{}
|
||||
for _, command := range builder.Commands {
|
||||
// depot and assets parse their own subcommands and bypass AppCommand
|
||||
// routing entirely (see the self-contained-builder branch in
|
||||
// runBuilder), so their Commands carry no AppCommand.
|
||||
requireAppCommand := builder.Name != "depot" && builder.Name != "assets"
|
||||
// depot, assets and nwsync parse their own subcommands and bypass
|
||||
// AppCommand routing entirely (see the self-contained-builder branch
|
||||
// in runBuilder), so their Commands carry no AppCommand.
|
||||
requireAppCommand := !selfContained[builder.Name]
|
||||
if command.Name == "" || command.Summary == "" || command.Usage == "" || (requireAppCommand && command.AppCommand == "") {
|
||||
t.Errorf("%s has incomplete command metadata: %#v", builder.Name, command)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user