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

Render Config error using crates_vendor #2218

Open
ericmcbride opened this issue Oct 26, 2023 · 2 comments
Open

Render Config error using crates_vendor #2218

ericmcbride opened this issue Oct 26, 2023 · 2 comments

Comments

@ericmcbride
Copy link
Contributor

ericmcbride commented Oct 26, 2023

I have the current snippet in my BUILD file.

crates_vendor(
    name = "some_vendor",
    manifests = [":Cargo.toml"],
    mode = "local",
    render_config = render_config(
        regen_command = "run bazel //vi:some_vendor",
        default_package_name = "",
        crate_repository_template = "{name}",
        crate_label_template = "@{repository}__{name}//:{target}",
    )
)

I am getting the following error when I run the command bazel run //vi::some_vendor, being in a vi directory.

Error in fail: The `crates_vendor.render_config` attribute does not support the `crate_label_template` parameter. Please update @//vi:some_vendor to remove this value.

While looking through the starlark, its not transparent to me that you can actually use the render_config with different values from the default_config.

https://github.com/bazelbuild/rules_rust/blob/15572051f0a7c3c83d1cd73de72c8110729db4d8/crate_universe/private/crates_vendor.bzl#L164C1-L171C1

The error goes away when I do a 1:1 match with the default provided by render_config()

Can i get some guidance here, to make sure im understanding this correctly?

Im guessing the developers were wanting to make sure the keys matched and not the values, but this seems to be checking the values if i am understanding correctly.

@ericmcbride
Copy link
Contributor Author

Im willing to fix this, If i can get clarification on the expected behavior

@UebelAndre
Copy link
Collaborator

While looking through the starlark, its not transparent to me that you can actually use the render_config with different values from the default_config.

https://github.com/bazelbuild/rules_rust/blob/15572051f0a7c3c83d1cd73de72c8110729db4d8/crate_universe/private/crates_vendor.bzl#L164C1-L171C1

The error goes away when I do a 1:1 match with the default provided by render_config()

Can i get some guidance here, to make sure im understanding this correctly?

I think this code should be relaxed to allow users to set default_package_name, regen_command, and platforms_template. The rule should otherwise determine the rest of the values. That should just be a small update to the code you already identified. Would that work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants