Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel: build http docs w bazel #68834

Merged
merged 1 commit into from
Aug 17, 2021
Merged

Conversation

rickystewart
Copy link
Collaborator

@rickystewart rickystewart commented Aug 12, 2021

We generate this in a different way than the Makefile does -- we take
all the proto descriptor sets (that we need to generate anyway as part
of the build) and pass them in to protoc rather than passing a bunch
of include paths, which wouldn't work terribly well in the sandbox.

Also teach CI and dev to start building these docs.

I deleted a stray comment in pkg/server/serverpb/admin.proto that was
causing a diff in the generated file. I also had to patch
@com_github_pseudomuto_protoc_gen_doc to quash a compiler error (I
just deleted a dependency that isn't actually necessary).

Closes #65814.

Release note: None

@rickystewart rickystewart requested a review from rail August 12, 2021 22:04
@rickystewart rickystewart requested review from a team as code owners August 12, 2021 22:04
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rickystewart rickystewart force-pushed the http_docs branch 2 times, most recently from 1630fd1 to cb74bb7 Compare August 16, 2021 15:39
@rickystewart rickystewart removed request for a team August 16, 2021 15:39
Copy link
Member

@rail rail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In overall it looks great. Just a few nits.

Reviewed 7 of 8 files at r2, 13 of 13 files at r3, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rickystewart)


pkg/cmd/docgen/http.go, line 88 at r3 (raw file):

	}()
	var args []string
	if len(protocPath) == 0 {

This check made me think twice. :) Can you use if protocPath == "" instead to highlight we are comparing a string and not a slice (len() made me think it's a slice).


pkg/cmd/docgen/http.go, line 95 at r3 (raw file):

		fmt.Sprintf("--doc_opt=%s,http.json", jsonTmpl),
		fmt.Sprintf("--plugin=protoc-gen-doc=%s", genDocPath))
	args = append(args, strings.Fields(protocFlags)...)

It'd be safer to use something like https://pkg.go.dev/github.com/google/shlex, but probably not a big deal now.


pkg/cmd/docgen/http.go, line 98 at r3 (raw file):

	// Generate the JSON file.
	executable := protocPath
	if len(protocPath) == 0 {

And same here, can you if protocPath == "" instead?

We generate this in a different way than the `Makefile` does -- we take
all the proto descriptor sets (that we need to generate anyway as part
of the build) and pass them in to `protoc` rather than passing a bunch
of include paths, which wouldn't work terribly well in the sandbox.

Also teach CI and `dev` to start building these docs.

I deleted a stray comment in `pkg/server/serverpb/admin.proto` that was
causing a diff in the generated file. I also had to patch
`@com_github_pseudomuto_protoc_gen_doc` to quash a compiler error (I
just deleted a dependency that isn't actually necessary).

Closes cockroachdb#65814.

Release note: None
Copy link
Collaborator Author

@rickystewart rickystewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rail)


pkg/cmd/docgen/http.go, line 88 at r3 (raw file):

Previously, rail (Rail Aliiev) wrote…

This check made me think twice. :) Can you use if protocPath == "" instead to highlight we are comparing a string and not a slice (len() made me think it's a slice).

Done.


pkg/cmd/docgen/http.go, line 98 at r3 (raw file):

Previously, rail (Rail Aliiev) wrote…

And same here, can you if protocPath == "" instead?

Done.

Copy link
Member

@rail rail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rickystewart)

@rickystewart
Copy link
Collaborator Author

bors r=rail

@craig
Copy link
Contributor

craig bot commented Aug 17, 2021

Build succeeded:

@craig craig bot merged commit f6684cb into cockroachdb:master Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bazel: add build targets for HTTP API documentation, start building in CI
3 participants