|
2 | 2 |
|
3 | 3 | source "$(dirname "${BASH_SOURCE}")/lib/init.sh" |
4 | 4 |
|
5 | | -[[ -n "${PROTO_OPTIONAL:-}" ]] && exit 0 |
6 | | - |
7 | | -if [ -z "${GOPATH:-}" ]; then |
8 | | - echo "Generating protobuf requires GOPATH to be set. Please set GOPATH. |
9 | | -To skip protobuf generation, set \$PROTO_OPTIONAL." |
10 | | - exit 1 |
11 | | -fi |
12 | | - |
13 | | -if [[ "$(protoc --version)" != "libprotoc 3."* ]]; then |
14 | | - echo "Generating protobuf requires protoc 3.0.x. Please download and |
15 | | -install the platform appropriate Protobuf package for your OS: |
16 | | -
|
17 | | - https://github.com/google/protobuf/releases |
18 | | -
|
19 | | -To skip protobuf generation, set \$PROTO_OPTIONAL." |
20 | | - exit 1 |
21 | | -fi |
22 | | - |
23 | | -# Build go-to-protobuf when it's not present and not overriden for a specific file. |
24 | | -if [ -z "${GO_TO_PROTOBUF:-}" ]; then |
25 | | - ${TOOLS_MAKE} go-to-protobuf |
26 | | - GO_TO_PROTOBUF="${TOOLS_OUTPUT}/go-to-protobuf" |
27 | | -fi |
28 | | - |
29 | 5 | # Build protoc-gen-gogo when it's not present and not overriden for a specific file. |
30 | 6 | if [ -z "${PROTOC_GEN_GOGO:-}" ]; then |
31 | 7 | ${TOOLS_MAKE} protoc-gen-gogo |
32 | 8 | PROTOC_GEN_GOGO="${TOOLS_OUTPUT}/protoc-gen-gogo" |
33 | 9 | fi |
34 | 10 |
|
35 | | -# We need to make sure that protoc-gen-gogo is on the path for go-to-protobuf to run correctly. |
36 | | -protoc_bin_dir=$(dirname "${PROTOC_GEN_GOGO}") |
37 | | - |
38 | | -PATH="$PATH:${protoc_bin_dir}" "${GO_TO_PROTOBUF}" \ |
39 | | - --output-base="${GOPATH}/src" \ |
40 | | - --apimachinery-packages='-k8s.io/apimachinery/pkg/util/intstr,-k8s.io/apimachinery/pkg/api/resource,-k8s.io/apimachinery/pkg/runtime/schema,-k8s.io/apimachinery/pkg/runtime,-k8s.io/apimachinery/pkg/apis/meta/v1,-k8s.io/apimachinery/pkg/apis/meta/v1beta1,-k8s.io/api/core/v1,-k8s.io/api/rbac/v1' \ |
41 | | - --go-header-file=${SCRIPT_ROOT}/hack/empty.txt \ |
42 | | - --proto-import=${SCRIPT_ROOT}/third_party/protobuf \ |
43 | | - --proto-import=${SCRIPT_ROOT}/vendor \ |
44 | | - --proto-import=${SCRIPT_ROOT}/tools/vendor \ |
45 | | - --packages="${API_PACKAGES}" |
| 11 | +GENERATOR=go-to-protobuf ${SCRIPT_ROOT}/hack/update-codegen.sh |
0 commit comments