#!/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. # Generates `types_swagger_doc_generated.go` files for federation API group # versions. That file contains functions on API structs that return the comments # that should be surfaced for the corresponding API type in our API docs. set -o errexit set -o nounset set -o pipefail global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/.." source "$(KUBE_ROOT)/hack/lib/init.sh" source "$(KUBE_ROOT)/hack/lib/swagger.sh" kube::golang::setup_env global GROUP_VERSIONS := '('meta/v1 meta/v1alpha1 ${KUBE_AVAILABLE_GROUP_VERSIONS}) # To avoid compile errors, remove the currently existing files. for group_version in [$(GROUP_VERSIONS[@])] { rm -f "$[kube::util::group-version-to-pkg-path $(group_version)]/types_swagger_doc_generated.go" } for group_version in [$(GROUP_VERSIONS[@])] { kube::swagger::gen_types_swagger_doc $(group_version) $[kube::util::group-version-to-pkg-path $(group_version)] } (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: [74 82] ) (/..) } spids: [73] ) ] spids: [73] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/init.sh))}) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/swagger.sh))}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (golang) (Lit_Other ":") (Lit_Other ":") (setup_env)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GROUP_VERSIONS) op: Equal rhs: { (ArrayLiteralPart words: [{(meta/v1)} {(meta/v1alpha1)} {(${ VSub_Name KUBE_AVAILABLE_GROUP_VERSIONS)}] ) } spids: [113] ) ] spids: [113] ) (ForEach iter_name: group_version iter_words: [ { (DQ (BracedVarSub token: bracket_op: (WholeArray op_id:Lit_At) spids: [135 140] ) ) } ] do_arg_iter: False body: (DoGroup children: [ (C {(rm)} {(-f)} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(kube) (Lit_Other ":") (Lit_Other ":") (util) (Lit_Other ":") (Lit_Other ":") (group-version-to-pkg-path) } {(DQ (${ VSub_Name group_version))} ) ] ) left_token: spids: [152 166] ) (/types_swagger_doc_generated.go) ) } ) ] spids: [144 170] ) spids: [133 142] ) (ForEach iter_name: group_version iter_words: [ { (DQ (BracedVarSub token: bracket_op: (WholeArray op_id:Lit_At) spids: [179 184] ) ) } ] do_arg_iter: False body: (DoGroup children: [ (C {(kube) (Lit_Other ":") (Lit_Other ":") (swagger) (Lit_Other ":") (Lit_Other ":") (gen_types_swagger_doc) } {(DQ (${ VSub_Name group_version))} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(kube) (Lit_Other ":") (Lit_Other ":") (util) (Lit_Other ":") (Lit_Other ":") (group-version-to-pkg-path) } {(DQ (${ VSub_Name group_version))} ) ] ) left_token: spids: [206 220] ) ) } ) ] spids: [188 223] ) spids: [177 186] ) ] )