-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: generate swagger docs w/ bazel
Also build in CI as well as `dev generate docs`. Closes #77395. Release note: None
- Loading branch information
1 parent
da050a4
commit db58cf6
Showing
4 changed files
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_path") | ||
|
||
genrule( | ||
name = "swagger", | ||
srcs = [ | ||
":swagger_go_path", | ||
], | ||
outs = ["spec.json"], | ||
cmd = """ | ||
GO_REL_PATH=`dirname $(location @go_sdk//:bin/go)` | ||
GO_ABS_PATH=`cd $$GO_REL_PATH && pwd` | ||
env PATH=$$GO_ABS_PATH HOME=$(GENDIR) GOPATH=$$(cd $(location :swagger_go_path) && pwd) GO111MODULE=off \ | ||
$(location @com_github_go_swagger_go_swagger//cmd/swagger) generate spec -w $(location :swagger_go_path)/src/github.com/cockroachdb/cockroach/pkg --scan-models -t bazel -o $@ | ||
""", | ||
exec_tools = [ | ||
"@com_github_go_swagger_go_swagger//cmd/swagger", | ||
"@go_sdk//:bin/go", | ||
], | ||
) | ||
|
||
go_path( | ||
name = "swagger_go_path", | ||
deps = [ | ||
"//pkg/server", | ||
], | ||
) |
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