Add topdata bridge commands and handoff
This commit is contained in:
@@ -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",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user