mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 13:37:08 +08:00
hack: generate vtproto files for buildx
Integrates vtproto into buildx. The generated files dockerfile has been modified to copy the buildkit equivalent file to ensure files are laid out in the appropriate way for imports. An import has also been included to change the grpc codec to the version in buildkit that supports vtproto. This will allow buildx to utilize the speed and memory improvements from that. Also updates the gc control options for prune. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
41
vendor/github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto/main.go
generated
vendored
Normal file
41
vendor/github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto/main.go
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"strings"
|
||||
|
||||
_ "github.com/planetscale/vtprotobuf/features/clone"
|
||||
_ "github.com/planetscale/vtprotobuf/features/equal"
|
||||
_ "github.com/planetscale/vtprotobuf/features/grpc"
|
||||
_ "github.com/planetscale/vtprotobuf/features/marshal"
|
||||
_ "github.com/planetscale/vtprotobuf/features/pool"
|
||||
_ "github.com/planetscale/vtprotobuf/features/size"
|
||||
_ "github.com/planetscale/vtprotobuf/features/unmarshal"
|
||||
"github.com/planetscale/vtprotobuf/generator"
|
||||
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var cfg generator.Config
|
||||
var features string
|
||||
var f flag.FlagSet
|
||||
|
||||
f.BoolVar(&cfg.AllowEmpty, "allow-empty", false, "allow generation of empty files")
|
||||
cfg.Poolable = generator.NewObjectSet()
|
||||
cfg.PoolableExclude = generator.NewObjectSet()
|
||||
f.Var(&cfg.Poolable, "pool", "use memory pooling for this object")
|
||||
f.Var(&cfg.PoolableExclude, "pool-exclude", "do not use memory pooling for this object")
|
||||
f.BoolVar(&cfg.Wrap, "wrap", false, "generate wrapper types")
|
||||
f.StringVar(&features, "features", "all", "list of features to generate (separated by '+')")
|
||||
f.StringVar(&cfg.BuildTag, "buildTag", "", "the go:build tag to set on generated files")
|
||||
|
||||
protogen.Options{ParamFunc: f.Set}.Run(func(plugin *protogen.Plugin) error {
|
||||
gen, err := generator.NewGenerator(plugin, strings.Split(features, "+"), &cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
gen.Generate()
|
||||
return nil
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user