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

Fix cargo-bazel recompile for MODULE.bazel #2570

Merged

Conversation

ericmcbride
Copy link
Contributor

@ericmcbride ericmcbride commented Mar 22, 2024

  • Addresses cargo-bazel always recompiling with Bzlmod #2531
  • Wrote a function, thats basically copy / pasted from crates_universe/private/generate_utils.bzl to account for the module_ctx Can probably make the original function more generic if thats more desired. I'm not sure if the maintainers would prefer a one off, since the MODULE.bazel feature set for crates_universe isn't exactly "Stable" yet.
  • Noticed theres no way to "bootstrap" the new cargo features in MODULE.bazel , like you can for crates_universe. May need to open an issue for this. Tested by using the CARGO_BAZEL_GENERATOR_URL and CARGO_BAZEL_GENERATOR_SHA256 environmentals. This looks to cause some failing unit tests. Not sure how to get support on this
  • Failsafe of using the cargo buildstrap cargo-bazel if no URLs are found, and if theres no environmentals.

Copy link

google-cla bot commented Mar 22, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ericmcbride ericmcbride changed the title WIP: Fix cargo-bazel recompile for MODULE.bazel Fix cargo-bazel recompile for MODULE.bazel Mar 22, 2024
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Good catch here! I just had a couple of nits

crate_universe/extension.bzl Outdated Show resolved Hide resolved
crate_universe/extension.bzl Outdated Show resolved Hide resolved
@UebelAndre
Copy link
Collaborator

  • Noticed theres no way to "bootstrap" the new cargo features in MODULE.bazel , like you can for crates_universe. May need to open an issue for this. Tested by using the CARGO_BAZEL_GENERATOR_URL and CARGO_BAZEL_GENERATOR_SHA256 environmentals. This looks to cause some failing unit tests. Not sure how to get support on this

This can probably be spawned into a separate issue.

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@UebelAndre UebelAndre added this pull request to the merge queue Mar 26, 2024
@UebelAndre
Copy link
Collaborator

  • Noticed theres no way to "bootstrap" the new cargo features in MODULE.bazel , like you can for crates_universe. May need to open an issue for this. Tested by using the CARGO_BAZEL_GENERATOR_URL and CARGO_BAZEL_GENERATOR_SHA256 environmentals. This looks to cause some failing unit tests. Not sure how to get support on this

This can probably be spawned into a separate issue.

Would you also be willing to write up a new issue for this?

@UebelAndre UebelAndre removed this pull request from the merge queue due to a manual request Mar 26, 2024
@UebelAndre UebelAndre added this pull request to the merge queue Mar 26, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Mar 26, 2024
@ericmcbride
Copy link
Contributor Author

  • Noticed theres no way to "bootstrap" the new cargo features in MODULE.bazel , like you can for crates_universe. May need to open an issue for this. Tested by using the CARGO_BAZEL_GENERATOR_URL and CARGO_BAZEL_GENERATOR_SHA256 environmentals. This looks to cause some failing unit tests. Not sure how to get support on this

This can probably be spawned into a separate issue.

Would you also be willing to write up a new issue for this?

On it

@UebelAndre
Copy link
Collaborator

I also might have messed up resolving the merge conflict. Would you be able to take a look?

@ericmcbride
Copy link
Contributor Author

ericmcbride commented Mar 26, 2024

I also might have messed up resolving the merge conflict. Would you be able to take a look?

Yes. I also see main is failing for the same reason, just a different job

Main Failure:

OSError: [Errno 8] Exec format error: '/tmp/tmpiq788gfy/bazelci-agent'

My Failure:

OSError: [Errno 8] Exec format error: '/tmp/tmpb3zib8cm/bazelci-agent'

auto-merge was automatically disabled March 26, 2024 15:37

Head branch was pushed to by a user without write access

