#!/bin/bash # Copyright 2015 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. set -o errexit set -o nounset set -o pipefail global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/.." source "$(KUBE_ROOT)/hack/lib/init.sh" kube::golang::setup_env global BINS := '( 'vendor/k8s.io/code-generator/cmd/go-to-protobuf vendor/k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo ) make -C $(KUBE_ROOT) WHAT="$(BINS[*])" if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3."* ]] { echo "Generating protobuf requires protoc 3.0.0-beta1 or newer. Please download and" echo "install the platform appropriate Protobuf package for your OS: " echo echo " https://github.com/google/protobuf/releases" echo echo "WARNING: Protobuf changes are not being validated" exit 1 } global gotoprotobuf := $[kube::util::find-binary "go-to-protobuf] global PACKAGES := '( 'k8s.io/apiserver/pkg/apis/example/v1 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1 k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1 k8s.io/api/core/v1 k8s.io/api/policy/v1beta1 k8s.io/api/extensions/v1beta1 k8s.io/api/autoscaling/v1 k8s.io/api/authorization/v1 k8s.io/api/autoscaling/v2beta1 k8s.io/api/authorization/v1beta1 k8s.io/api/batch/v1 k8s.io/api/batch/v1beta1 k8s.io/api/batch/v2alpha1 k8s.io/api/apps/v1beta1 k8s.io/api/apps/v1beta2 k8s.io/api/apps/v1 k8s.io/api/authentication/v1 k8s.io/api/authentication/v1beta1 k8s.io/api/rbac/v1alpha1 k8s.io/api/rbac/v1beta1 k8s.io/api/certificates/v1beta1 k8s.io/api/imagepolicy/v1alpha1 k8s.io/api/scheduling/v1alpha1 k8s.io/api/settings/v1alpha1 k8s.io/api/storage/v1beta1 k8s.io/api/storage/v1 k8s.io/api/admissionregistration/v1alpha1 k8s.io/api/admission/v1alpha1 k8s.io/api/networking/v1 k8s.io/kubernetes/federation/apis/federation/v1beta1 k8s.io/metrics/pkg/apis/metrics/v1alpha1 k8s.io/metrics/pkg/apis/metrics/v1beta1 k8s.io/metrics/pkg/apis/custom_metrics/v1beta1 k8s.io/apiserver/pkg/apis/audit/v1alpha1 k8s.io/apiserver/pkg/apis/audit/v1beta1 ) # requires the 'proto' tag to build (will remove when ready) # searches for the protoc-gen-gogo extension in the output directory # satisfies import of github.com/gogo/protobuf/gogoproto/gogo.proto and the # core Google protobuf types env PATH="$(KUBE_ROOT)/_output/bin:$(PATH)" \ $(gotoprotobuf) \ --proto-import="$(KUBE_ROOT)/vendor" \ --proto-import="$(KUBE_ROOT)/third_party/protobuf" \ --packages=$[global IFS := ',' ; echo $(PACKAGES[*])] @Argv (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [64 72] ) (/..) } spids: [63] ) ] spids: [63] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/init.sh))}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (golang) (Lit_Other ":") (Lit_Other ":") (setup_env)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BINS) op: Equal rhs: { (ArrayLiteralPart words: [ {(vendor/k8s.io/code-generator/cmd/go-to-protobuf)} {(vendor/k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo)} ] ) } spids: [94] ) ] spids: [94] ) (C {(make)} {(-C)} {(DQ (${ VSub_Name KUBE_ROOT))} {(Lit_VarLike "WHAT=") (DQ (BracedVarSub token: bracket_op: (WholeArray op_id:Arith_Star) spids: [117 122] ) ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalOr left: (BoolUnary op_id: BoolUnary_z child: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(which)} {(protoc)})]) left_token: spids: [133 137] ) ) } ) right: (BoolBinary op_id: BoolBinary_GlobNEqual left: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(protoc)} {(--version)})]) left_token: spids: [143 147] ) ) } right: {(DQ ("libprotoc 3.")) (Lit_Other "*")} ) ) ) terminator: ) ] action: [ (C {(echo)} { (DQ ("Generating protobuf requires protoc 3.0.0-beta1 or newer. Please download and")) } ) (C {(echo)} {(DQ ("install the platform appropriate Protobuf package for your OS: "))}) (C {(echo)}) (C {(echo)} {(DQ (" https://github.com/google/protobuf/releases"))}) (C {(echo)}) (C {(echo)} {(DQ ("WARNING: Protobuf changes are not being validated"))}) (C {(exit)} {(1)}) ] spids: [-1 160] ) ] spids: [-1 201] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:gotoprotobuf) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(kube) (Lit_Other ":") (Lit_Other ":") (util) (Lit_Other ":") (Lit_Other ":") (find-binary) } {(DQ (go-to-protobuf))} ) ] ) left_token: spids: [205 217] ) } spids: [204] ) ] spids: [204] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PACKAGES) op: Equal rhs: { (ArrayLiteralPart words: [ {(k8s.io/apiserver/pkg/apis/example/v1)} {(k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1)} {(k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1)} {(k8s.io/api/core/v1)} {(k8s.io/api/policy/v1beta1)} {(k8s.io/api/extensions/v1beta1)} {(k8s.io/api/autoscaling/v1)} {(k8s.io/api/authorization/v1)} {(k8s.io/api/autoscaling/v2beta1)} {(k8s.io/api/authorization/v1beta1)} {(k8s.io/api/batch/v1)} {(k8s.io/api/batch/v1beta1)} {(k8s.io/api/batch/v2alpha1)} {(k8s.io/api/apps/v1beta1)} {(k8s.io/api/apps/v1beta2)} {(k8s.io/api/apps/v1)} {(k8s.io/api/authentication/v1)} {(k8s.io/api/authentication/v1beta1)} {(k8s.io/api/rbac/v1alpha1)} {(k8s.io/api/rbac/v1beta1)} {(k8s.io/api/certificates/v1beta1)} {(k8s.io/api/imagepolicy/v1alpha1)} {(k8s.io/api/scheduling/v1alpha1)} {(k8s.io/api/settings/v1alpha1)} {(k8s.io/api/storage/v1beta1)} {(k8s.io/api/storage/v1)} {(k8s.io/api/admissionregistration/v1alpha1)} {(k8s.io/api/admission/v1alpha1)} {(k8s.io/api/networking/v1)} {(k8s.io/kubernetes/federation/apis/federation/v1beta1)} {(k8s.io/metrics/pkg/apis/metrics/v1alpha1)} {(k8s.io/metrics/pkg/apis/metrics/v1beta1)} {(k8s.io/metrics/pkg/apis/custom_metrics/v1beta1)} {(k8s.io/apiserver/pkg/apis/audit/v1alpha1)} {(k8s.io/apiserver/pkg/apis/audit/v1beta1)} ] ) } spids: [220] ) ] spids: [220] ) (SimpleCommand words: [ {(DQ (${ VSub_Name gotoprotobuf))} {(--proto-import) (Lit_Other "=") (DQ (${ VSub_Name KUBE_ROOT) (/vendor))} {(--proto-import) (Lit_Other "=") (DQ (${ VSub_Name KUBE_ROOT) (/third_party/protobuf))} {(--packages) (Lit_Other "=") (CommandSubPart command_list: (CommandList children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:IFS) op: Equal rhs: {(Lit_Comma ",")} spids: [389] ) ] spids: [389] ) terminator: ) (C {(echo)} { (DQ (BracedVarSub token: bracket_op: (WholeArray op_id:Arith_Star) spids: [397 402] ) ) } ) ] ) left_token: spids: [388 404] ) } ] more_env: [ (env_pair name: PATH val: {(DQ (${ VSub_Name KUBE_ROOT) ("/_output/bin:") (${ VSub_Name PATH))} spids: [343] ) ] ) (C {(DQ ($ VSub_At "$@"))}) ] )