Improved Logging
This commit is contained in:
@@ -272,13 +272,19 @@ func buildNativeUnchecked(p *project.Project, progress func(string)) (BuildResul
|
||||
globalKeyToID[key] = rowID
|
||||
}
|
||||
|
||||
groupTotals := nativeCompileGroupTotals(collected)
|
||||
groupStats := nativeCompileGroupStats(collected)
|
||||
currentGroup := ""
|
||||
for _, dataset := range collected {
|
||||
group := nativeCompileGroup(dataset.Dataset.Name)
|
||||
if group != currentGroup {
|
||||
currentGroup = group
|
||||
progress(fmt.Sprintf("Compiling %s datasets (%d tables)...", group, groupTotals[group]))
|
||||
stats := groupStats[group]
|
||||
progress(fmt.Sprintf(
|
||||
"Compiling %s datasets (%d output tables from %d source fragments)...",
|
||||
group,
|
||||
stats.OutputTables,
|
||||
stats.SourceFragments,
|
||||
))
|
||||
}
|
||||
compiled, err := resolveNativeDataset(dataset, globalKeyToID, globalRowByKey, tableRegistry, compiler)
|
||||
if err != nil {
|
||||
@@ -320,12 +326,41 @@ func nativeCompileGroup(datasetName string) string {
|
||||
}
|
||||
}
|
||||
|
||||
func nativeCompileGroupTotals(collected []nativeCollectedDataset) map[string]int {
|
||||
totals := make(map[string]int)
|
||||
type nativeCompileGroupStat struct {
|
||||
OutputTables int
|
||||
SourceFragments int
|
||||
}
|
||||
|
||||
func nativeCompileGroupStats(collected []nativeCollectedDataset) map[string]nativeCompileGroupStat {
|
||||
stats := make(map[string]nativeCompileGroupStat)
|
||||
for _, dataset := range collected {
|
||||
totals[nativeCompileGroup(dataset.Dataset.Name)]++
|
||||
group := nativeCompileGroup(dataset.Dataset.Name)
|
||||
groupStat := stats[group]
|
||||
groupStat.OutputTables++
|
||||
groupStat.SourceFragments += nativeDatasetSourceFragments(dataset.Dataset)
|
||||
stats[group] = groupStat
|
||||
}
|
||||
return totals
|
||||
return stats
|
||||
}
|
||||
|
||||
func nativeDatasetSourceFragments(dataset nativeDataset) int {
|
||||
fragments := 1
|
||||
if dataset.Kind == nativeDatasetBase {
|
||||
fragments += countModuleFiles(dataset.ModulesDir)
|
||||
fragments += countModuleFiles(dataset.GeneratedDir)
|
||||
}
|
||||
return fragments
|
||||
}
|
||||
|
||||
func countModuleFiles(dir string) int {
|
||||
if strings.TrimSpace(dir) == "" {
|
||||
return 0
|
||||
}
|
||||
paths, err := collectModulePaths(dir)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return len(paths)
|
||||
}
|
||||
|
||||
func discoverNativeDatasets(dataDir string) ([]nativeDataset, error) {
|
||||
|
||||
Reference in New Issue
Block a user