@UebelAndre UebelAndre added this pull request to the merge queue Mar 26, 2024
Merged via the queue into bazelbuild:main with commit fc601ba Mar 26, 2024
3 checks passed
@ericmcbride ericmcbride deleted the add_get_generator_support_bzl_mod branch March 26, 2024 21:51
fmeum pushed a commit to bazel-contrib/toolchains_llvm that referenced this pull request Mar 28, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [rules_rust](https://togithub.com/bazelbuild/rules_rust) |
http_archive | minor | `0.40.0` -> `0.41.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_rust (rules_rust)</summary>

###
[`v0.41.0`](https://togithub.com/bazelbuild/rules_rust/releases/tag/0.41.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_rust/compare/0.40.0...0.41.0)

### 0.41.0

```python
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_rust",
    integrity = "sha256-Y4v6kjQQfXxh5tU6FQB6YXux/ODFGUq3IlpgBV4Bwj8=",
    urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.41.0/rules_rust-v0.41.0.tar.gz"],
)
```

Additional documentation can be found at:
https://bazelbuild.github.io/rules_rust/#setup

#### What's Changed

- Add example of cross-compiling with musl by
[@&#8203;illicitonion](https://togithub.com/illicitonion) in
[bazelbuild/rules_rust#2535
- Temporarily disable "Examples Clang with LLD" CI job by
[@&#8203;UebelAndre](https://togithub.com/UebelAndre) in
[bazelbuild/rules_rust#2560
- Update cargo_toml to `0.19.2` by
[@&#8203;jun-sheaf](https://togithub.com/jun-sheaf) in
[bazelbuild/rules_rust#2551
- Stop rustfmt versioning from overriding rust-analyzer versioning. by
[@&#8203;ReticentIris](https://togithub.com/ReticentIris) in
[bazelbuild/rules_rust#2553
- Rust Analyzer added NixOS supported platforms by
[@&#8203;rickvanprim](https://togithub.com/rickvanprim) in
[bazelbuild/rules_rust#2547
- Removed unused 'select_with_or' by
[@&#8203;dzbarsky](https://togithub.com/dzbarsky) in
[bazelbuild/rules_rust#2562
- Added Rust 1.77.0 by
[@&#8203;UebelAndre](https://togithub.com/UebelAndre) in
[bazelbuild/rules_rust#2568
- bzlmod: fix issue with nightly versions by
[@&#8203;QuentinPerez](https://togithub.com/QuentinPerez) in
[bazelbuild/rules_rust#2545
- Allow a no-cargo setup for bzlmod by
[@&#8203;dzbarsky](https://togithub.com/dzbarsky) in
[bazelbuild/rules_rust#2565
- Fixed genquery for rust targets by
[@&#8203;UebelAndre](https://togithub.com/UebelAndre) in
[bazelbuild/rules_rust#2559
- Fix cargo-bazel recompile for MODULE.bazel by
[@&#8203;ericmcbride](https://togithub.com/ericmcbride) in
[bazelbuild/rules_rust#2570
- Minor cleanup of bzl files by
[@&#8203;UebelAndre](https://togithub.com/UebelAndre) in
[bazelbuild/rules_rust#2573
- Added starlark unit tests for `rust_toolchain.opt_level` by
[@&#8203;UebelAndre](https://togithub.com/UebelAndre) in
[bazelbuild/rules_rust#2578
- Mark the bzlmod extension reproducible as appropriate by
[@&#8203;dzbarsky](https://togithub.com/dzbarsky) in
[bazelbuild/rules_rust#2575
- Release 0.41.0 by
[@&#8203;UebelAndre](https://togithub.com/UebelAndre) in
[bazelbuild/rules_rust#2569

#### New Contributors

- [@&#8203;jun-sheaf](https://togithub.com/jun-sheaf) made their first
contribution in
[bazelbuild/rules_rust#2551
- [@&#8203;ReticentIris](https://togithub.com/ReticentIris) made their
first contribution in
[bazelbuild/rules_rust#2553
- [@&#8203;QuentinPerez](https://togithub.com/QuentinPerez) made their
first contribution in
[bazelbuild/rules_rust#2545
- [@&#8203;ericmcbride](https://togithub.com/ericmcbride) made their
first contribution in
[bazelbuild/rules_rust#2570

**Full Changelog**:
bazelbuild/rules_rust@0.40.0...0.41.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/bazel-contrib/toolchains_llvm).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

None yet

3 participants