forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deep_copy.go
97 lines (90 loc) · 3.61 KB
/
deep_copy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// deepcopy-gen is a tool for auto-generating DeepCopy functions.
//
// Structs in the input directories with the below line in their comments
// will be ignored during generation.
// // +gencopy=false
package main
import (
"strings"
"github.com/golang/glog"
"k8s.io/gengo/args"
"k8s.io/gengo/examples/deepcopy-gen/generators"
"k8s.io/gengo/generator"
)
func main() {
arguments := args.Default()
// Override defaults. These are Kubernetes specific input locations.
arguments.InputDirs = []string{
"k8s.io/kubernetes/pkg/api",
"k8s.io/apimachinery/pkg/apis/meta/v1",
"k8s.io/kubernetes/pkg/api/v1",
"k8s.io/kubernetes/pkg/apis/authorization",
"k8s.io/kubernetes/pkg/apis/authorization/v1beta1",
"k8s.io/kubernetes/pkg/apis/autoscaling",
"k8s.io/kubernetes/pkg/apis/autoscaling/v1",
"k8s.io/kubernetes/pkg/apis/batch",
"k8s.io/kubernetes/pkg/apis/batch/v1",
"k8s.io/kubernetes/pkg/apis/componentconfig",
"k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1",
"k8s.io/kubernetes/pkg/apis/extensions",
"k8s.io/kubernetes/pkg/apis/extensions/v1beta1",
"k8s.io/apimachinery/pkg/runtime",
"k8s.io/apimachinery/pkg/util/intstr",
"k8s.io/apimachinery/pkg/util/sets",
"k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1",
"k8s.io/kube-aggregator/pkg/apis/apiregistration",
"github.com/openshift/origin/pkg/authorization/apis/authorization/v1",
"github.com/openshift/origin/pkg/authorization/apis/authorization",
"github.com/openshift/origin/pkg/build/apis/build/v1",
"github.com/openshift/origin/pkg/build/apis/build",
"github.com/openshift/origin/pkg/deploy/apis/apps/v1",
"github.com/openshift/origin/pkg/deploy/apis/apps",
"github.com/openshift/origin/pkg/image/apis/image/v1",
"github.com/openshift/origin/pkg/image/apis/image",
"github.com/openshift/origin/pkg/oauth/apis/oauth/v1",
"github.com/openshift/origin/pkg/oauth/apis/oauth",
"github.com/openshift/origin/pkg/project/apis/project/v1",
"github.com/openshift/origin/pkg/project/apis/project",
"github.com/openshift/origin/pkg/quota/apis/quota/v1",
"github.com/openshift/origin/pkg/quota/apis/quota",
"github.com/openshift/origin/pkg/route/apis/route/v1",
"github.com/openshift/origin/pkg/route/apis/route",
"github.com/openshift/origin/pkg/sdn/apis/network/v1",
"github.com/openshift/origin/pkg/sdn/apis/network",
"github.com/openshift/origin/pkg/template/apis/template/v1",
"github.com/openshift/origin/pkg/template/apis/template",
"github.com/openshift/origin/pkg/user/apis/user/v1",
"github.com/openshift/origin/pkg/user/apis/user",
"github.com/openshift/origin/pkg/security/apis/security/v1",
"github.com/openshift/origin/pkg/security/apis/security",
"github.com/openshift/origin/pkg/template/servicebroker/apis/config/v1",
"github.com/openshift/origin/pkg/template/servicebroker/apis/config",
}
arguments.GeneratedBuildTag = "ignore_autogenerated_openshift"
arguments.GoHeaderFilePath = "hack/boilerplate.txt"
arguments.OutputFileBaseName = "zz_generated.deepcopy"
arguments.CustomArgs = &generators.CustomArgs{
BoundingDirs: []string{
"k8s.io/kubernetes",
"github.com/openshift/origin",
},
}
if err := arguments.Execute(
generators.NameSystems(),
generators.DefaultNameSystem(),
func(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages {
pkgs := generators.Packages(context, arguments)
var include generator.Packages
for _, pkg := range pkgs {
if strings.HasPrefix(pkg.Path(), "k8s.io/") {
continue
}
include = append(include, pkg)
}
return include
},
); err != nil {
glog.Fatalf("Error: %v", err)
}
glog.Info("Completed successfully.")
}