feat(cli): improve error message when lib is not found, closes #5867 (#5933)

This commit is contained in:
Lucas Fernandes Nogueira 2022-12-28 10:02:07 -08:00 committed by GitHub
parent e873bae09f
commit 17d80ab236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -3908,9 +3908,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-mobile" name = "tauri-mobile"
version = "0.1.3" version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "749adb9f2c4844357bbc9ee4566ef5fe9755dc0956d6ba005180add824d835ac" checksum = "dff04e700514e294069c697559b74f2cc168e8d6c984e2e4ba99a40d63468061"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"colored 1.9.3", "colored 1.9.3",

View File

@ -39,7 +39,7 @@ name = "cargo-tauri"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
tauri-mobile = { version = "0.1.3", default-features = false } tauri-mobile = { version = "0.1.4", default-features = false }
textwrap = { version = "0.11.0", features = [ "term_size" ] } textwrap = { version = "0.11.0", features = [ "term_size" ] }
jsonrpsee = { version = "0.16", features = [ "client", "server" ] } jsonrpsee = { version = "0.16", features = [ "client", "server" ] }
thiserror = "1" thiserror = "1"

View File

@ -188,12 +188,16 @@ pub fn command(options: Options) -> Result<()> {
})?; })?;
let out_dir = bin_path.parent().unwrap(); let out_dir = bin_path.parent().unwrap();
let lib_path = out_dir.join(format!("lib{}.a", AsSnakeCase(config.app().name())));
if !lib_path.exists() {
return Err(anyhow::anyhow!("Library not found at {}. Make sure your Cargo.toml file has a [lib] block with `crate-type = [\"staticlib\", \"cdylib\", \"rlib\"]`", lib_path.display()));
}
std::fs::create_dir_all(format!( std::fs::create_dir_all(format!(
"gen/apple/Externals/{rust_triple}/{}", "gen/apple/Externals/{rust_triple}/{}",
profile.as_str() profile.as_str()
))?; ))?;
std::fs::copy( std::fs::copy(
out_dir.join(format!("lib{}.a", AsSnakeCase(config.app().name()))), lib_path,
format!( format!(
"gen/apple/Externals/{rust_triple}/{}/lib{}.a", "gen/apple/Externals/{rust_triple}/{}/lib{}.a",
profile.as_str(), profile.as_str(),