Generate WIT, not Rust source code
Chưa có ai nhận issue này.
Đá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
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- rust, wasm
- Lĩnh vực
- build-system, cli, developer-experience
Hướng nghiên cứu
Bắt đầu bằng cách xác định phần triển khai và template được cargo component new sử dụng, sau đó so sánh cách src/bindings.rs, src/bindings.wit và Cargo.toml hiện đang được xử lý. Xác định quá trình di chuyển xoay quanh việc quản lý WIT và gọi wit_bindgen::generate!; hoàn tất có nghĩa là dự án được tạo tuân theo mô hình đó mà không để cargo-component tự tạo các Rust bindings.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Currently, to the best of my knowledge, cargo component generates a src/bindings.rs file using a version of wit-bindgen baked directly into the executable cargo-component itself. Running cargo component new generates a project that depends on wit-bindgen-rt at a matching version of what cargo-component has baked in to itself.
This is problematic to the development of wit-bindgen, unfortunately, because the generated code using wit-bindgen 0.A.0 generally requires wit-bindgen-rt 0.A.0 as well, and you can't mix and match versions. Mismatched versions can arise relatively easily with cargo-component in two situations:
- An older project might update to using a newer
cargo-componentexecutable, meaning that theCargo.tomldepends on an olderwit-bindgen-rtwhile the executable generates bindings with a newerwit-bindgenversion. - An older project might update
wit-bindgen-rtbut fail to updatecargo-component, producing the inverse problem where an olderwit-bindgenis used with a newerwit-bindgen-rt.
This is coming up as I'm doing refactoring in wit-bindgen and shuffling things around, and ideally I'd prefer to not break cargo component users because at this time if anything is added to wit-bindgen-rt then users will break.
As an alternative, what I might recommend is to instead have cargo component manage WIT, not generated source code. The basic idea is that cargo component would generate-and-manage src/bindings.wit instead of src/bindings.rs. The template for cargo component new would add a dependency on wit-bindgen but critically wouldn't actually generate any code. For example the generated file might look like:
wit_bindgen::generate!("./src/bindings.wit");
fn main() {
println!("hello!");
}
This should be more idiomatic in terms of wit-bindgen usage where it's "just" a call to the generate! macro with various options. The key difference is that the input *.wit is completely managed by cargo component and handles things like dependencies and such which wit-bindgen otherwise doesn't do.
My hope is that this wouldn't break things like IDE integration workflows as they in theory already need to work with procedural macros. The upside though is that the cargo component executable wouldn't even need to depend on wit-bindgen itself because it doesn't generate any Rust code. Instead it only generates a reference to wit-bindgen and then a macro invocation. The WIT management all remains in cargo component, however.
This would additionally solve the problem of updating/changing wit-bindgen as, after inception, it's a per-project decision of when to update wit-bindgen which is orthogonal from using cargo component as a build tool.
- Ngôn ngữ chính
- Rust
- Star
- 593
- Fork
- 68
- 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
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bytecodealliance/cargo-component
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Cargo Component WASI InterfacesĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
bytecodealliance/cargo-component#399 · 2 bình luận ·
Tất cả issue của bytecodealliance/cargo-component
Issue tương tự
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
lbjlaq/Antigravity-Manager#4180 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG]: `unpinned-uses` reports a 64-character commit pin from a SHA-256 repository as unpinnedĐang mởbug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zizmorcore/zizmor#2608 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RecompLauncher supportĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
longbridge/nsh#4201 ·
Maintainer thường phản hồi trong vòng 1 ngày