-
Notifications
You must be signed in to change notification settings - Fork 134
/
codegen.sh
executable file
·107 lines (93 loc) · 3.71 KB
/
codegen.sh
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
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
set -x
GOPATH=$(go env GOPATH)
PACKAGE_NAME=github.com/appscode/voyager
REPO_ROOT="$GOPATH/src/$PACKAGE_NAME"
DOCKER_REPO_ROOT="/go/src/$PACKAGE_NAME"
pushd $REPO_ROOT
## Generate ugorji stuff
rm "$REPO_ROOT"/apis/voyager/v1beta1/*.generated.go
# Generate defaults
docker run --rm -ti -u $(id -u):$(id -g) \
-v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \
-w "$DOCKER_REPO_ROOT" \
appscode/gengo:release-1.8 defaulter-gen \
--v 1 --logtostderr \
--go-header-file "hack/gengo/boilerplate.go.txt" \
--input-dirs "$PACKAGE_NAME/apis/voyager" \
--input-dirs "$PACKAGE_NAME/apis/voyager/v1beta1" \
--extra-peer-dirs "$PACKAGE_NAME/apis/voyager" \
--extra-peer-dirs "$PACKAGE_NAME/apis/voyager/v1beta1" \
--output-file-base "zz_generated.defaults"
# Generate deep copies
docker run --rm -ti -u $(id -u):$(id -g) \
-v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \
-w "$DOCKER_REPO_ROOT" \
appscode/gengo:release-1.8 deepcopy-gen \
--v 1 --logtostderr \
--go-header-file "hack/gengo/boilerplate.go.txt" \
--input-dirs "$PACKAGE_NAME/apis/voyager" \
--input-dirs "$PACKAGE_NAME/apis/voyager/v1beta1" \
--output-file-base zz_generated.deepcopy
# Generate conversions
docker run --rm -ti -u $(id -u):$(id -g) \
-v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \
-w "$DOCKER_REPO_ROOT" \
appscode/gengo:release-1.8 conversion-gen \
--v 1 --logtostderr \
--go-header-file "hack/gengo/boilerplate.go.txt" \
--input-dirs "$PACKAGE_NAME/apis/voyager" \
--input-dirs "$PACKAGE_NAME/apis/voyager/v1beta1" \
--output-file-base zz_generated.conversion
# Generate openapi
docker run --rm -ti -u $(id -u):$(id -g) \
-v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \
-w "$DOCKER_REPO_ROOT" \
appscode/gengo:release-1.8 openapi-gen \
--v 1 --logtostderr \
--go-header-file "hack/gengo/boilerplate.go.txt" \
--input-dirs "$PACKAGE_NAME/apis/voyager/v1beta1" \
--output-package "$PACKAGE_NAME/apis/voyager/v1beta1"
# Generate the internal clientset (client/clientset_generated/internalclientset)
docker run --rm -ti -u $(id -u):$(id -g) \
-v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \
-w "$DOCKER_REPO_ROOT" \
appscode/gengo:release-1.8 client-gen \
--go-header-file "hack/gengo/boilerplate.go.txt" \
--input-base "$PACKAGE_NAME/apis/" \
--input "voyager/" \
--clientset-path "$PACKAGE_NAME/client/" \
--clientset-name internalclientset
# Generate the versioned clientset (client/clientset_generated/clientset)
docker run --rm -ti -u $(id -u):$(id -g) \
-v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \
-w "$DOCKER_REPO_ROOT" \
appscode/gengo:release-1.8 client-gen \
--go-header-file "hack/gengo/boilerplate.go.txt" \
--input-base "$PACKAGE_NAME/apis/" \
--input "voyager/v1beta1" \
--clientset-path "$PACKAGE_NAME/" \
--clientset-name "client"
# generate lister
docker run --rm -ti -u $(id -u):$(id -g) \
-v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \
-w "$DOCKER_REPO_ROOT" \
appscode/gengo:release-1.8 lister-gen \
--go-header-file "hack/gengo/boilerplate.go.txt" \
--input-dirs="$PACKAGE_NAME/apis/voyager" \
--input-dirs="$PACKAGE_NAME/apis/voyager/v1beta1" \
--output-package "$PACKAGE_NAME/listers"
# generate informer
docker run --rm -ti -u $(id -u):$(id -g) \
-v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \
-w "$DOCKER_REPO_ROOT" \
appscode/gengo:release-1.8 informer-gen \
--go-header-file "hack/gengo/boilerplate.go.txt" \
--input-dirs "$PACKAGE_NAME/apis/voyager/v1beta1" \
--versioned-clientset-package "$PACKAGE_NAME/client" \
--listers-package "$PACKAGE_NAME/listers" \
--output-package "$PACKAGE_NAME/informers"
#go-to-protobuf \
# --proto-import="${KUBE_ROOT}/vendor" \
# --proto-import="${KUBE_ROOT}/third_party/protobuf"
popd