-
Notifications
You must be signed in to change notification settings - Fork 426
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
Introduce rust_common struct #575
Conversation
Can you also add this to the docs in |
3dd73cd
to
1df461f
Compare
1df461f
to
e66bb69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the naming a bit strange, as providers tend to take the form FooInfo (e.g. JavaInfo
) - in the Java example, java_common.compile
returns a JavaInfo
and is typically referenced thus, rather than as java_common.compile
...
I understand moving CrateInfo
to a specific providers file, and making more clear what's public, but I'm not so clear on why rust_common
is a useful wrapper layer?
@@ -430,7 +430,7 @@ _common_attrs = { | |||
List of `rust_library` targets with kind `proc-macro` used to help build this library target. | |||
"""), | |||
cfg = "exec", | |||
providers = [CrateInfo], | |||
providers = [rust_common.crate_info], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this works, but I guess I can see how it would...!
My thinking:
Am I making any sense? |
This is the only one I'm not super clear on, but I'll defer to your experience! :) |
Would still appreciate having docs updated 😅 |
I was looking for a way to handle that in an automated fashion on submit. There's probably a way to setup a github action to push to a "docs" branch and then serve the pages from there, but I need to look into it further. |
Discussed with Andre offline, right now the docs tooling doesn't support generating docs for structs, only rules and macros it seems. |
This PR introduces a
rust_common
struct that will be used to access the Rust Sandwich API (the term first introduced in https://bazel.build/designs/2016/08/04/extensibility-for-native-rules.html and used ever since, for example https://blog.bazel.build/2017/03/07/java-sandwich.html :)The motivation for this change:
hasattr
function.hassattr
only works on struct fields, not on globals.The plan is to eventually refactor uses of all private APIs to go trough
rust_common
.Credit goes to brave owners of
rules_swift
who discovered how useful this approach is the hard way.