allow to specify components to generate

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-01-13 08:08:55 +03:00
parent c5da16f9dd
commit 3e83d1c50a
2 changed files with 21 additions and 3 deletions

View File

@ -21,11 +21,11 @@ var Assets = func() http.FileSystem {
fs := vfsgen۰FS{
"/": &vfsgen۰DirInfo{
name: "/",
modTime: time.Date(2021, 1, 8, 19, 16, 4, 19648059, time.UTC),
modTime: time.Date(2021, 1, 12, 10, 40, 27, 967596087, time.UTC),
},
"/{{.File.Package}}_micro.pb.go.tmpl": &vfsgen۰CompressedFileInfo{
name: "{{.File.Package}}_micro.pb.go.tmpl",
modTime: time.Date(2021, 1, 12, 10, 38, 54, 81299017, time.UTC),
modTime: time.Date(2021, 1, 12, 10, 40, 27, 967596087, time.UTC),
uncompressedSize: 4844,
compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\xd4\x57\x4b\x6f\xdc\x36\x10\x3e\x47\xbf\x62\x20\x14\x81\x14\xac\xa5\x43\x6f\x5b\xe4\x90\x18\x09\x5a\xa0\x71\x82\xb8\x68\x0f\x41\x60\xd0\xd2\xac\x96\xb5\x96\x54\x49\x6a\x1d\x43\xd6\x7f\x2f\xf8\xd0\x8b\xab\xd5\x7a\x0d\xa3\x40\x7d\xb1\x48\xce\x37\x9c\xc7\x37\xb3\xc3\x34\x85\x4b\x9e\x23\x14\xc8\x50\x10\x85\x39\xdc\x3e\x40\x25\xb8\xe2\xd9\x45\x81\xec\x62\x47\x33\xc1\x83\x34\x05\xc9\x6b\x91\xe1\x1a\x9a\x26\xf9\x48\x4b\x4c\xae\xc8\x0e\xdb\x36\xa8\x48\x76\x47\x0a\x84\xa6\x29\xf8\x97\xbb\xe2\x77\x22\xd5\x87\x12\x77\xc8\x14\x18\x39\x78\x04\x59\x95\x54\xbd\x13\x82\x3c\x40\xf8\x4b\x08\x8f\x50\x12\xa9\xda\x36\x08\xe8\xae\xe2\x42\x41\x14\xbc\x0a\x33\xce\x14\xfe\x50\x61\x10\xbc\x32\x37\xde\x90\x8a\x42\x58\x50\xb5\xad\x6f\x93\x8c\xef\xd2\x9a\x51\xa9\x48\x76\x77\xc1\x45\x91\x1a\x91\x74\xff\x73\x4a\x2a\x1a\x02\x00\x74\xa8\xac\xa4\xfa\xe6\xd3\x40\x2b\x18\xf6\x40\x89\x62\x8f\xe2\x09\x40\x2b\x18\x06\x71\x10\x34\xcd\x05\xfc\x74\x8d\x62\x4f\x33\xd4\xd1\x80\xf5\x5b\x48\xdc\xda\x84\x07\x1e\x41\x09\xba\xbb\xae\x37\x1b\xfa\x03\x42\x77\x14\x82\xf6\x3d\x4d\xe1\x0a\xef\x9b\x66\xac\xa0\x6d\x3f\xb0\xbc\xe2\x94\x29\xa9\x53\xb0\xa7\x39\x4a\xd0\x81\xc0\x7e\x7b\x87\x2a\x27\x8a\xc0\x86\x0b\xf0\xc1\x20\xed\x2a\xd8\xd4\x2c\x5b\xd4\x1e\xc5\xf0\xed\xfb\x9b\x3e\xd0\x49\x77\x00\x4d\xa0\xa3\xb9\x27\x62\x74\xe5\xac\x64\x60\x04\x75\x04\x04\x61\x05\x0e\x7e\x7f\x42\xb5\xe5\x79\xdb\xf6\xe7\x74\x03\x8c\x2b\x88\x74\x86\x09\x65\x12\xa2\xbf\x25\x67\x10\x6d\x95\xaa\x3e\x57\x8a\x72\x06\x49\x1c\x43\xc8\xea\xb2\x0c\x63\xf0\x90\x68\x05\xff\x44\x71\x0b\x49\x0c\x61\xd8\x09\x74\xf6\xe9\xa0\xbf\x3e\xb4\xcf\x3a\xa2\xff\xb4\xeb\x6b\x08\xfd\x58\x24\x4d\xe3\x28\x1c\xae\x7a\xd9\x2f\x44\x6d\xd7\xf0\xed\xbb\x54\x82\xb2\xa2\x09\x9b\x46\x5f\xae\x77\x21\x69\xdb\xb0\x1d\x24\xad\x9b\x87\xb2\xd6\xd0\xa9\xac\xe7\xcb\x7b\x9e\x3f\x4c\x7d\xd1\x7f\x7a\xd7\x98\x39\x88\x4c\x4c\xd3\x4a\x90\xe5\x23\x84\x53\xcb\x05\x44\xc9\xa5\xa1\xf3\xb5\x12\x48\x76\x94\x15\x31\x44\x26\x21\x28\x86\xad\x11\xd2\x6e\xae\x41\x89\x1a\x97\x6e\xf8\x95\xb0\xbc\x44\xb1\x86\x50\x54\x99\xb3\xa5\xf5\x12\xdf\x05\x48\xbe\xcb\x73\xaa\xb3\x49\xca\xf7\x94\xe5\x94\x15\x12\x12\x3f\x59\x89\x09\xe5\x5b\x20\x55\x85\x2c\x8f\x26\xdb\x2b\xed\xbc\xf6\x39\x0e\x0e\xad\x19\xd8\x78\x00\x96\xab\xfe\x74\x0e\xb9\xb4\x12\xa8\x6a\xc1\x06\xe5\x81\xad\x4b\x9f\x2a\x6e\x01\x94\x29\x14\x1b\x92\x61\xa0\x1e\x2a\x3c\x2d\x66\xaa\x69\xb9\x44\x4c\x0b\x11\xf8\x8f\xdd\x32\x0d\xe4\x37\x56\xd5\xea\x0f\x7d\xc1\xb4\x73\x26\x5d\xe7\x84\x11\x52\x56\x23\xe4\xe7\x5a\x3d\x19\xda\x11\xc7\x67\xc9\x0c\x97\xc6\x18\xc2\xf2\x59\x90\xae\xf0\x79\xa0\x86\xba\x42\x8b\x5c\x93\x4f\x2e\xed\xff\x15\xbc\x69\x9a\xc1\xfb\xb6\x5d\x41\x92\x24\xe3\x46\x9e\x5c\x92\xb2\xb4\x4d\x22\x86\xc8\x0f\xf8\x4d\xaf\xd9\x6d\xaf\x00\x85\xe0\x22\x76\xf6\x62\x29\xf1\xb4\x0d\x2f\x7b\x25\x1b\xf2\xfa\xb4\xeb\xcf\x0b\x81\x91\xee\x92\xae\xa5\x8f\xdf\x6e\xbe\x5b\xfd\x2b\x75\x8c\x7e\xcf\x21\x5f\x0f\x3b\x93\x79\x06\x77\x1e\xe9\x66\x8b\xec\x20\x01\x5e\xb9\x01\xb8\xc8\x46\x31\x78\xb1\x36\xa7\xd7\xc8\xf2\x4f\xb2\x88\x7a\x54\xd3\xc6\x36\x88\xe6\xf8\x2b\x66\xfb\x85\xe3\x49\x15\x1c\xf6\x5c\x53\x05\x47\xfa\xae\xd6\xfc\x8e\xe5\x97\x25\x97\x18\x2d\x66\xd2\xef\x52\x1d\xe4\xc0\x0c\xdf\x02\x27\xaf\x5d\x8c\x3c\x5a\xf9\xe8\x69\x47\xd4\xba\x3c\xb3\x47\x56\x3f\xdd\x5a\xcb\x0d\xfb\x3d\x7c\xa5\x29\x7c\xd2\x84\x06\x37\x63\x49\x55\x6f\x36\xb3\x8d\xd6\xfd\xde\x74\x82\x5b\xbb\x9c\x27\x42\x27\x3b\x4e\xff\xab\xa5\x66\xfb\x9f\xb3\xfd\xfc\x26\x3b\x19\x98\x8e\x64\xf7\x9c\x56\xb2\x50\x3c\x46\xeb\x01\x2b\x9e\xd4\xb1\xce\xd6\x3a\xf0\xe1\x79\x1d\xd1\x23\x5f\xa7\x7f\x8e\x6b\xf6\x07\xfc\x2b\x16\x54\x2a\x14\xc7\x38\x23\xdc\xb9\xf4\x99\x66\x06\xe7\x13\xe8\x48\xc2\xf8\xc9\xe0\x92\xbb\x02\xb9\x3d\xc6\xd1\x15\xf0\x4a\xc9\xa1\xb1\x3b\xa0\x3b\xed\x7a\xbb\x71\xca\xf5\xb0\x19\xc6\x6b\x66\xf1\x7b\x14\x1f\xa9\xd0\xfc\x9a\xf2\xfe\xff\x4f\xfc\x13\x9c\x98\x46\x7c\x42\x33\x8f\x58\x2f\x44\x2e\x1b\x52\x4b\xaa\xf1\xf7\x30\x02\xcf\x76\x25\x90\x4a\xd4\x59\xf7\x8e\xb2\xb6\x2c\x64\x71\xa4\x6e\x6b\x1e\x32\x8b\xd2\x8e\x30\x8d\xdc\x5a\x88\x7e\x03\xde\xac\x26\x2f\x21\xcb\x81\x13\x4f\xbf\xc1\x38\xc3\xcb\x7e\xa2\xd6\xab\x2e\xd4\xfa\x2d\xf5\x17\x55\xdb\x0e\xd7\x8f\xdb\x71\x3c\x32\xda\x0d\xd0\xd2\x71\x39\x92\xc9\x15\xde\x77\x75\xf2\xda\xb7\xa1\xd9\xb6\xb6\x14\x92\x24\x89\x63\x3b\x9b\xbc\x34\x6d\xad\x5f\xcf\x25\x6f\x07\x7e\xd9\x41\xc5\xc8\x7a\x73\xca\xd2\x94\xb2\x38\xa3\x2c\x4e\x28\xcf\x9e\x4f\xf4\x95\xfd\x74\x72\xa4\x24\xa6\x93\x83\x3f\x95\x2c\xcd\x11\xc3\x44\x72\x4a\xeb\xd2\x64\x33\x99\x45\xc6\x25\x3c\x33\x03\xcf\x4f\x22\xff\x06\x00\x00\xff\xff\x2e\x87\x12\xc6\xec\x12\x00\x00"),

20
main.go
View File

@ -55,7 +55,7 @@ func main() {
all = false
singlePackageMode = false
fileMode = false
//components = ""
components = []string{"micro", "grpc"}
)
if parameter := g.Request.GetParameter(); parameter != "" {
for _, param := range strings.Split(parameter, ",") {
@ -103,6 +103,12 @@ func main() {
log.Printf("Err: invalid value for template_repo: %q", parts[1])
}
templateRepo = parts[1]
case "components":
_, err := url.Parse(parts[1])
if err != nil {
log.Printf("Err: invalid value for components: %q", parts[1])
}
components = strings.Split(parts[1], "|")
case "paths":
// TODO: handle paths=source_relative
default:
@ -154,6 +160,18 @@ func main() {
}
for _, f := range fi {
skip := true
for _, component := range components {
if component == "all" || strings.Contains(f.Name(), "_"+component+".pb.go") {
skip = false
}
}
if skip {
if debug {
log.Printf("skip template %s", f.Name())
}
continue
}
if debug {
log.Printf("copy template %s", f.Name())
}