Rename output-package -> output-pkg

To parallel "output-dir".
This commit is contained in:
Tim Hockin 2024-01-16 18:22:35 -08:00
parent 6a375b8f4c
commit 26a1a13b80
No known key found for this signature in database
12 changed files with 43 additions and 43 deletions

View File

@ -553,7 +553,7 @@ function codegen::openapi() {
--go-header-file "${BOILERPLATE_FILENAME}" \
--output-file-base "${output_file}" \
--output-dir "${output_dir}" \
--output-package "${output_pkg}" \
--output-pkg "${output_pkg}" \
--report-filename "${report_file}" \
$(printf -- " -i %s" "${tag_pkgs[@]}") \
"$@"
@ -609,7 +609,7 @@ function codegen::applyconfigs() {
--openapi-schema <("${modelsschema}") \
--go-header-file "${BOILERPLATE_FILENAME}" \
--output-dir "${KUBE_ROOT}/staging/src/${APPLYCONFIG_PKG}" \
--output-package "${APPLYCONFIG_PKG}" \
--output-pkg "${APPLYCONFIG_PKG}" \
$(printf -- " --input-dirs %s" "${ext_apis[@]}") \
"$@"
@ -662,7 +662,7 @@ function codegen::clients() {
-v "${KUBE_VERBOSE}" \
--go-header-file "${BOILERPLATE_FILENAME}" \
--output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go" \
--output-package="k8s.io/client-go" \
--output-pkg="k8s.io/client-go" \
--clientset-name="kubernetes" \
--input-base="k8s.io/api" \
--apply-configuration-package "${APPLYCONFIG_PKG}" \
@ -707,7 +707,7 @@ function codegen::listers() {
-v "${KUBE_VERBOSE}" \
--go-header-file "${BOILERPLATE_FILENAME}" \
--output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go/listers" \
--output-package "k8s.io/client-go/listers" \
--output-pkg "k8s.io/client-go/listers" \
$(printf -- " --input-dirs %s" "${ext_apis[@]}") \
"$@"
@ -749,7 +749,7 @@ function codegen::informers() {
-v "${KUBE_VERBOSE}" \
--go-header-file "${BOILERPLATE_FILENAME}" \
--output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go/informers" \
--output-package "k8s.io/client-go/informers" \
--output-pkg "k8s.io/client-go/informers" \
--single-directory \
--versioned-clientset-package "k8s.io/client-go/kubernetes" \
--listers-package "k8s.io/client-go/listers" \

View File

@ -27,7 +27,7 @@ import (
// CustomArgs is a wrapper for arguments to applyconfiguration-gen.
type CustomArgs struct {
OutputDir string // must be a directory path
OutputPackage string // must be a Go import-path
OutputPkg string // must be a Go import-path
// ExternalApplyConfigurations provides the locations of externally generated
// apply configuration types for types referenced by the go structs provided as input.
@ -68,7 +68,7 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet, inputBase string) {
fs.StringVar(&ca.OutputDir, "output-dir", "",
"the base directory under which to generate results")
fs.StringVar(&ca.OutputPackage, "output-package", ca.OutputPackage,
fs.StringVar(&ca.OutputPkg, "output-pkg", ca.OutputPkg,
"the Go import-path of the generated results")
fs.Var(NewExternalApplyConfigurationValue(&ca.ExternalApplyConfigurations, nil), "external-applyconfigurations",
"list of comma separated external apply configurations locations in <type-package>.<type-name>:<applyconfiguration-package> form."+
@ -84,8 +84,8 @@ func Validate(genericArgs *args.GeneratorArgs) error {
if len(customArgs.OutputDir) == 0 {
return fmt.Errorf("--output-dir must be specified")
}
if len(customArgs.OutputPackage) == 0 {
return fmt.Errorf("--output-package must be specified")
if len(customArgs.OutputPkg) == 0 {
return fmt.Errorf("--output-pkg must be specified")
}
return nil

View File

@ -63,7 +63,7 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen
customArgs := arguments.CustomArgs.(*applygenargs.CustomArgs)
pkgTypes := packageTypesForInputDirs(context, arguments.InputDirs, customArgs.OutputPackage)
pkgTypes := packageTypesForInputDirs(context, arguments.InputDirs, customArgs.OutputPkg)
initialTypes := customArgs.ExternalApplyConfigurations
refs := refGraphForReachableTypes(context.Universe, pkgTypes, initialTypes)
typeModels, err := newTypeModels(customArgs.OpenAPISchemaFilePath, pkgTypes)
@ -103,13 +103,13 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen
// Apparently we allow the groupName to be overridden in a way that it
// no longer maps to a Go package by name. So we have to figure out
// the offset of this particular output package (pkg) from the base
// output package (customArgs.OutputPackage).
pkgSubdir := strings.TrimPrefix(pkg, customArgs.OutputPackage+"/")
// output package (customArgs.OutputPkg).
pkgSubdir := strings.TrimPrefix(pkg, customArgs.OutputPkg+"/")
// generate the apply configurations
targetList = append(targetList,
targetForApplyConfigurationsPackage(
customArgs.OutputDir, customArgs.OutputPackage, pkgSubdir,
customArgs.OutputDir, customArgs.OutputPkg, pkgSubdir,
boilerplate, gv, toGenerate, refs, typeModels))
// group all the generated apply configurations by gv so ForKind() can be generated
@ -133,11 +133,11 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen
// generate ForKind() utility function
targetList = append(targetList,
targetForUtils(customArgs.OutputDir, customArgs.OutputPackage,
targetForUtils(customArgs.OutputDir, customArgs.OutputPkg,
boilerplate, groupVersions, applyConfigsForGroupVersion, groupGoNames))
// generate internal embedded schema, required for generated Extract functions
targetList = append(targetList,
targetForInternal(customArgs.OutputDir, customArgs.OutputPackage,
targetForInternal(customArgs.OutputDir, customArgs.OutputPkg,
boilerplate, typeModels))
return targetList

View File

@ -33,7 +33,7 @@ type CustomArgs struct {
OutputDir string
// The Go import-path of the generated results.
OutputPackage string
OutputPkg string
// A sorted list of group versions to generate. For each of them the package path is found
// in GroupVersionToInputPath.
@ -83,7 +83,7 @@ func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet, inputBase string) {
gvsBuilder := NewGroupVersionsBuilder(&ca.Groups)
fs.StringVar(&ca.OutputDir, "output-dir", "",
"the base directory under which to generate results")
fs.StringVar(&ca.OutputPackage, "output-package", ca.OutputPackage,
fs.StringVar(&ca.OutputPkg, "output-pkg", ca.OutputPkg,
"the Go import-path of the generated results")
fs.Var(NewGVPackagesValue(gvsBuilder, nil), "input", "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\".")
fs.Var(NewGVTypesValue(&ca.IncludedTypesOverrides, []string{}), "included-types-overrides", "list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient will be used for other group versions.")
@ -97,7 +97,7 @@ func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet, inputBase string) {
fs.StringVar(&ca.ApplyConfigurationPackage, "apply-configuration-package", ca.ApplyConfigurationPackage, "optional package of apply configurations, generated by applyconfiguration-gen, that are required to generate Apply functions for each type in the clientset. By default Apply functions are not generated.")
// support old flags
fs.SetNormalizeFunc(mapFlagName("clientset-path", "output-package", fs.GetNormalizeFunc()))
fs.SetNormalizeFunc(mapFlagName("clientset-path", "output-pkg", fs.GetNormalizeFunc()))
}
func Validate(genericArgs *args.GeneratorArgs) error {
@ -106,8 +106,8 @@ func Validate(genericArgs *args.GeneratorArgs) error {
if len(customArgs.OutputDir) == 0 {
return fmt.Errorf("--output-dir must be specified")
}
if len(customArgs.OutputPackage) == 0 {
return fmt.Errorf("--output-package must be specified")
if len(customArgs.OutputPkg) == 0 {
return fmt.Errorf("--output-pkg must be specified")
}
if len(customArgs.ClientsetName) == 0 {
return fmt.Errorf("--clientset-name must be specified")

View File

@ -255,7 +255,7 @@ NextGroup:
OutputFilename: "register.go",
},
InputPackages: customArgs.GroupVersionPackages(),
OutputPackage: schemePkg,
OutputPkg: schemePkg,
OutputPath: schemeDir,
Groups: customArgs.Groups,
GroupGoNames: groupGoNames,
@ -396,7 +396,7 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen
}
clientsetDir := filepath.Join(customArgs.OutputDir, customArgs.ClientsetName)
clientsetPkg := filepath.Join(customArgs.OutputPackage, customArgs.ClientsetName)
clientsetPkg := filepath.Join(customArgs.OutputPkg, customArgs.ClientsetName)
var targetList []generator.Target

View File

@ -118,7 +118,7 @@ func TargetForClientset(customArgs *clientgenargs.CustomArgs, clientsetDir, clie
OutputFilename: "register.go",
},
InputPackages: customArgs.GroupVersionPackages(),
OutputPackage: clientsetPkg,
OutputPkg: clientsetPkg,
Groups: customArgs.Groups,
GroupGoNames: groupGoNames,
ImportTracker: generator.NewImportTracker(),

View File

@ -32,7 +32,7 @@ import (
// GenScheme produces a package for a clientset with the scheme, codecs and parameter codecs.
type GenScheme struct {
generator.GoGenerator
OutputPackage string // Must be a Go import-path
OutputPkg string // Must be a Go import-path
OutputPath string // optional
Groups []clientgentypes.GroupVersions
GroupGoNames map[clientgentypes.GroupVersion]string
@ -45,7 +45,7 @@ type GenScheme struct {
func (g *GenScheme) Namers(c *generator.Context) namer.NameSystems {
return namer.NameSystems{
"raw": namer.NewRawNamer(g.OutputPackage, g.ImportTracker),
"raw": namer.NewRawNamer(g.OutputPkg, g.ImportTracker),
}
}

View File

@ -26,7 +26,7 @@ import (
// CustomArgs is used by the gengo framework to pass args specific to this generator.
type CustomArgs struct {
OutputDir string // must be a directory path
OutputPackage string // must be a Go import-path
OutputPkg string // must be a Go import-path
VersionedClientSetPackage string // must be a Go import-path
InternalClientSetPackage string // must be a Go import-path
ListersPackage string // must be a Go import-path
@ -53,7 +53,7 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&ca.OutputDir, "output-dir", "",
"the base directory under which to generate results")
fs.StringVar(&ca.OutputPackage, "output-package", ca.OutputPackage,
fs.StringVar(&ca.OutputPkg, "output-pkg", ca.OutputPkg,
"the Go import-path of the generated results")
fs.StringVar(&ca.InternalClientSetPackage, "internal-clientset-package", ca.InternalClientSetPackage, "the Go import-path of the internal clientset to use")
fs.StringVar(&ca.VersionedClientSetPackage, "versioned-clientset-package", ca.VersionedClientSetPackage, "the Go import-path of the versioned clientset to use")
@ -69,8 +69,8 @@ func Validate(genericArgs *args.GeneratorArgs) error {
if len(customArgs.OutputDir) == 0 {
return fmt.Errorf("--output-dir must be specified")
}
if len(customArgs.OutputPackage) == 0 {
return fmt.Errorf("--output-package must be specified")
if len(customArgs.OutputPkg) == 0 {
return fmt.Errorf("--output-pkg must be specified")
}
if len(customArgs.VersionedClientSetPackage) == 0 {
return fmt.Errorf("--versioned-clientset-package must be specified")

View File

@ -102,9 +102,9 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen
customArgs := arguments.CustomArgs.(*informergenargs.CustomArgs)
internalVersionOutputDir := customArgs.OutputDir
internalVersionOutputPkg := customArgs.OutputPackage
internalVersionOutputPkg := customArgs.OutputPkg
externalVersionOutputDir := customArgs.OutputDir
externalVersionOutputPkg := customArgs.OutputPackage
externalVersionOutputPkg := customArgs.OutputPkg
if !customArgs.SingleDirectory {
internalVersionOutputDir = filepath.Join(internalVersionOutputDir, "internalversion")
internalVersionOutputPkg = filepath.Join(internalVersionOutputPkg, "internalversion")

View File

@ -26,7 +26,7 @@ import (
// CustomArgs is used by the gengo framework to pass args specific to this generator.
type CustomArgs struct {
OutputDir string // must be a directory path
OutputPackage string // must be a Go import-path
OutputPkg string // must be a Go import-path
// PluralExceptions specify list of exceptions used when pluralizing certain types.
// For example 'Endpoints:Endpoints', otherwise the pluralizer will generate 'Endpointes'.
@ -48,7 +48,7 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&ca.OutputDir, "output-dir", "",
"the base directory under which to generate results")
fs.StringVar(&ca.OutputPackage, "output-package", "",
fs.StringVar(&ca.OutputPkg, "output-pkg", "",
"the base Go import-path under which to generate results")
fs.StringSliceVar(&ca.PluralExceptions, "plural-exceptions", ca.PluralExceptions,
"list of comma separated plural exception definitions in Type:PluralizedType format")
@ -61,8 +61,8 @@ func Validate(genericArgs *args.GeneratorArgs) error {
if len(custom.OutputDir) == 0 {
return fmt.Errorf("--output-dir must be specified")
}
if len(custom.OutputPackage) == 0 {
return fmt.Errorf("--output-package must be specified")
if len(custom.OutputPkg) == 0 {
return fmt.Errorf("--output-pkg must be specified")
}
return nil

View File

@ -122,7 +122,7 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen
subdir := filepath.Join(groupPackageName, strings.ToLower(gv.Version.NonEmpty()))
outputDir := filepath.Join(customArgs.OutputDir, subdir)
outputPkg := filepath.Join(customArgs.OutputPackage, subdir)
outputPkg := filepath.Join(customArgs.OutputPkg, subdir)
targetList = append(targetList, &generator.SimpleTarget{
PkgName: strings.ToLower(gv.Version.NonEmpty()),
PkgPath: outputPkg,

View File

@ -376,7 +376,7 @@ function kube::codegen::gen_openapi() {
--output-file-base zz_generated.openapi.go \
--go-header-file "${boilerplate}" \
--output-dir "${out_dir}" \
--output-package "${out_pkg}" \
--output-pkg "${out_pkg}" \
--report-filename "${new_report}" \
--input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1" \
--input-dirs "k8s.io/apimachinery/pkg/runtime" \
@ -612,7 +612,7 @@ function kube::codegen::gen_client() {
-v "${v}" \
--go-header-file "${boilerplate}" \
--output-dir "${out_dir}/${applyconfig_subdir}" \
--output-package "${applyconfig_pkg}" \
--output-pkg "${applyconfig_pkg}" \
--external-applyconfigurations "${applyconfig_external}" \
"${inputs[@]}"
fi
@ -634,7 +634,7 @@ function kube::codegen::gen_client() {
-v "${v}" \
--go-header-file "${boilerplate}" \
--output-dir "${out_dir}/${clientset_subdir}" \
--output-package "${out_pkg}/${clientset_subdir}" \
--output-pkg "${out_pkg}/${clientset_subdir}" \
--clientset-name "${clientset_versioned_name}" \
--apply-configuration-package "${applyconfig_pkg}" \
--input-base "$(cd "${in_dir}" && pwd -P)" `# must be absolute path or Go import path"` \
@ -659,7 +659,7 @@ function kube::codegen::gen_client() {
-v "${v}" \
--go-header-file "${boilerplate}" \
--output-dir "${out_dir}/${listers_subdir}" \
--output-package "${out_pkg}/${listers_subdir}" \
--output-pkg "${out_pkg}/${listers_subdir}" \
--plural-exceptions "${plural_exceptions}" \
"${inputs[@]}"
@ -680,7 +680,7 @@ function kube::codegen::gen_client() {
-v "${v}" \
--go-header-file "${boilerplate}" \
--output-dir "${out_dir}/${informers_subdir}" \
--output-package "${out_pkg}/${informers_subdir}" \
--output-pkg "${out_pkg}/${informers_subdir}" \
--versioned-clientset-package "${out_pkg}/${clientset_subdir}/${clientset_versioned_name}" \
--listers-package "${out_pkg}/${listers_subdir}" \
--plural-exceptions "${plural_exceptions}" \