...

Text file src/github.com/GoogleCloudPlatform/k8s-config-connector/scripts/generate-go-crd-clients/generate-clients.sh

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/scripts/generate-go-crd-clients

     1#!/bin/bash
     2# Copyright 2022 Google LLC
     3#
     4# Licensed under the Apache License, Version 2.0 (the "License");
     5# you may not use this file except in compliance with the License.
     6# You may obtain a copy of the License at
     7#
     8#      http://www.apache.org/licenses/LICENSE-2.0
     9#
    10# Unless required by applicable law or agreed to in writing, software
    11# distributed under the License is distributed on an "AS IS" BASIS,
    12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13# See the License for the specific language governing permissions and
    14# limitations under the License.
    15
    16
    17set -o errexit
    18set -o nounset
    19set -o pipefail
    20
    21
    22source $(dirname "${BASH_SOURCE}")/../shared-vars-public.sh
    23cd "${REPO_ROOT}/pkg/clients/generated/"
    24
    25# Extract API & version names
    26API_DIRS=(apis/*/*/)
    27API_VERSIONS=()
    28for DIR in "${API_DIRS[@]}";
    29do
    30  API_VERSIONS+=($(echo ${DIR} | cut -d'/' -f 2,3))
    31done
    32
    33# Join API/version names into a comma-separated list
    34printf -v JOINED '%s,' "${API_VERSIONS[@]:1}"
    35JOINED="${JOINED}${API_VERSIONS[0]}"
    36
    37go run ${REPO_ROOT}/scripts/client-gen/main.go --clientset-name versioned --input-base github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis --input ${JOINED} --output-base ../ --output-package github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset -h ${REPO_ROOT}/hack/boilerplate_client_alpha.go.txt
    38
    39# Clients are generated in a temp github.com/ folder where we pull the
    40# generated files out into a cleared pkg/client/ folder
    41rm -rf client/
    42mv ../github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client .
    43rm -rf ../cnrm.googlesource.com

View as plain text