Merge pull request #124193 from soltysh/fix_applyconfig-gen
Update applyconfiguration generator for packages where paths differ in name
This commit is contained in:
		@@ -35,6 +35,7 @@ type applyConfigurationGenerator struct {
 | 
				
			|||||||
	generator.GoGenerator
 | 
						generator.GoGenerator
 | 
				
			||||||
	// outPkgBase is the base package, under which the "internal" and GV-specific subdirs live
 | 
						// outPkgBase is the base package, under which the "internal" and GV-specific subdirs live
 | 
				
			||||||
	outPkgBase   string // must be a Go import-path
 | 
						outPkgBase   string // must be a Go import-path
 | 
				
			||||||
 | 
						localPkg     string
 | 
				
			||||||
	groupVersion clientgentypes.GroupVersion
 | 
						groupVersion clientgentypes.GroupVersion
 | 
				
			||||||
	applyConfig  applyConfig
 | 
						applyConfig  applyConfig
 | 
				
			||||||
	imports      namer.ImportTracker
 | 
						imports      namer.ImportTracker
 | 
				
			||||||
@@ -49,9 +50,8 @@ func (g *applyConfigurationGenerator) Filter(_ *generator.Context, t *types.Type
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (g *applyConfigurationGenerator) Namers(*generator.Context) namer.NameSystems {
 | 
					func (g *applyConfigurationGenerator) Namers(*generator.Context) namer.NameSystems {
 | 
				
			||||||
	localPkg := path.Join(g.outPkgBase, g.groupVersion.Group.PackageName(), g.groupVersion.Version.PackageName())
 | 
					 | 
				
			||||||
	return namer.NameSystems{
 | 
						return namer.NameSystems{
 | 
				
			||||||
		"raw":          namer.NewRawNamer(localPkg, g.imports),
 | 
							"raw":          namer.NewRawNamer(g.localPkg, g.imports),
 | 
				
			||||||
		"singularKind": namer.NewPublicNamer(0),
 | 
							"singularKind": namer.NewPublicNamer(0),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -185,6 +185,7 @@ func targetForApplyConfigurationsPackage(outputDirBase, outputPkgBase, pkgSubdir
 | 
				
			|||||||
						OutputFilename: strings.ToLower(toGenerate.Type.Name.Name) + ".go",
 | 
											OutputFilename: strings.ToLower(toGenerate.Type.Name.Name) + ".go",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
					outPkgBase:   outputPkgBase,
 | 
										outPkgBase:   outputPkgBase,
 | 
				
			||||||
 | 
										localPkg:     outputPkg,
 | 
				
			||||||
					groupVersion: gv,
 | 
										groupVersion: gv,
 | 
				
			||||||
					applyConfig:  toGenerate,
 | 
										applyConfig:  toGenerate,
 | 
				
			||||||
					imports:      generator.NewImportTracker(),
 | 
										imports:      generator.NewImportTracker(),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user