From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- third_party/rust/uniffi/src/cli.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'third_party/rust/uniffi/src/cli.rs') diff --git a/third_party/rust/uniffi/src/cli.rs b/third_party/rust/uniffi/src/cli.rs index b2d3adc2ae..77d7f219a9 100644 --- a/third_party/rust/uniffi/src/cli.rs +++ b/third_party/rust/uniffi/src/cli.rs @@ -5,6 +5,7 @@ use camino::Utf8PathBuf; use clap::{Parser, Subcommand}; use uniffi_bindgen::bindings::TargetLanguage; +use uniffi_bindgen::BindingGeneratorDefault; // Structs to help our cmdline parsing. Note that docstrings below form part // of the "help" output. @@ -35,7 +36,7 @@ enum Commands { #[clap(long, short)] no_format: bool, - /// Path to the optional uniffi config file. If not provided, uniffi-bindgen will try to guess it from the UDL's file location. + /// Path to optional uniffi config file. This config is merged with the `uniffi.toml` config present in each crate, with its values taking precedence. #[clap(long, short)] config: Option, @@ -95,21 +96,29 @@ pub fn run_main() -> anyhow::Result<()> { if lib_file.is_some() { panic!("--lib-file is not compatible with --library.") } - if config.is_some() { - panic!("--config is not compatible with --library. The config file(s) will be found automatically.") - } let out_dir = out_dir.expect("--out-dir is required when using --library"); if language.is_empty() { panic!("please specify at least one language with --language") } uniffi_bindgen::library_mode::generate_bindings( - &source, crate_name, &language, &out_dir, !no_format, + &source, + crate_name, + &BindingGeneratorDefault { + target_languages: language, + try_format_code: !no_format, + }, + config.as_deref(), + &out_dir, + !no_format, )?; } else { uniffi_bindgen::generate_bindings( &source, config.as_deref(), - language, + BindingGeneratorDefault { + target_languages: language, + try_format_code: !no_format, + }, out_dir.as_deref(), lib_file.as_deref(), crate_name.as_deref(), -- cgit v1.2.3