From c5d43d082aad187ffe27410d53417f1fbe1ae337 Mon Sep 17 00:00:00 2001 From: Andy Goldstein Date: Thu, 31 May 2018 15:05:00 -0400 Subject: [PATCH] code-gen: support running from anywhere Support running generate-groups.sh from any directory, so users can run it from their own projects, instead of forcing them to run it from here. This allows the generators to find and use go source code from a project's vendor directory, for example. Signed-off-by: Andy Goldstein --- staging/src/k8s.io/code-generator/generate-groups.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/code-generator/generate-groups.sh b/staging/src/k8s.io/code-generator/generate-groups.sh index b92296d96d7..6707221e42e 100755 --- a/staging/src/k8s.io/code-generator/generate-groups.sh +++ b/staging/src/k8s.io/code-generator/generate-groups.sh @@ -46,7 +46,13 @@ APIS_PKG="$3" GROUPS_WITH_VERSIONS="$4" shift 4 -go install ./$(dirname "${0}")/cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen} +( + # To support running this script from anywhere, we have to first cd into this directory + # so we can install the tools. + cd $(dirname "${0}") + go install ./cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen} +) + function codegen::join() { local IFS="$1"; shift; echo "$*"; } # enumerate group versions