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 creates BUILD files with some CRLF under Windows #3197

Open
hauserx opened this issue Jan 22, 2025 · 1 comment
Open

Crate universe creates BUILD files with some CRLF under Windows #3197

hauserx opened this issue Jan 22, 2025 · 1 comment

Comments

@hauserx
Copy link
Contributor

hauserx commented Jan 22, 2025

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.

    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 --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
@hauserx
Copy link
Contributor Author

hauserx commented Jan 22, 2025

I guess when checking out repository under windows files like

crate_universe/src/rendering/templates/partials/header.j2

are having CRLFs and then BUILD files have mix of CRLF and LF because template engine uses just LFs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants