The current layers.idx
format is quite verbose and also needs custom parsing code if third-parties are to read it.
We could probably improve the situation by writing layer details only once. We could also use folder names in the index if all sub-files are in the same layer.
Comment From: philwebb
We're going to try a YAML compatible format that looks like this:
- "test":
- "BOOT-INF/lib/a.jar"
- "BOOT-INF/lib/b.jar"
- "application":
- "BOOT-INF/classes/Demo.class"
- "META-INF/"
Entries that end /
mean everything in that folder is in the same layer.
The file above can be parsed in Go quite easily:
package main
import (
"fmt"
"gopkg.in/yaml.v2"
)
type Layer map[string][]string
func main() {
data := `[{"deps": ["a", "b"]}, {"app": ["c", "d"]}]`
layers := make([]Layer, 0)
err := yaml.Unmarshal([]byte(data), &layers)
if err != nil {
panic(err)
}
for _, layer := range layers {
for name, entries := range layer {
fmt.Println(name, "=>", entries)
}
}
}