bazelbuild / bazelbuild/rules_rust

Crate universe creates BUILD files with some CRLF under Windows

Open
#3,197 1 comment 0 reactions 0 assignees View on GitHub
bug crate-universe needs-triage windows
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

Those BUILD files end up in `MODULE.bazel.lock` in `generatedRepoSpecs` so that those lock files cannot be easily compared or updated under Windows.

Example from `external/rules_rust~~crate~crates/BUILD.bazel`, note that some lines end up with ^M but some do not.

```starlark
1 ###############################################################################^M
2 # @generated^M
3 # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To ^M
4 # regenerate this file, run the following:^M
5 #^M
6 # bazel mod show_repo 'all_crate_deps_bzlmod_example'^M
7 ###############################################################################
8
9 package(default_visibility = ["//visibility:public"])
10
11 exports_files(
```

To reproduce on current HEAD:
- Go to rules_rust/examples/all_crate_deps
- Remove `MODULE.bazel.lock`
- Change MODULE.bazel to use released version of rules_rust instead of dev
**NOTE**: The issue does not show up when using local_path_override

Diff

```diff
diff --git a/examples/all_crate_deps/MODULE.bazel b/examples/all_crate_deps/MODULE.bazel
index 298ce264..9a78d4ae 100644
--- a/examples/all_crate_deps/MODULE.bazel
+++ b/examples/all_crate_deps/MODULE.bazel
@@ -16,11 +16,7 @@ bazel_dep(
)
bazel_dep(
name = "rules_rust",
- version = "0.0.0",
-)
-local_path_override(
- module_name = "rules_rust",
- path = "../..",
+ version = "0.57.0",
)
```

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")

- Build: `bazel.exe build :all_crate_deps`
- Check `bazel-all_crate_deps/external/rules_rust~~crate~crates/BUILD.bazel`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.