Commit cec62c80 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #43000 from ncdc/protobuf-really-skip-non-output-packages

Automatic merge from submit-queue go-to-protobuf: actually skip - packages If a package is prefixed with -, we are not supposed to be generating protobuf for it. Make that actually happen :-) cc @smarterclayton @sttts @deads2k @liggitt @kubernetes/sig-api-machinery-pr-reviews
parents 4e172303 54b6edc4
...@@ -137,6 +137,7 @@ func Run(g *Generator) { ...@@ -137,6 +137,7 @@ func Run(g *Generator) {
protobufNames := NewProtobufNamer() protobufNames := NewProtobufNamer()
outputPackages := generator.Packages{} outputPackages := generator.Packages{}
nonOutputPackages := map[string]struct{}{}
for _, d := range strings.Split(g.Packages, ",") { for _, d := range strings.Split(g.Packages, ",") {
generateAllTypes, outputPackage := true, true generateAllTypes, outputPackage := true, true
switch { switch {
...@@ -160,6 +161,8 @@ func Run(g *Generator) { ...@@ -160,6 +161,8 @@ func Run(g *Generator) {
protobufNames.Add(p) protobufNames.Add(p)
if outputPackage { if outputPackage {
outputPackages = append(outputPackages, p) outputPackages = append(outputPackages, p)
} else {
nonOutputPackages[name] = struct{}{}
} }
} }
...@@ -198,6 +201,10 @@ func Run(g *Generator) { ...@@ -198,6 +201,10 @@ func Run(g *Generator) {
var vendoredOutputPackages, localOutputPackages generator.Packages var vendoredOutputPackages, localOutputPackages generator.Packages
for _, p := range protobufNames.packages { for _, p := range protobufNames.packages {
if _, ok := nonOutputPackages[p.Name()]; ok {
// if we're not outputting the package, don't include it in either package list
continue
}
p.Vendored = strings.Contains(c.Universe[p.PackagePath].SourcePath, "/vendor/") p.Vendored = strings.Contains(c.Universe[p.PackagePath].SourcePath, "/vendor/")
if p.Vendored { if p.Vendored {
vendoredOutputPackages = append(vendoredOutputPackages, p) vendoredOutputPackages = append(vendoredOutputPackages, p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment