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

Rustdoc rules now share a code path with Rustc rules for more consistency #1015

Merged
merged 4 commits into from
Nov 15, 2021

Conversation

UebelAndre
Copy link
Collaborator

@UebelAndre UebelAndre commented Nov 14, 2021

rust_doc

The first issue I faced with rust_doc was #947 but quickly found there were many more variables being defined for Rustc actions but not Rustdoc, leading to my inability to use the rule. The changes here introduce a macro @rules_rust//rust/private:rustdoc.bzl%rustdoc_compile_action designed to create a near identical action @rules_rust//rust/private:rustc.bzl&rustc_compile_action for improved consistency in generating docs to solve for the issues I ran into.

rust_doc_test

Additionally, the rust_doc_test was similarly unusable due to the fact that rustdoc --test builds and tests binaries as a test execution but the test environment was quite different from the build environments of Rustdoc and Rustc actions. This PR shares the same rustdoc_compile_action functionality to determine action args, environment vars, and inputs and write an executable to rebuild an execution environment similar to the build actions.

Notably, this fixes rust_doc_test in RBE and Windows environments.

Related Issues

closes #887
closes #947
closes #804
closes #1016

@google-cla google-cla bot added the cla: yes label Nov 14, 2021
@UebelAndre UebelAndre force-pushed the rustdoc branch 15 times, most recently from 93af95c to 142cc88 Compare November 14, 2021 17:47
@UebelAndre UebelAndre marked this pull request as ready for review November 14, 2021 18:01
@UebelAndre UebelAndre marked this pull request as draft November 14, 2021 18:33
Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

Looks like a nice clean-up, thanks!

tools/rustdoc/rustdoc_test_writer.rs Outdated Show resolved Hide resolved
tools/rustdoc/rustdoc_test_writer.rs Outdated Show resolved Hide resolved
rust/private/rustdoc_test.bzl Show resolved Hide resolved
@UebelAndre
Copy link
Collaborator Author

I was unfortunately not able to get a solution for #980 in this PR (which is a hard problem to solve, for me 😅).

@UebelAndre UebelAndre marked this pull request as ready for review November 15, 2021 15:26
Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

Thanks!

@UebelAndre UebelAndre merged commit e7b1e5a into bazelbuild:main Nov 15, 2021
@UebelAndre UebelAndre deleted the rustdoc branch November 15, 2021 18:07
ddeville pushed a commit to ddeville/rules_rust that referenced this pull request Nov 22, 2021
…ency (bazelbuild#1015)

* Rustdoc rules now share a code path with Rustc rules for more consistency

* Regenerate documentation

* Addressed PR feedback

* Addressed PR feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants