horsegen: colocate koka and go outputs

This commit is contained in:
2026-01-15 14:13:18 -05:00
parent b844c4c24c
commit a04ec970f2
10 changed files with 15 additions and 19 deletions

View File

@@ -3,7 +3,7 @@ package main
import "os" import "os"
//go:generate go run ./horsegen //go:generate go run ./horsegen
//go:generate go generate ./go/... //go:generate go generate ./horse/...
//go:generate go fmt ./... //go:generate go fmt ./...
func main() { func main() {

View File

@@ -2,7 +2,7 @@ package global
// Automatically generated with horsegen; DO NOT EDIT // Automatically generated with horsegen; DO NOT EDIT
import . "git.sunturtle.xyz/zephyr/horse/go" import . "git.sunturtle.xyz/zephyr/horse/horse"
const ( const (
SkillWarningShot SkillID = 10071 // Warning Shot! SkillWarningShot SkillID = 10071 // Warning Shot!

View File

@@ -3,7 +3,7 @@ module horse/global/skill
// Automatically generated with horsegen; DO NOT EDIT // Automatically generated with horsegen; DO NOT EDIT
import std/num/decimal import std/num/decimal
pub import horse/skill-group pub import horse/global/skill-group
// Skill instances. // Skill instances.
pub type skill pub type skill

View File

@@ -7,8 +7,8 @@ import (
"sync" "sync"
"testing" "testing"
horse "git.sunturtle.xyz/zephyr/horse/go" "git.sunturtle.xyz/zephyr/horse/horse"
"git.sunturtle.xyz/zephyr/horse/go/global" "git.sunturtle.xyz/zephyr/horse/horse/global"
) )
var SortedSkills = sync.OnceValue(func() []horse.Skill { var SortedSkills = sync.OnceValue(func() []horse.Skill {

View File

@@ -20,7 +20,7 @@ func main() {
region string region string
) )
flag.StringVar(&mdb, "mdb", os.ExpandEnv(`$USERPROFILE\AppData\LocalLow\Cygames\Umamusume\master\master.mdb`), "`path` to Umamusume master.mdb") flag.StringVar(&mdb, "mdb", os.ExpandEnv(`$USERPROFILE\AppData\LocalLow\Cygames\Umamusume\master\master.mdb`), "`path` to Umamusume master.mdb")
flag.StringVar(&out, "o", `.`, "root `dir`ectory for output files") flag.StringVar(&out, "o", `.\horse`, "`dir`ectory for output files")
flag.StringVar(&region, "region", "global", "region the database is for (global, jp)") flag.StringVar(&region, "region", "global", "region the database is for (global, jp)")
flag.Parse() flag.Parse()
@@ -86,22 +86,18 @@ func main() {
os.Exit(1) os.Exit(1)
} }
if err := os.MkdirAll(filepath.Join(out, "horse", region), 0775); err != nil { if err := os.MkdirAll(filepath.Join(out, region), 0775); err != nil {
slog.Error("create koka output dir", slog.Any("err", err)) slog.Error("create output dir", slog.Any("err", err))
os.Exit(1)
}
if err := os.MkdirAll(filepath.Join(out, "go", region), 0775); err != nil {
slog.Error("create go output dir", slog.Any("err", err))
os.Exit(1) os.Exit(1)
} }
eg, ctx = errgroup.WithContext(pctx) eg, ctx = errgroup.WithContext(pctx)
eg.Go(func() error { eg.Go(func() error {
cf, err := os.Create(filepath.Join(out, "horse", region, "character.kk")) cf, err := os.Create(filepath.Join(out, region, "character.kk"))
if err != nil { if err != nil {
return err return err
} }
gf, err := os.Create(filepath.Join(out, "go", region, "character.go")) gf, err := os.Create(filepath.Join(out, region, "character.go"))
if err != nil { if err != nil {
return err return err
} }
@@ -109,16 +105,16 @@ func main() {
return ExecCharacter(t, region, cf, gf, charas, pairs, trios) return ExecCharacter(t, region, cf, gf, charas, pairs, trios)
}) })
eg.Go(func() error { eg.Go(func() error {
sf, err := os.Create(filepath.Join(out, "horse", region, "skill.kk")) sf, err := os.Create(filepath.Join(out, region, "skill.kk"))
if err != nil { if err != nil {
return err return err
} }
gf, err := os.Create(filepath.Join(out, "go", region, "skill.go")) gf, err := os.Create(filepath.Join(out, region, "skill.go"))
slog.Info("write skills") slog.Info("write skills")
return ExecSkill(t, region, sf, gf, sg, skills) return ExecSkill(t, region, sf, gf, sg, skills)
}) })
eg.Go(func() error { eg.Go(func() error {
sf, err := os.Create(filepath.Join(out, "horse", region, "skill-group.kk")) sf, err := os.Create(filepath.Join(out, region, "skill-group.kk"))
if err != nil { if err != nil {
return err return err
} }

View File

@@ -3,7 +3,7 @@ package {{ $.Region }}
// Automatically generated with horsegen; DO NOT EDIT // Automatically generated with horsegen; DO NOT EDIT
import . "git.sunturtle.xyz/zephyr/horse/go" import . "git.sunturtle.xyz/zephyr/horse/horse"
{{/* {{/*
//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type SkillID -trimprefix Skill -linecomment //go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type SkillID -trimprefix Skill -linecomment

View File

@@ -53,7 +53,7 @@ module horse/{{ $.Region }}/skill
// Automatically generated with horsegen; DO NOT EDIT // Automatically generated with horsegen; DO NOT EDIT
import std/num/decimal import std/num/decimal
pub import horse/skill-group pub import horse/{{ $.Region }}/skill-group
// Skill instances. // Skill instances.
pub type skill pub type skill