From 4503d573d3b93c9b91ac52d81363ca06a6db0324 Mon Sep 17 00:00:00 2001 From: Jeff Grafton Date: Tue, 6 Nov 2018 15:42:19 -0800 Subject: [PATCH] Use new codegen config options in kazel and fix boilerplate check for generated bzl --- build/root/.kazelcfg.json | 6 +++++- hack/boilerplate/boilerplate.generatebzl.txt | 14 ++++++++++++++ hack/boilerplate/boilerplate.py | 8 +++++--- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 hack/boilerplate/boilerplate.generatebzl.txt diff --git a/build/root/.kazelcfg.json b/build/root/.kazelcfg.json index fae9ddd5f06..342cc3e0dab 100644 --- a/build/root/.kazelcfg.json +++ b/build/root/.kazelcfg.json @@ -6,5 +6,9 @@ "^third_party/etcd.*" ], "AddSourcesRules": true, - "K8sOpenAPIGen": true + "K8sCodegenBzlFile": "build/kazel_generated.bzl", + "K8sCodegenBoilerplateFile": "hack/boilerplate/boilerplate.generatebzl.txt", + "K8sCodegenTags": [ + "openapi-gen" + ] } diff --git a/hack/boilerplate/boilerplate.generatebzl.txt b/hack/boilerplate/boilerplate.generatebzl.txt new file mode 100644 index 00000000000..069e282bc85 --- /dev/null +++ b/hack/boilerplate/boilerplate.generatebzl.txt @@ -0,0 +1,14 @@ +# Copyright 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. + diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index 594d71ca0cd..9f746837171 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -83,10 +83,12 @@ def file_passes(filename, refs, regexs): generated = is_generated_file(filename, data, regexs) basename = os.path.basename(filename) + extension = file_extension(filename) if generated: - extension = "generatego" - else: - extension = file_extension(filename) + if extension == "go": + extension = "generatego" + elif extension == "bzl": + extension = "generatebzl" if extension != "": ref = refs[extension]