mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-19 01:47:43 +08:00

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>
35 lines
770 B
Go
35 lines
770 B
Go
// Copyright (c) 2021 PlanetScale Inc. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package grpc
|
|
|
|
import (
|
|
"github.com/planetscale/vtprotobuf/generator"
|
|
"google.golang.org/protobuf/compiler/protogen"
|
|
)
|
|
|
|
const version = "1.1.0-vtproto"
|
|
|
|
var requireUnimplementedAlways = true
|
|
var requireUnimplemented = &requireUnimplementedAlways
|
|
|
|
func init() {
|
|
generator.RegisterFeature("grpc", func(gen *generator.GeneratedFile) generator.FeatureGenerator {
|
|
return &grpc{gen}
|
|
})
|
|
}
|
|
|
|
type grpc struct {
|
|
*generator.GeneratedFile
|
|
}
|
|
|
|
func (g *grpc) GenerateFile(file *protogen.File) bool {
|
|
if len(file.Services) == 0 {
|
|
return false
|
|
}
|
|
|
|
generateFileContent(nil, file, g.GeneratedFile)
|
|
return true
|
|
}
|