|
1 |
| -#!/usr/bin/env -S bash -e |
| 1 | +#!/usr/bin/env bash |
2 | 2 |
|
3 | 3 | # Copyright 2018 The Rook Authors. All rights reserved.
|
4 | 4 | #
|
|
14 | 14 | # See the License for the specific language governing permissions and
|
15 | 15 | # limitations under the License.
|
16 | 16 |
|
17 |
| -GROUP_VERSIONS="ceph.rook.io:v1" |
| 17 | +set -o errexit |
| 18 | +set -o nounset |
| 19 | +set -o pipefail |
18 | 20 |
|
19 |
| -scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 21 | +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
20 | 22 |
|
21 |
| -# CODE GENERATION |
22 |
| -# we run deepcopy and client,lister,informer generations separately so we can use the flag "--plural-exceptions" |
23 |
| -# which is only known by client,lister,informer binary and not the deepcopy binary |
| 23 | +base_dir="$(cd "${script_dir}/../.." && pwd)" |
24 | 24 |
|
25 |
| -# run code deepcopy generation |
26 |
| -bash ${CODE_GENERATOR}/generate-groups.sh \ |
27 |
| - deepcopy \ |
28 |
| - github.com/rook/rook/pkg/client \ |
29 |
| - github.com/rook/rook/pkg/apis \ |
30 |
| - "${GROUP_VERSIONS}" \ |
31 |
| - --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \ |
32 |
| - --go-header-file "${scriptdir}/boilerplate.go.txt" |
| 25 | +boilerplate="${base_dir}"/build/codegen/header.txt |
33 | 26 |
|
34 |
| -# run code client,lister,informer generation |
35 |
| -bash ${CODE_GENERATOR}/generate-groups.sh \ |
36 |
| - client,lister,informer \ |
37 |
| - github.com/rook/rook/pkg/client \ |
38 |
| - github.com/rook/rook/pkg/apis \ |
39 |
| - "${GROUP_VERSIONS}" \ |
40 |
| - --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \ |
41 |
| - --go-header-file "${scriptdir}/boilerplate.go.txt" \ |
42 |
| - --plural-exceptions "CephNFS:CephNFSes" \ |
| 27 | +source "${CODE_GENERATOR}/kube_codegen.sh" |
| 28 | +( |
| 29 | + # because apis is a separate go module, code generation |
| 30 | + # must be run from within the corresponding directory. |
| 31 | + cd ${base_dir}/pkg/apis |
| 32 | + |
| 33 | + # run code deepcopy generation |
| 34 | + kube::codegen::gen_helpers \ |
| 35 | + --boilerplate "${boilerplate}" \ |
| 36 | + "${base_dir}/pkg/apis" \ |
| 37 | + |
| 38 | + # run code client,lister,informer generation |
| 39 | + kube::codegen::gen_client \ |
| 40 | + --output-dir "${base_dir}/pkg/client" \ |
| 41 | + --output-pkg "github.com/rook/rook/pkg/client" \ |
| 42 | + --boilerplate "${boilerplate}" \ |
| 43 | + --plural-exceptions "CephNFS:CephNFSes" \ |
| 44 | + --with-watch \ |
| 45 | + "${base_dir}/pkg/apis" |
| 46 | +) |
0 commit comments