Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6afac1a4d9 | ||
|
|
79595e55be | ||
|
|
eefe00ebc5 | ||
|
|
eb5d15061c | ||
|
|
5c46824ebd |
@@ -18,3 +18,4 @@ result-*
|
|||||||
*.swp
|
*.swp
|
||||||
.idea/
|
.idea/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.direnv/
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
gotools
|
gotools
|
||||||
ffmpeg
|
ffmpeg
|
||||||
git
|
git
|
||||||
|
tea
|
||||||
gnumake
|
gnumake
|
||||||
bashInteractive
|
bashInteractive
|
||||||
shellcheck
|
shellcheck
|
||||||
|
|||||||
@@ -661,11 +661,17 @@ func collectAssetResources(p *project.Project, requireContent bool, allowed map[
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
assetsRelPath, err := filepath.Rel(p.Root, p.AssetsDir())
|
// A module-only project (consumes prebuilt HAKs, has no paths.assets) has no
|
||||||
|
// asset files to collect — AssetFiles is empty and AssetsDir() is "". Skip the
|
||||||
|
// relative-path resolve, which would otherwise fail with `Rel: can't make ""`.
|
||||||
|
assetsRelPath := ""
|
||||||
|
if p.AssetsDir() != "" {
|
||||||
|
assetsRelPath, err = filepath.Rel(p.Root, p.AssetsDir())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("resolve assets dir relative path: %w", err)
|
return nil, fmt.Errorf("resolve assets dir relative path: %w", err)
|
||||||
}
|
}
|
||||||
assetsRelPath = filepath.ToSlash(assetsRelPath)
|
assetsRelPath = filepath.ToSlash(assetsRelPath)
|
||||||
|
}
|
||||||
|
|
||||||
for _, rel := range p.Inventory.AssetFiles {
|
for _, rel := range p.Inventory.AssetFiles {
|
||||||
if musicAssets != nil {
|
if musicAssets != nil {
|
||||||
|
|||||||
@@ -435,7 +435,11 @@ func writeCreditsArtifacts(p *project.Project, generated []musicCreditGroup) (cr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err := filepath.WalkDir(p.AssetsDir(), func(path string, d os.DirEntry, walkErr error) error {
|
// Authored credits.md files live under the assets tree. A project with no
|
||||||
|
// configured assets dir (e.g. a module that consumes prebuilt HAKs) has none
|
||||||
|
// to collect — walking "" would fail with `lstat : no such file or directory`.
|
||||||
|
if assetsDir := p.AssetsDir(); assetsDir != "" {
|
||||||
|
err := filepath.WalkDir(assetsDir, func(path string, d os.DirEntry, walkErr error) error {
|
||||||
if walkErr != nil {
|
if walkErr != nil {
|
||||||
return walkErr
|
return walkErr
|
||||||
}
|
}
|
||||||
@@ -463,6 +467,7 @@ func writeCreditsArtifacts(p *project.Project, generated []musicCreditGroup) (cr
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return creditsArtifactWriteResult{}, err
|
return creditsArtifactWriteResult{}, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sort.Slice(sources, func(i, j int) bool { return sources[i].Path < sources[j].Path })
|
sort.Slice(sources, func(i, j int) bool { return sources[i].Path < sources[j].Path })
|
||||||
payload, err := json.MarshalIndent(music.CreditsInventory{Sources: sources}, "", " ")
|
payload, err := json.MarshalIndent(music.CreditsInventory{Sources: sources}, "", " ")
|
||||||
|
|||||||
@@ -4084,3 +4084,62 @@ haks:
|
|||||||
t.Fatalf("plan-only should not stage music, stat err=%v", err)
|
t.Fatalf("plan-only should not stage music, stat err=%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A module-only project (consumes prebuilt HAKs, no paths.assets) must build via
|
||||||
|
// the full `crucible module build` (pipeline.Build) without an assets tree. The
|
||||||
|
// HAK + music stages used to crash on the unset assets dir
|
||||||
|
// (`lstat : no such file or directory` / `Rel: can't make "" relative`).
|
||||||
|
func TestBuildModuleOnlyProjectWithoutAssetsDir(t *testing.T) {
|
||||||
|
root := t.TempDir()
|
||||||
|
mustMkdir(t, filepath.Join(root, "src", "module"))
|
||||||
|
mustMkdir(t, filepath.Join(root, "build"))
|
||||||
|
|
||||||
|
mustWriteFile(t, filepath.Join(root, "nwn-tool.yaml"), `
|
||||||
|
module:
|
||||||
|
name: Test Module
|
||||||
|
resref: testmod
|
||||||
|
paths:
|
||||||
|
source: src
|
||||||
|
build: build
|
||||||
|
`)
|
||||||
|
mustWriteFile(t, filepath.Join(root, "src", "module", "module.ifo.json"), `{
|
||||||
|
"file_type": "IFO ",
|
||||||
|
"file_version": "V3.2",
|
||||||
|
"root": {
|
||||||
|
"struct_type": 0,
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"label": "Mod_Name",
|
||||||
|
"type": "CExoString",
|
||||||
|
"value": "Test Module"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
p, err := project.Load(root)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("load project: %v", err)
|
||||||
|
}
|
||||||
|
if err := p.ValidateLayout(); err != nil {
|
||||||
|
t.Fatalf("validate layout: %v", err)
|
||||||
|
}
|
||||||
|
if err := p.Scan(); err != nil {
|
||||||
|
t.Fatalf("scan: %v", err)
|
||||||
|
}
|
||||||
|
if p.AssetsDir() != "" {
|
||||||
|
t.Fatalf("test precondition: expected unset assets dir, got %q", p.AssetsDir())
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := Build(p)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("full build of module-only project: %v", err)
|
||||||
|
}
|
||||||
|
if _, err := os.Stat(result.ModulePath); err != nil {
|
||||||
|
t.Fatalf("expected built .mod at %s: %v", result.ModulePath, err)
|
||||||
|
}
|
||||||
|
if result.HAKAssets != 0 {
|
||||||
|
t.Fatalf("module-only project has no assets, expected 0 HAK assets, got %d", result.HAKAssets)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
|
|
||||||
const autogenManifestCacheMaxAge = time.Hour
|
const autogenManifestCacheMaxAge = time.Hour
|
||||||
|
|
||||||
const defaultBunnyCDNBase = "https://depot.westgate.pw"
|
const defaultBunnyCDNBase = "https://cdn-a7f3k9.westgate.pw"
|
||||||
|
|
||||||
// errAutogenManifestUnavailable marks a released autogen manifest that could not
|
// errAutogenManifestUnavailable marks a released autogen manifest that could not
|
||||||
// be located or fetched (network failure, missing release/asset, empty payload,
|
// be located or fetched (network failure, missing release/asset, empty payload,
|
||||||
|
|||||||
@@ -3,3 +3,4 @@
|
|||||||
# wrappers/ changes. Add a repo here AND grant the sync bot write access to it.
|
# wrappers/ changes. Add a repo here AND grant the sync bot write access to it.
|
||||||
ShadowsOverWestgate/sow-module
|
ShadowsOverWestgate/sow-module
|
||||||
ShadowsOverWestgate/sow-topdata
|
ShadowsOverWestgate/sow-topdata
|
||||||
|
ShadowsOverWestgate/sow-assets-manifest
|
||||||
|
|||||||
Reference in New Issue
Block a user