Rust codegen: @snap_client_toolchains//:compilation_mode_opt is missing in internal monorepo builds, breaking valdi_core_rust_cc analysis

Đang mở Phù hợp với người mới
#233 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 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
77/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, rust
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu tại valdi_core/BUILD.bazel, ở select defines của valdi_core_rust_cc, sau đó so sánh các mẫu @snap_client_toolchains trong client/bzl/toolchains/BUILD.sc_build_flags.tpl và BUILD.flags.tpl với stub độc lập bzl/toolchains/BUILD.bazel. Cung cấp thiết lập cấu hình này trong các bản build nội bộ và xác nhận rằng phân tích Bazel thành công ở đó cho //valdi_core:valdi_core_rust_cc.

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

Mô tả

Found while reviewing https://github.com/Snapchat/Valdi/pull/211 (native Rust code generation). Not blocking that PR.

@snap_client_toolchains//:compilation_mode_opt is missing in internal monorepo builds, breaking valdi_core_rust_cc analysis

File: valdi_core/BUILD.bazel

Configuring //valdi_core:valdi_core_rust_cc (or any target that depends on it, such as //valdi:test_integration or a valdi_module with native_language = "rust") in an internal monorepo workspace (client, android, phantom, banshee) fails Bazel analysis because @snap_client_toolchains//:compilation_mode_opt does not exist there. The defines select(...) on valdi_core_rust_cc references @snap_client_toolchains//:compilation_mode_opt.

Internal builds generate @snap_client_toolchains via setup_snap_cxx_toolchains in client/bzl/toolchains/setup.bzl using templates such as client/bzl/toolchains/BUILD.sc_build_flags.tpl and client/bzl/toolchains/BUILD.flags.tpl, none of which declare :compilation_mode_opt (it only exists in the standalone stub bzl/toolchains/BUILD.bazel). Because Bazel evaluates select keys during analysis in every workspace, referencing a label absent from the generated repo breaks target analysis on internal builds.

Define a local config_setting(name = "compilation_mode_opt", values = {"compilation_mode": "opt"}) in valdi_core/BUILD.bazel and select on ":compilation_mode_opt" (or use @snap_client_toolchains//:sc_build_flag_assert, which both toolchains define).

Ngôn ngữ chính
C++
Star
16.4k
Fork
539
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 Snapchat/Valdi

Tất cả issue của Snapchat/Valdi

Issue tương tự

Thêm issue về C++

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.