-
Notifications
You must be signed in to change notification settings - Fork 440
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
Migrate cargo-raze
into rules_rust
#590
Conversation
* Support './' in lib.path targets * Add normal target to test
* Complain to stderr about unused raze settings. * Provide more useful help message.
Fixes issue #1
…nternals) (#28) Refactor planning in the manner of `cargo metadata` (but keep using internals)
* Integrate the examples into cargo-raze * Add the remote examples as well * Add a README doc for remote examples * Fix the build after adding remote README * Remove examples for PR * Enable -f on `rm` so no error if dirs don't exist * Explicitly reset working directory back to original * Rename examples/README.md * Move the command exists check to a function * Make sure `command_exists` actually checks for existence * DIR -> REPO_ROOT
* Fixes for #36 * Updates for Cargo.toml * Fix some pathing issues with smoke-test.sh * Fix up travis not liking the new packaging
* Add the sha256 to the generated http_archive This is good practice to have them and we get them for free from Cargo. * Remove unused warnings * Update Cargo.lock The previous one doesn't build on my platform. * Address acmcarther@ suggestions
Now that rust_library/rust_binary supports it.
Using native.existing_rules allow to use several crates.bzl file that would import the same crates without failing with duplicate rules.
* Pass 2 on remote git targets Previously this worked with the example because it actually resolved to crates.io even for "git" packages. The example was included before it was ready, and only because it relied exclusively on things already on crates.io did it compile in the first place. Tests back to compiling and running true -> True Fix a pathing issue Fix some unused imports * Suggested changes
* WIP: RM separate remote_ files * Simplify build_path slightly * More progress * Fix a test, save a life * Put the remote_crates back
* Update README.md Update the examples location now that they're inline to the main repository. * Update README.md Add back the OpenSSL example
* Wip the first * Wip the second * Clean code -- terrible formatter * Handle a lot of nits, but not the failing tests * Fix broken index insertion (debug_uggh) and rendering * Fix bug where root crate was expected to be vendored * Fix crate_context.build_path and update missing root crate test * Fix minor bugs with file generations * Fix tests and update some context var names
This rule is never used and was renamed in recent rust rules into rust_bechmark.
…ctory (#62) * Patch examples with latest cargo-raze generated output * Update deps, fix deprecation warnings, up to 0.1.0
It's not that changes to Again, very interested in your workflow. While I think merging the two repos would be a good idea, It's not (currently) my burning passion. I like the idea that the rules has a standardized tool so that all workflows can, to a more thorough degree, be brought to the same place and everyone can benefit from questions/changes. |
One other thing of note, I think if there's considerations for adding something like |
* `rust_rules_workspace_name` now defaults to `rules_rust` * Renamed `io_bazel_rules_rust` to `rules_rust` throughout the workspace * Updated branch name for rules_rust
A bug was fixed where the "CARGO" environment variable wasn't being when looking for a cargo binary. This has been corrected and is now in use.
…t's config_settings (#372)
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
I've always wondered if it's worth having rules_rust focus explicitly on rustc, and then have other things implemented on top of that. What has been hard, I think is that rules_rust didn't expose enough of an interface for people to build things like clippy or protobuf integration on top of it. The architecture that is described in #596, which @hlopko has been working towards with rust_common (providing a more rule_cc-like interface to rules rust) starts to solve some of those issues. This PR is probably an opportune time to think about drawing some clear lines about what is rust and what is cargo. Where it has been intermixed has led to some weird results, such as rules_proto being stuck on a particular crate version, where updating it would be a breaking change. Proper versioning in rules_rust would probably help (though it has a larger API surface than I would like). |
I 100% agree. Though, I feel there can be a clear separation of responsibility within the same git repository. I think adding this to the |
True, but that makes versioning the project a little more tricky if the major sem-ver is attached to both the rust and the cargo, and particularly cargo-raze APIs. |
Given that only cargo-raze has any useful notion of versioning, I think that's something we can solve or set the standard for going forward fairly easily as it likely won't disrupt existing users. I personally don't think this is an issue and would imagine we tag releases with the thing actually being released (cargo or rustc rules). Or is that not a reasonable approach? I thought Google was known for monorepos, how is versioning handled internally? |
I haven't had the time to This mirrors my response to an email to me from @hlopko that I felt should generally be public. In general I'm against this PR, not because I have some nuanced vision for the future of rules_rust, but primarily because I don't like how cargo-raze deals with the cargo-bazel integration, and would like there to be a vacuum of sorts to leave room for something "better" to fill the space. I think having this moved into rules_rust (by varying degrees, depending on whether it's in the repo "proper", or just lives in a contrib directory, or something else) solidifies this tool as the canonical way of things. I'm not super excited about that possibility. I think a large part of any compatibility concern can be mitigated by having rules_rust include some test suite that builds a toy application using cargo-raze. EDIT: https://github.com/facebookincubator/reindeer looks pretty interesting! |
I totally get that moving |
Hi, Side-rant: for some reason github seems to hide some earlier comments :/ I also feel mixed about this PR. While I would love to see a canonical way to handle the cargo eco-system I also feel mixed with the current cargo raze approach which has problem scaling with monorepos (maintain 1000s of cargo files) and requires to write dependencies in a different language than the bazel one. My view of the next step world would be where bazel is responsible for the download and compilation and maybe doing dependency resolution using a tool integrated with cargo (though I am pretty sure cargo graph resolution will blow up at some point). Cargo raze could be the tool doing the dependency resolution but I am not sure it is needed (could be using just the output of cargo instead). The final world I see would probably require a custom dependency resolution tooling. I.e. I see a final usable states to have a set of depedency declared in a WORKSPACE file and pull their transitive deps the same way Cargo does but that requires also Bazel to get its story straight regarding external dependencies (and to be honest, I don't feel like there is any hope for a satisfying solution in the forseeable future). |
(I wrote to the Google Open Source Program Office, will report when I hear back). Ok let's try to move forward with the discussion. After some thinking I came to the following conclusions:
Andre, if you can find a champion, and OSPO approves my proposal, feel free to move forward. I'd recommend to:
|
I would strongly advocate for this going into the
There's currently only 1 change other than a straight merge and it's the
I believe this PR is doing that.
Makes sense but I also don't think it's a blocker for any merge.
Given that seemingly all "champions" are here and have said they don't like, it doesn't seem like this change is going to go through. Additionally, I have no idea how to interface with OSPO and don't think that's clear to anyone outside of Google. I'm just going to close this because of the amount of push back it's getting. I'm happy to continue any conversations here or in some other form for things people would like to clarify or dig deeper into. |
Thanks for opening that discussion and driving it @UebelAndre, just to clarify the position of most seems like we would like to see a better approach to handling crate than the one cargo raze offer. If you have a good idea on how to deal with the problem, that would be a very interesting discussion to drive. |
rules_go has a different approach: |
I heard back from the OSPO, they approved the move. Not relevant anymore here it seems but it can be useful in the future. +1 to what Damien said. Thank you @UebelAndre for pushing for this (and for all the other work you're doing for this repository!). It seems there is an opportunity to come up with a better solution. The first step would be to collect all the various (and maybe conflicting) requirements people have and come up with a solution that satisfies all. Maybe you can build on the momentum of this PR to collect more information and see if it would be interesting for you to drive the effort. Thanks again! |
This PR moves cargo-raze into this repo. There is a lot of functionality that is coupled between the two projects that I feel it makes sense to have the code in one place.
This is the simplest form of a migration I can think of. It moves all the code into
cargo/cargo_raze
and adds the directory to.bazelignore
so it doesn't affect existing CI.A future change should be made to better integrate this into CI but that can be a separate PR with tracked changes and more realistically reviewable PRs.
cc: @acmcarther @damienmg @illicitonion @mfarrugi @dfreese @hlopko