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 <andy.goldstein@gmail.com>
pull/8/head
Andy Goldstein 2018-05-31 15:05:00 -04:00
parent d02cf08e27
commit c5d43d082a
1 changed files with 7 additions and 1 deletions

View File

@ -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