Merge pull request #64567 from ncdc/code-generator-run-from-anywhere

Automatic merge from submit-queue (batch tested with PRs 63348, 63839, 63143, 64447, 64567). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

code-gen: support running from anywhere

**What this PR does / why we need it**:
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.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #64566

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-06-01 12:12:27 -07:00 committed by GitHub
commit bbf5625630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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