-
Notifications
You must be signed in to change notification settings - Fork 402
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
rename_first_party_crates flag #1013
Comments
More detail: Google has some Rust in its source repository, and we have realized that rules_rust's current approach to naming crates (i.e., using the target name as the crate name) will not work for us. We need to use a naming scheme that uniquely identifies each first-party crate, and associates it with the entire Bazel label that it was built from; for third-party crates, we can use the crate's actual name (without modification). The motivations for this are the following:
To achieve those goals, we need the following properties:
We're experimenting with a proc_macro to achieve this. Example usage of the macro could be the following: import! {
"//some_project:utils";
"//some_project:ugly_name" as something_else;
"//third_party/rust/serde";
"//third_party/rust/clap" as aliased_clap;
} This would expand to: extern crate some_project_COLON_utils as utils;
extern crate some_project_COLON_ugly_name as something_else;
extern crate serde;
extern crate clap as aliased_clap; Note here, that the source completely encodes its dependencies (so the BUILD file can be updated automatically without any other knowledge of the repo), but the vendored crates don't need to be renamed. In order for this to work, we need to implement the above proc_macro, and to modify the implementation of We will also add an associated flag to control the location of vendored deps, i.e. which targets are considered to be third-party and therefore exempt from renaming. |
Sorry, what specifically does |
Yup, "first-party". Happy to use a different name if you have suggestions, I'm not set on this one in particular. |
I'm no stranger to verbosity so I'd opt for something like |
Sounds good - I've renamed the flag in #1056 :) |
Tentatively closing this issue now, since I think all the parts we need have been implemented. I'll reopen if we discover any issues in our experimentation downstream. |
This is a tracking issue for the idea described in #1008.
The text was updated successfully, but these errors were encountered: