fix(bundler) do not require [package.metadata.bundle] for tauri… (#492)

This commit is contained in:
Lucas Fernandes Nogueira 2020-03-07 09:43:57 -03:00 committed by GitHub
parent 6ef2b16796
commit 493f1ea0c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,7 +90,7 @@ pub enum BuildArtifact {
Example(String),
}
#[derive(Clone, Debug, Deserialize)]
#[derive(Clone, Debug, Deserialize, Default)]
struct BundleSettings {
// General settings:
name: Option<String>,
@ -200,6 +200,8 @@ impl Settings {
None
};
let cargo_settings = CargoSettings::load(&current_dir)?;
let tauri_config = super::tauri_config::get();
let package = match cargo_settings.package {
Some(package_info) => package_info,
None => bail!("No 'package' info found in 'Cargo.toml'"),
@ -213,7 +215,11 @@ impl Settings {
{
bundle_settings.clone()
} else {
bail!("No [package.metadata.bundle] section in Cargo.toml");
if let Ok(_) = tauri_config {
BundleSettings::default()
} else {
bail!("No [package.metadata.bundle] section in Cargo.toml");
}
};
let (bundle_settings, binary_name) = match build_artifact {
BuildArtifact::Main => (bundle_settings, package.name.clone()),
@ -235,7 +241,6 @@ impl Settings {
let bundle_settings = add_external_bin(bundle_settings)?;
let tauri_config = super::tauri_config::get();
let merged_bundle_settings = match tauri_config {
Ok(config) => merge_settings(bundle_settings, config.tauri.bundle),
Err(_) => bundle_settings,