Skip to content

Commit

Permalink
Use vendored code generators
Browse files Browse the repository at this point in the history
  • Loading branch information
fejta committed Mar 6, 2019
1 parent 5f9ba57 commit 81d7bf5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# gazelle:prefix k8s.io/test-infra
# gazelle:proto disable_global
# gazelle:exclude vendor/k8s.io/code-generator/_examples/
# gazelle:exclude hack

load("@io_kubernetes_build//defs:run_in_workspace.bzl", "workspace_binary")
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
Expand Down
27 changes: 27 additions & 0 deletions hack/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package hack

// +build tools

// Add tools that hack scripts depend on here, to ensure they are vendored.
import (
_ "k8s.io/code-generator/cmd/client-gen"
_ "k8s.io/code-generator/cmd/deepcopy-gen"
_ "k8s.io/code-generator/cmd/informer-gen"
_ "k8s.io/code-generator/cmd/lister-gen"
)
8 changes: 1 addition & 7 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ cd "$(git rev-parse --show-toplevel)"

export GOPATH="${GOPATH:-$HOME/go}"
export PATH="${GOPATH}/bin:${PATH}"
export GO111MODULE=on

ensure-in-gopath() {
if [[ "${PWD}" != "${GOPATH}/src/k8s.io/test-infra" ]]; then
Expand All @@ -32,12 +31,7 @@ ensure-in-gopath() {

codegen-init() {
echo "Ensuring generators exist..." >&2
local ver=b1289fc74931d4b6b04bd1a259acfc88a2cb0a66
which deepcopy-gen &>/dev/null || go get k8s.io/code-generator/cmd/deepcopy-gen@${ver}
which client-gen &>/dev/null || go get k8s.io/code-generator/cmd/client-gen@${ver}
which lister-gen &>/dev/null || go get k8s.io/code-generator/cmd/lister-gen@${ver}
which informer-gen &>/dev/null || go get k8s.io/code-generator/cmd/informer-gen@${ver}
bazel run //:go -- mod tidy
go install ./vendor/k8s.io/code-generator/cmd/{deepcopy,client,lister,informer}-gen
}

gen-deepcopy() {
Expand Down

0 comments on commit 81d7bf5

Please sign in to comment.