Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ anyhow = "1.0.87"
clap = { version = "4.5.17", features = ["derive"] }
dialoguer = "0.11.0"
reqwest = "0.12.7"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
sha2 = "0.10.8"
spin-manifest = { git = "https://github.com/fermyon/spin" }
spin-serde = { git = "https://github.com/fermyon/spin" }
Expand Down
15 changes: 15 additions & 0 deletions src/commands/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ pub enum BindingsLanguage {

#[derive(Args, Debug)]
pub struct GenerateBindingsCommand {
/// The programming language to generate bindings in
#[clap(short = 'L', long)]
pub language: BindingsLanguage,

/// Output directory
#[clap(short = 'o', long)]
pub output: PathBuf,

/// Id of the component, which dependencies to generate the bindings for
#[clap(short = 'c', long)]
pub component_id: String,
}
Expand All @@ -40,8 +45,18 @@ impl GenerateBindingsCommand {

match &self.language {
BindingsLanguage::Rust => {
// TODO: If wit-bindgen is not in Cargo.toml, make sure to add it.
let opts = wit_bindgen_rust::Opts {
generate_all: true,
// TODO: Make the extra attributes a clap option
additional_derive_attributes: vec![
"serde::Serialize".to_string(),
"serde::Deserialize".to_string(),
"Hash".to_string(),
"Clone".to_string(),
"PartialEq".to_string(),
"Eq".to_string(),
],
// Uncomment this once spin-sdk is updated and remove dependency on wit_bindgen in Cargo.toml
//runtime_path: Some("::spin_sdk::wit_bindgen".to_string()),
..Default::default()
Expand Down
Loading