Enable plain TTY logging mode + loose-data processing
This commit is contained in:
+39
-16
@@ -503,6 +503,27 @@ func countModuleFiles(dir string) int {
|
||||
|
||||
func discoverNativeDatasets(dataDir string) ([]nativeDataset, error) {
|
||||
var datasets []nativeDataset
|
||||
appendPlainDataset := func(rootPath, filePath, relName string) error {
|
||||
tableData, err := loadJSONObject(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
outputName, _ := tableData["output"].(string)
|
||||
if strings.TrimSpace(outputName) == "" {
|
||||
outputName = nativeDatasetDefaultOutputName(filePath, nativeDatasetPlain)
|
||||
}
|
||||
datasets = append(datasets, nativeDataset{
|
||||
Kind: nativeDatasetPlain,
|
||||
Name: filepath.ToSlash(relName),
|
||||
RootPath: rootPath,
|
||||
BasePath: filePath,
|
||||
LockPath: filepath.Join(rootPath, "lock.json"),
|
||||
OutputName: outputName,
|
||||
Spec: specForDataset(filepath.ToSlash(relName)),
|
||||
CompareReference: optionalBool(tableData["compare_reference"], true),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
err := filepath.WalkDir(dataDir, func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -519,6 +540,23 @@ func discoverNativeDatasets(dataDir string) ([]nativeDataset, error) {
|
||||
return err
|
||||
}
|
||||
if rel == "." {
|
||||
entries, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() {
|
||||
continue
|
||||
}
|
||||
name := entry.Name()
|
||||
if !strings.HasSuffix(strings.ToLower(name), ".json") || name == "lock.json" || name == "base.json" {
|
||||
continue
|
||||
}
|
||||
filePath := filepath.Join(path, name)
|
||||
if err := appendPlainDataset(path, filePath, strings.TrimSuffix(name, filepath.Ext(name))); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if filepath.ToSlash(rel) == "parts/overrides" {
|
||||
@@ -564,24 +602,9 @@ func discoverNativeDatasets(dataDir string) ([]nativeDataset, error) {
|
||||
name := entry.Name()
|
||||
if strings.HasSuffix(strings.ToLower(name), ".json") && name != "lock.json" {
|
||||
filePath := filepath.Join(path, name)
|
||||
tableData, err := loadJSONObject(filePath)
|
||||
if err != nil {
|
||||
if err := appendPlainDataset(path, filePath, filepath.Join(rel, strings.TrimSuffix(name, filepath.Ext(name)))); err != nil {
|
||||
return err
|
||||
}
|
||||
outputName, _ := tableData["output"].(string)
|
||||
if strings.TrimSpace(outputName) == "" {
|
||||
outputName = nativeDatasetDefaultOutputName(filePath, nativeDatasetPlain)
|
||||
}
|
||||
datasets = append(datasets, nativeDataset{
|
||||
Kind: nativeDatasetPlain,
|
||||
Name: filepath.ToSlash(filepath.Join(rel, strings.TrimSuffix(name, filepath.Ext(name)))),
|
||||
RootPath: path,
|
||||
BasePath: filePath,
|
||||
LockPath: filepath.Join(path, "lock.json"),
|
||||
OutputName: outputName,
|
||||
Spec: specForDataset(filepath.ToSlash(filepath.Join(rel, strings.TrimSuffix(name, filepath.Ext(name))))),
|
||||
CompareReference: optionalBool(tableData["compare_reference"], true),
|
||||
})
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user