forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add go_genrule for zz_generated.openapi.go.
Clean zz_generated.openapi.go before running gazel.
- Loading branch information
Showing
5 changed files
with
83 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
load("@io_kubernetes_build//defs:go.bzl", "go_genrule") | ||
|
||
def openapi_library(name, tags, srcs, openapi_targets=[], vendor_targets=[]): | ||
deps = [ | ||
"//vendor/github.com/go-openapi/spec:go_default_library", | ||
"//vendor/k8s.io/apimachinery/pkg/openapi:go_default_library", | ||
] + ["//%s:go_default_library" % target for target in openapi_targets] + ["//vendor/%s:go_default_library" % target for target in vendor_targets] | ||
go_library( | ||
name=name, | ||
tags=tags, | ||
srcs=srcs + [":zz_generated.openapi"], | ||
deps=deps, | ||
) | ||
go_genrule( | ||
name = "zz_generated.openapi", | ||
srcs = srcs + ["//hack/boilerplate:boilerplate.go.txt"], | ||
outs = ["zz_generated.openapi.go"], | ||
cmd = " ".join([ | ||
"$(location //cmd/libs/go2idl/openapi-gen)", | ||
"--v 1", | ||
"--logtostderr", | ||
"--go-header-file $(location //hack/boilerplate:boilerplate.go.txt)", | ||
"--output-file-base zz_generated.openapi", | ||
"--output-package k8s.io/kubernetes/pkg/generated/openapi", | ||
"--input-dirs " + ",".join(["k8s.io/kubernetes/" + target for target in openapi_targets] + ["k8s.io/kubernetes/vendor/" + target for target in vendor_targets]), | ||
"&& cp pkg/generated/openapi/zz_generated.openapi.go $(GENDIR)/pkg/generated/openapi", | ||
]), | ||
go_deps = deps, | ||
tools = ["//cmd/libs/go2idl/openapi-gen"], | ||
) |