Configurable `rules_rust`

Đang mở
#4,049 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

@mansiverma897993 đang làm issue này rồi.

Từ ngày 16/6/2026.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Bắt đầu bằng cách đọc rustc.bzl, đặc biệt là các khối args.add được hardcode, cùng với các thiết lập build và transitions hiện có. Xác định cách các cờ của compiler và linker, các giai đoạn con của quá trình biên dịch, các action tùy chỉnh và tên artifact hiện đang được liên kết với rule. Công việc được coi là hoàn tất khi hỗ trợ được việc tùy chỉnh khai báo ở cấp toolchain theo yêu cầu mà không cần fork rule, với độ bao phủ cho các loại action và các trường hợp đặt tên platform được liệt kê.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

core

Configuring compiler and linker flags in rules_rust currently relies heavily on imperative Starlark code (such as hardcoded args.add blocks inside the rule implementation) and bespoke build settings/transitions. Because flag-building is tightly coupled with the rule logic, consumers face high friction when adapting toolchain configurations to custom environments.

To resolve these customization barriers, compile and link flags should be decoupled from the core rule implementation and exposed as declarative configurations at the toolchain level.

  • Enable declarative wrappers and flags without maintaining rule forks: Users should be able to inject custom compiler/linker wrappers, extra flag configurations, or alternative platform sanitizers declaratively at the toolchain level. This enables setting flags for project-specific workflows rather than adding more build settings directly to rules_rust, eliminating the need to carry custom patches or fork core rules (like rustc.bzl) and greatly simplifying upstream version upgrades.
  • Support granular flag controls and custom compilation actions: The system should expose specific compilation sub-phases so that consumers can apply flags selectively based on the action type - such as targeting metadata-only builds (.rmeta), clippy checkout runs, etc. It should also enable support for spawning different types of compilation actions, such as emitting LLVM IR (--emit=llvm-ir) or LLVM bitcode (--emit=llvm-bc), based on user demands.
  • Provide configurable and overridable artifact naming: Hardcoded platform-specific name mappings (like .rlib to .a static library symlinks or MSVC .dll vs. .dll.lib import conventions) should be decoupled and made configurable, making it easy to support custom platform layouts and exotic execution environments.
Ngôn ngữ chính
Starlark
Star
857
Fork
701
Merge trung bình
4 ngày 7 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bazelbuild/rules_rust

Tất cả issue của bazelbuild/rules_rust

Issue tương tự

Thêm issue về Build System

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.