Skip to content

Commit f9fb591

Browse files
committed
Update update-codegen.sh to new upstream cli behaviour
Signed-off-by: Marvin Beckers <[email protected]>
1 parent 0c0a733 commit f9fb591

File tree

2 files changed

+19
-36
lines changed

2 files changed

+19
-36
lines changed

hack/go-install.sh

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,35 @@
1515
# limitations under the License.
1616

1717
# Originally copied from
18-
# https://github.com/kubernetes-sigs/cluster-api-provider-gcp/blob/c26a68b23e9317323d5d37660fe9d29b3d2ff40c/scripts/go_install.sh
18+
# https://github.com/kubernetes-sigs/controller-runtime/blob/479b723944e34ae42c9911fe01228ff34eb5ca81/hack/go-install.sh#L4
1919

2020
set -o errexit
2121
set -o nounset
2222
set -o pipefail
2323

24-
if [[ -z "${1:-}" ]]; then
24+
if [ -z "${1}" ]; then
2525
echo "must provide module as first parameter"
2626
exit 1
2727
fi
2828

29-
if [[ -z "${2:-}" ]]; then
29+
if [ -z "${2}" ]; then
3030
echo "must provide binary name as second parameter"
3131
exit 1
3232
fi
3333

34-
if [[ -z "${3:-}" ]]; then
34+
if [ -z "${3}" ]; then
3535
echo "must provide version as third parameter"
3636
exit 1
3737
fi
3838

39-
if [[ -z "${GOBIN:-}" ]]; then
39+
if [ -z "${GOBIN}" ]; then
4040
echo "GOBIN is not set. Must set GOBIN to install the bin in a specified directory."
4141
exit 1
4242
fi
4343

44-
mkdir -p "${GOBIN}"
45-
46-
tmp_dir=$(mktemp -d -t goinstall_XXXXXXXXXX)
47-
function clean {
48-
rm -rf "${tmp_dir}"
49-
}
50-
trap clean EXIT
51-
52-
rm "${GOBIN}/${2}"* > /dev/null 2>&1 || true
53-
54-
cd "${tmp_dir}"
55-
56-
# create a new module in the tmp directory
57-
go mod init fake/mod
44+
rm -f "${GOBIN}/${2}"* || true
5845

5946
# install the golang module specified as the first argument
60-
go install -tags kcptools "${1}@${3}"
47+
go install "${1}@${3}"
6148
mv "${GOBIN}/${2}" "${GOBIN}/${2}-${3}"
6249
ln -sf "${GOBIN}/${2}-${3}" "${GOBIN}/${2}"

hack/update-codegen.sh

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,28 @@ ${KUBE_CLIENT_GEN} \
4141
--input example3/v1 \
4242
--input secondexample/v1 \
4343
--input existinginterfaces/v1 \
44-
--output-base . \
45-
--output-package acme.corp/pkg/generated/clientset \
46-
--trim-path-prefix acme.corp
44+
--output-dir ./pkg/generated/clientset \
45+
--output-pkg acme.corp/pkg/generated/clientset
4746

4847
${KUBE_APPLYCONFIGURATION_GEN} \
4948
--go-header-file ./../hack/boilerplate/boilerplate.generatego.txt \
50-
--input-dirs acme.corp/pkg/apis/example/v1,acme.corp/pkg/apis/example/v1alpha1,acme.corp/pkg/apis/example/v1beta1,acme.corp/pkg/apis/example/v2,acme.corp/pkg/apis/example3/v1,acme.corp/pkg/apis/secondexample/v1,acme.corp/pkg/apis/existinginterfaces/v1 \
51-
--output-base . \
52-
--output-package acme.corp/pkg/generated/applyconfigurations \
53-
--trim-path-prefix acme.corp
49+
--output-dir ./pkg/generated/applyconfigurations \
50+
--output-pkg acme.corp/pkg/generated/applyconfigurations \
51+
acme.corp/pkg/apis/example/v1 acme.corp/pkg/apis/example/v1alpha1 acme.corp/pkg/apis/example/v1beta1 acme.corp/pkg/apis/example/v2 acme.corp/pkg/apis/example3/v1 acme.corp/pkg/apis/secondexample/v1 acme.corp/pkg/apis/existinginterfaces/v1
5452

5553
${KUBE_LISTER_GEN} \
5654
--go-header-file ./../hack/boilerplate/boilerplate.generatego.txt \
57-
--input-dirs acme.corp/pkg/apis/example/v1,acme.corp/pkg/apis/example/v1alpha1,acme.corp/pkg/apis/example/v1beta1,acme.corp/pkg/apis/example/v2,acme.corp/pkg/apis/example3/v1,acme.corp/pkg/apis/secondexample/v1,acme.corp/pkg/apis/existinginterfaces/v1 \
58-
--output-base . \
59-
--output-package acme.corp/pkg/generated/listers \
60-
--trim-path-prefix acme.corp
55+
--output-dir ./pkg/generated/listers \
56+
--output-pkg acme.corp/pkg/generated/listers \
57+
acme.corp/pkg/apis/example/v1 acme.corp/pkg/apis/example/v1alpha1 acme.corp/pkg/apis/example/v1beta1 acme.corp/pkg/apis/example/v2 acme.corp/pkg/apis/example3/v1 acme.corp/pkg/apis/secondexample/v1 acme.corp/pkg/apis/existinginterfaces/v1
6158

6259
${KUBE_INFORMER_GEN} \
6360
--versioned-clientset-package acme.corp/pkg/generated/clientset/versioned \
6461
--listers-package acme.corp/pkg/generated/listers \
6562
--go-header-file ./../hack/boilerplate/boilerplate.generatego.txt \
66-
--input-dirs acme.corp/pkg/apis/example/v1,acme.corp/pkg/apis/example/v1alpha1,acme.corp/pkg/apis/example/v1beta1,acme.corp/pkg/apis/example/v2,acme.corp/pkg/apis/example3/v1,acme.corp/pkg/apis/secondexample/v1,acme.corp/pkg/apis/existinginterfaces/v1 \
67-
--output-base . \
68-
--output-package acme.corp/pkg/generated/informers \
69-
--trim-path-prefix acme.corp
63+
--output-dir ./pkg/generated/informers \
64+
--output-pkg acme.corp/pkg/generated/informers \
65+
acme.corp/pkg/apis/example/v1 acme.corp/pkg/apis/example/v1alpha1 acme.corp/pkg/apis/example/v1beta1 acme.corp/pkg/apis/example/v2 acme.corp/pkg/apis/example3/v1 acme.corp/pkg/apis/secondexample/v1 acme.corp/pkg/apis/existinginterfaces/v1
7066

7167
# Generate cluster-aware clients, informers and listers using generated single-cluster code
7268
./../bin/code-generator \
@@ -84,4 +80,4 @@ ${KUBE_INFORMER_GEN} \
8480
"paths=./pkg/apis/..." \
8581
"output:dir=./pkg/kcp/clients"
8682

87-
popd
83+
popd

0 commit comments

Comments
 (0)