diff --git a/Cargo.lock b/Cargo.lock index 1d27cce..4377156 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -698,9 +698,9 @@ checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "uniffi_bindgen" -version = "0.24.3" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f91fdcd44de3aab35847bf80485f412879dcdd92b5140ee67f948e5eed750e" +checksum = "6fb3dfb794733803cdfeff4c09cb4e2bcecb91df6928343a18c8ee679a5772a4" dependencies = [ "anyhow", "askama", @@ -713,18 +713,17 @@ dependencies = [ "once_cell", "paste", "serde", - "serde_json", "toml", "uniffi_meta", "uniffi_testing", - "weedle2", + "uniffi_udl", ] [[package]] name = "uniffi_checksum_derive" -version = "0.24.3" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1b354a9bd654cc6547d461ccd60a10eb6c7473178f12d8ff91cf4340ae947e8" +checksum = "819bd46e5afff09738fbd493e58c26dca0b38bca8f206ffc9a7bc2dfd7e1c11d" dependencies = [ "quote", "syn", @@ -732,30 +731,39 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.24.3" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f815bba89a6585954c089c53a775d166c0334c907be0e462bf0f0ac0494656e7" +checksum = "3dc021ae8f8c12f69022f1502537687df59045e1c16f5d1eafdb657ecdb7cdf1" dependencies = [ "anyhow", "bytes", - "serde", "siphasher", "uniffi_checksum_derive", ] [[package]] name = "uniffi_testing" -version = "0.24.3" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1048d7c54816dc27ed4041fe952d42c7cb88e711cf3299e36ee70df7692c4a39" +checksum = "40fe383aca04dfbdf6a5039a9e76bb21ebb13e03e38cf1459f17c62eedee7b6c" dependencies = [ "anyhow", "camino", "cargo_metadata 0.15.4", "fs-err", "once_cell", - "serde", - "serde_json", +] + +[[package]] +name = "uniffi_udl" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6040dd1410fcb1a2795ef426f698107c12e295cc11e44a2b040934f786a35d82" +dependencies = [ + "anyhow", + "uniffi_meta", + "uniffi_testing", + "weedle2", ] [[package]] diff --git a/src/commands/init.rs b/src/commands/init.rs index eb968d2..0190150 100644 --- a/src/commands/init.rs +++ b/src/commands/init.rs @@ -61,20 +61,14 @@ fn create_project( lib_type: lib_type.identifier(), macro_only, }; - let lib_rs_content = templating::LibRs { - plain, - namespace: &namespace, - macro_only, - }; + let lib_rs_content = templating::LibRs { plain, macro_only }; let (udl_content, build_rs_content) = if !macro_only { ( Some(templating::LibUdl { namespace: &namespace, plain, }), - Some(templating::BuildRs { - namespace: &namespace, - }), + Some(templating::BuildRs {}), ) } else { (None, None) @@ -86,7 +80,6 @@ fn create_project( lib_rs_content, udl_content, crate_name, - &namespace, )?; Ok(()) @@ -98,7 +91,6 @@ fn write_project_files( lib_rs: templating::LibRs, lib_udl: Option, crate_name: &str, - namespace: &str, ) -> Result<()> { create_dir(crate_name).map_err(|_| "Could not create directory for crate!")?; @@ -125,7 +117,7 @@ fn write_project_files( if let Some(lib_udl) = lib_udl { write( - format!("{}/src/{}.udl", crate_name, namespace), + format!("{}/src/lib.udl", crate_name), lib_udl.render().unwrap(), ) .map_err(|_| "Could not write src/lib.udl!")?; diff --git a/src/templating.rs b/src/templating.rs index 837b948..2472500 100644 --- a/src/templating.rs +++ b/src/templating.rs @@ -12,14 +12,11 @@ pub(crate) struct CargoToml<'a> { #[derive(Template)] #[template(path = "build.rs", escape = "none")] -pub(crate) struct BuildRs<'a> { - pub(crate) namespace: &'a str, -} +pub(crate) struct BuildRs {} #[derive(Template)] #[template(path = "lib.rs", escape = "none")] -pub(crate) struct LibRs<'a> { - pub(crate) namespace: &'a str, +pub(crate) struct LibRs { pub(crate) plain: bool, pub(crate) macro_only: bool, } diff --git a/templates/build.rs b/templates/build.rs index 6c9e97d..145281c 100644 --- a/templates/build.rs +++ b/templates/build.rs @@ -1,3 +1,3 @@ fn main() { - uniffi::generate_scaffolding("./src/{{ namespace }}.udl").unwrap(); + uniffi::generate_scaffolding("./src/lib.udl").unwrap(); } diff --git a/templates/lib.rs b/templates/lib.rs index b0ea288..5c46ebe 100644 --- a/templates/lib.rs +++ b/templates/lib.rs @@ -1,7 +1,7 @@ {% if macro_only %} uniffi::setup_scaffolding!(); {% else %} -uniffi::include_scaffolding!("{{ namespace }}"); +uniffi::include_scaffolding!("lib"); {%- endif %} {% if !plain %}