Generate WIT, not Rust source code
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- rust, wasm
- Ambito
- build-system, cli, developer-experience
Direzione di ricerca
Inizia individuando l’implementazione e il template utilizzati da cargo component new, quindi confronta il modo in cui vengono attualmente gestiti src/bindings.rs, src/bindings.wit e Cargo.toml. Definisci la migrazione incentrandola sulla gestione di WIT e sull’invocazione di wit_bindgen::generate!; la migrazione è completata quando il progetto generato segue questo modello senza che cargo-component generi autonomamente i binding Rust.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 593
- Fork
- 68
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bytecodealliance/cargo-component
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 38/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
bytecodealliance/cargo-component#399 · 2 commenti ·
Tutte le issue di bytecodealliance/cargo-component
Issue simili
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
lbjlaq/Antigravity-Manager#4180 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: `unpinned-uses` reports a 64-character commit pin from a SHA-256 repository as unpinnedApertabug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
zizmorcore/zizmor#2608 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
RecompLauncher supportAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
longbridge/nsh#4201 ·
I maintainer di solito rispondono entro 1 giorno