feat: kubesphere 4.0 (#6115)

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

---------

Signed-off-by: ci-bot <ci-bot@kubesphere.io>
Co-authored-by: ks-ci-bot <ks-ci-bot@example.com>
Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
KubeSphere CI Bot
2024-09-06 11:05:52 +08:00
committed by GitHub
parent b5015ec7b9
commit 447a51f08b
8557 changed files with 546695 additions and 1146174 deletions

19
vendor/k8s.io/gengo/args/args.go generated vendored
View File

@@ -32,7 +32,6 @@ import (
"k8s.io/gengo/generator"
"k8s.io/gengo/namer"
"k8s.io/gengo/parser"
"k8s.io/gengo/types"
"github.com/spf13/pflag"
)
@@ -155,24 +154,6 @@ func (g *GeneratorArgs) NewBuilder() (*parser.Builder, error) {
return b, nil
}
// InputIncludes returns true if the given package is a (sub) package of one of
// the InputDirs.
func (g *GeneratorArgs) InputIncludes(p *types.Package) bool {
for _, dir := range g.InputDirs {
d := dir
if strings.HasSuffix(d, "...") {
d = strings.TrimSuffix(d, "...")
}
if strings.HasPrefix(d, "./vendor/") {
d = strings.TrimPrefix(d, "./vendor/")
}
if strings.HasPrefix(p.Path, d) {
return true
}
}
return false
}
// DefaultSourceTree returns the /src directory of the first entry in $GOPATH.
// If $GOPATH is empty, it returns "./". Useful as a default output location.
func DefaultSourceTree() string {

View File

@@ -173,19 +173,25 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
pkgNeedsGeneration := (ptagValue == tagValuePackage)
if !pkgNeedsGeneration {
// If the pkg-scoped tag did not exist, scan all types for one that
// explicitly wants generation.
// explicitly wants generation. Ensure all types that want generation
// can be copied.
var uncopyable []string
for _, t := range pkg.Types {
klog.V(5).Infof(" considering type %q", t.Name.String())
ttag := extractEnabledTypeTag(t)
if ttag != nil && ttag.value == "true" {
klog.V(5).Infof(" tag=true")
if !copyableType(t) {
klog.Fatalf("Type %v requests deepcopy generation but is not copyable", t)
uncopyable = append(uncopyable, fmt.Sprintf("%v", t))
} else {
pkgNeedsGeneration = true
}
pkgNeedsGeneration = true
break
}
}
if len(uncopyable) > 0 {
klog.Fatalf("Types requested deepcopy generation but are not copyable: %s",
strings.Join(uncopyable, ", "))
}
}
if pkgNeedsGeneration {

File diff suppressed because it is too large Load Diff

View File

@@ -26,15 +26,34 @@ import (
"k8s.io/gengo/types"
)
func NewImportTracker(typesToAdd ...*types.Type) namer.ImportTracker {
tracker := namer.NewDefaultImportTracker(types.Name{})
// NewImportTrackerForPackage creates a new import tracker which is aware
// of a generator's output package. The tracker will not add import lines
// when symbols or types are added from the same package, and LocalNameOf
// will return empty string for the output package.
//
// e.g.:
//
// tracker := NewImportTrackerForPackage("bar.com/pkg/foo")
// tracker.AddSymbol(types.Name{"bar.com/pkg/foo.MyType"})
// tracker.AddSymbol(types.Name{"bar.com/pkg/baz.MyType"})
// tracker.AddSymbol(types.Name{"bar.com/pkg/baz/baz.MyType"})
//
// tracker.LocalNameOf("bar.com/pkg/foo") -> ""
// tracker.LocalNameOf("bar.com/pkg/baz") -> "baz"
// tracker.LocalNameOf("bar.com/pkg/baz/baz") -> "bazbaz"
// tracker.ImportLines() -> {`baz "bar.com/pkg/baz"`, `bazbaz "bar.com/pkg/baz/baz"`}
func NewImportTrackerForPackage(local string, typesToAdd ...*types.Type) *namer.DefaultImportTracker {
tracker := namer.NewDefaultImportTracker(types.Name{Package: local})
tracker.IsInvalidType = func(*types.Type) bool { return false }
tracker.LocalName = func(name types.Name) string { return golangTrackerLocalName(&tracker, name) }
tracker.PrintImport = func(path, name string) string { return name + " \"" + path + "\"" }
tracker.AddTypes(typesToAdd...)
return &tracker
}
func NewImportTracker(typesToAdd ...*types.Type) *namer.DefaultImportTracker {
return NewImportTrackerForPackage("", typesToAdd...)
}
func golangTrackerLocalName(tracker namer.ImportTracker, t types.Name) string {

View File

@@ -55,6 +55,27 @@ func (tracker *DefaultImportTracker) AddTypes(types ...*types.Type) {
tracker.AddType(t)
}
}
func (tracker *DefaultImportTracker) AddSymbol(symbol types.Name) {
if tracker.local.Package == symbol.Package {
return
}
if len(symbol.Package) == 0 {
return
}
path := symbol.Path
if len(path) == 0 {
path = symbol.Package
}
if _, ok := tracker.pathToName[path]; ok {
return
}
name := tracker.LocalName(symbol)
tracker.nameToPath[name] = path
tracker.pathToName[path] = name
}
func (tracker *DefaultImportTracker) AddType(t *types.Type) {
if tracker.local.Package == t.Name.Package {
return
@@ -70,19 +91,7 @@ func (tracker *DefaultImportTracker) AddType(t *types.Type) {
return
}
if len(t.Name.Package) == 0 {
return
}
path := t.Name.Path
if len(path) == 0 {
path = t.Name.Package
}
if _, ok := tracker.pathToName[path]; ok {
return
}
name := tracker.LocalName(t.Name)
tracker.nameToPath[name] = path
tracker.pathToName[path] = name
tracker.AddSymbol(t.Name)
}
func (tracker *DefaultImportTracker) ImportLines() []string {

1
vendor/k8s.io/gengo/namer/namer.go generated vendored
View File

@@ -300,6 +300,7 @@ func (ns *NameStrategy) Name(t *types.Type) string {
// import. You can implement yourself or use the one in the generation package.
type ImportTracker interface {
AddType(*types.Type)
AddSymbol(types.Name)
LocalNameOf(packagePath string) string
PathOf(localName string) (string, bool)
ImportLines() []string