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

Is the raze-level "target" setting still needed? #131

Open
sayrer opened this issue Feb 3, 2020 · 6 comments
Open

Is the raze-level "target" setting still needed? #131

sayrer opened this issue Feb 3, 2020 · 6 comments

Comments

@sayrer
Copy link
Contributor

sayrer commented Feb 3, 2020

It seems like this should be set by Bazel itself.

@acmcarther
Copy link
Member

acmcarther commented Feb 12, 2020

In the current implementation, Bazel doesn't actually play much of a role until after Cargo's knowledge (metadata, primarily) is already gone. This is why we need to know the target ahead of time.

Long long ago in a distant land a tool very similar to this one simply converted the known information into a Cargo.bzl file which could be ingested by bazel and used at build time to generate the rules. This ran into a problem (which may no longer exist) around the "phases" of the build as defined by bazel.

I'm not sure if the issue was a real blocker or merely me lacking enough depth in bazel's implementation and support for workspace rules. I suspect it was that cargo's notion of dependency resolution doesn't fit well into either the loading phase (where it needs to be in order to result in BUILD rules) or the analysis phase (where it needs to be in order to access bzl files[1]). This can be worked around by doing work ahead of time or pushing information work out of Bazel.

This is still a valid question, and I think the issue should stay open.

[1] I'm not sure about this.

@acmcarther
Copy link
Member

rust-lang/cargo#5583, focused on distinguishing between dev deps and normal deps, target information for each dep, and crate renaming was just closed (as fixed).

This information is probably sufficient to generate BUILD rules for all targets as well as generating rust_test rules.

@UebelAndre
Copy link
Collaborator

So is it still needed?

@TheButlah
Copy link

I'm also confused - do I need a separate Cargo.toml for each platform I want to target?

@UebelAndre
Copy link
Collaborator

I don't think cargo-raze officially supports multi-platform configurations. You might wanna check out #43

@UebelAndre
Copy link
Collaborator

Does #212 solve for this issue?

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

No branches or pull requests

4 participants