Add topdata bridge commands and handoff

This commit is contained in:
2026-04-02 21:40:59 +02:00
parent 7c8d58586a
commit d67b6e3f12
6 changed files with 1083 additions and 5 deletions
+46 -3
View File
@@ -29,9 +29,10 @@ type Project struct {
}
type Config struct {
Module ModuleConfig `json:"module"`
Paths PathConfig `json:"paths"`
HAKs []HAKConfig `json:"haks"`
Module ModuleConfig `json:"module"`
Paths PathConfig `json:"paths"`
HAKs []HAKConfig `json:"haks"`
TopData TopDataConfig `json:"topdata"`
}
type ModuleConfig struct {
@@ -55,6 +56,12 @@ type HAKConfig struct {
Include []string `json:"include"`
}
type TopDataConfig struct {
Source string `json:"source"`
Build string `json:"build"`
ReferenceBuilder string `json:"reference_builder"`
}
type Inventory struct {
SourceFiles []string
ScriptFiles []string
@@ -211,6 +218,39 @@ func (p *Project) BuildDir() string {
return filepath.Join(p.Root, p.Config.Paths.Build)
}
func (p *Project) HasTopData() bool {
return strings.TrimSpace(p.Config.TopData.Source) != ""
}
func (p *Project) TopDataSourceDir() string {
if !p.HasTopData() {
return ""
}
return filepath.Join(p.Root, p.Config.TopData.Source)
}
func (p *Project) TopDataBuildDir() string {
buildPath := strings.TrimSpace(p.Config.TopData.Build)
if buildPath == "" {
buildPath = filepath.Join(p.Config.Paths.Build, "topdata")
}
if filepath.IsAbs(buildPath) {
return buildPath
}
return filepath.Join(p.Root, buildPath)
}
func (p *Project) TopDataReferenceBuilderDir() string {
ref := strings.TrimSpace(p.Config.TopData.ReferenceBuilder)
if ref == "" {
return ""
}
if filepath.IsAbs(ref) {
return ref
}
return filepath.Join(p.Root, ref)
}
func (i Inventory) Report() InventoryReport {
return InventoryReport{
SourceFiles: len(i.SourceFiles),
@@ -227,6 +267,9 @@ func defaultConfig() Config {
Assets: "assets",
Build: "build",
},
TopData: TopDataConfig{
Build: "build/topdata",
},
}
}