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

crate_universe: Don't include crate name in build script path. #2663

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

criemen
Copy link
Contributor

@criemen criemen commented May 23, 2024

This PR shortens the path to the build script (potentially significantly), which helps with long-path issues on Windows.
This change is motivated by the crate tree-sitter-embedded-template, which has a too long path to the compiled build script otherwise, and which then fails to build on Windows in a bzlmod setting.
Fixes #2520.

The cargo build script name was used to automatically derive the cargo package name, this now went into a separate override parameter that is generated by the crate-universe tooling.
There's never two build scripts in a single crate, so I don't see how having a single build script target with a single name would be a problem.

This shortens the path to the build script (potentially significantly),
which should help with long-path issues on Windows.
@criemen criemen force-pushed the shorter-paths-windows branch 2 times, most recently from 8af92af to 86ee4a5 Compare May 23, 2024 15:00
Allow overwriting the package name for cargo build scripts, instead of
deriving it always from the target name. This is necessary for using
shorter build script target names on Windows.
@criemen criemen marked this pull request as ready for review May 23, 2024 15:08
Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

Seems reasonable - obviously this doesn't feel super tidy, but the constraints Windows imposes are real. Thanks for putting this together!

@illicitonion illicitonion added this pull request to the merge queue Jun 3, 2024
Merged via the queue into bazelbuild:main with commit e3f6258 Jun 3, 2024
3 checks passed
@criemen criemen deleted the shorter-paths-windows branch June 3, 2024 13:18
rrbutani pushed a commit to bazel-contrib/toolchains_llvm that referenced this pull request Jun 10, 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 | bazel_dep | minor | `0.45.1` -> `0.46.0` |
| [rules_rust](https://github.com/bazelbuild/rules_rust) |
http_archive | minor | `0.45.1` -> `0.46.0` |

---

### Release Notes

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

###
[`v0.46.0`](https://github.com/bazelbuild/rules_rust/releases/tag/0.46.0)

[Compare
Source](https://github.com/bazelbuild/rules_rust/compare/0.45.1...0.46.0)

##### 0.46.0

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

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

##### What's Changed

- fix: default rustfmt version to supplied rust version by
[@&#8203;mattem](https://github.com/mattem) in
[bazelbuild/rules_rust#2660
- Use repo-mapping-aware runfiles API in rust-analyzer by
[@&#8203;dzbarsky](https://github.com/dzbarsky) in
[bazelbuild/rules_rust#2666
- Fix protobuf generated srcs to include all sources by
[@&#8203;matts1](https://github.com/matts1) in
[bazelbuild/rules_rust#2676
- Fix cargo_build_script executables. by
[@&#8203;matts1](https://github.com/matts1) in
[bazelbuild/rules_rust#2675
- crate_universe: Don't include crate name in build script path. by
[@&#8203;criemen](https://github.com/criemen) in
[bazelbuild/rules_rust#2663
- Ensure dynamic library dependencies end up in the runfiles directory
by [@&#8203;EdSchouten](https://github.com/EdSchouten) in
[bazelbuild/rules_rust#2671
- use bazel_ci_rules bazel_dep instead of http_archive by
[@&#8203;mmorel-35](https://github.com/mmorel-35) in
[bazelbuild/rules_rust#2678
- Ensure that running `bazel build` on a cargo_build_script target
actually runs the build script by
[@&#8203;matts1](https://github.com/matts1) in
[bazelbuild/rules_rust#2680
- Allow overriding crate universe packages to local packages by
[@&#8203;ograff](https://github.com/ograff) in
[bazelbuild/rules_rust#2674
- Depend on a copy of rustfmt for the target by
[@&#8203;EdSchouten](https://github.com/EdSchouten) in
[bazelbuild/rules_rust#2685
- \[Bugfix] Convert metadata keys to screaming snake case instead of
screaming kebab case in `cargo_build_script_runner` by
[@&#8203;Pagten](https://github.com/Pagten) in
[bazelbuild/rules_rust#2682
- Add support for override_target when using bzlmod by
[@&#8203;AmeliasCode](https://github.com/AmeliasCode) in
[bazelbuild/rules_rust#2683
- Release 0.46.0 by
[@&#8203;illicitonion](https://github.com/illicitonion) in
[bazelbuild/rules_rust#2686

##### New Contributors

- [@&#8203;mattem](https://github.com/mattem) made their first
contribution in
[bazelbuild/rules_rust#2660
- [@&#8203;EdSchouten](https://github.com/EdSchouten) made their first
contribution in
[bazelbuild/rules_rust#2671
- [@&#8203;mmorel-35](https://github.com/mmorel-35) made their first
contribution in
[bazelbuild/rules_rust#2678
- [@&#8203;ograff](https://github.com/ograff) made their first
contribution in
[bazelbuild/rules_rust#2674
- [@&#8203;Pagten](https://github.com/Pagten) made their first
contribution in
[bazelbuild/rules_rust#2682

**Full Changelog**:
bazelbuild/rules_rust@0.45.1...0.46.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 these
updates 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:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
fhanau added a commit to cloudflare/workerd that referenced this pull request Jun 11, 2024
With bazelbuild/rules_rust#2663 we no longer need to manually specify
the proc-macro-hack version to manage Windows path length constraints.
fhanau added a commit to cloudflare/workerd that referenced this pull request Jun 11, 2024
With bazelbuild/rules_rust#2663 we no longer need to manually specify
the proc-macro-hack version to manage Windows path length constraints.
fhanau added a commit to cloudflare/workerd that referenced this pull request Jun 11, 2024
With bazelbuild/rules_rust#2663 we no longer need to manually specify
the proc-macro-hack version to manage Windows path length constraints.
fhanau added a commit to cloudflare/workerd that referenced this pull request Jun 11, 2024
With bazelbuild/rules_rust#2663 we no longer need to manually specify
the proc-macro-hack version to manage Windows path length constraints.
fhanau added a commit to cloudflare/workerd that referenced this pull request Jun 14, 2024
With bazelbuild/rules_rust#2663 we no longer need to manually specify
the proc-macro-hack version to manage Windows path length constraints.
fhanau added a commit to cloudflare/workerd that referenced this pull request Jun 20, 2024
With bazelbuild/rules_rust#2663 we no longer need to manually specify
the proc-macro-hack version to manage Windows path length constraints.
fhanau added a commit to cloudflare/workerd that referenced this pull request Jun 25, 2024
With bazelbuild/rules_rust#2663 we no longer need to manually specify
the proc-macro-hack version to manage Windows path length constraints.
fhanau added a commit to cloudflare/workerd that referenced this pull request Jun 25, 2024
With bazelbuild/rules_rust#2663 we no longer need to manually specify
the proc-macro-hack version to manage Windows path length constraints.
ns476 pushed a commit to ns476/workerd that referenced this pull request Aug 2, 2024
With bazelbuild/rules_rust#2663 we no longer need to manually specify
the proc-macro-hack version to manage Windows path length constraints.
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.

Long path issues on Windows with bzlmod
2 participants