mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 06:34:20 +00:00
Fix dx bundle command and resources panic (#2951)
This commit is contained in:
parent
2733497038
commit
87c2f64f13
1 changed files with 14 additions and 9 deletions
|
@ -13,8 +13,9 @@ use super::*;
|
||||||
#[derive(Clone, Debug, Parser)]
|
#[derive(Clone, Debug, Parser)]
|
||||||
#[clap(name = "bundle")]
|
#[clap(name = "bundle")]
|
||||||
pub struct Bundle {
|
pub struct Bundle {
|
||||||
|
/// The package types to bundle
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub package: Option<Vec<String>>,
|
pub packages: Option<Vec<PackageType>>,
|
||||||
/// The arguments for the dioxus build
|
/// The arguments for the dioxus build
|
||||||
#[clap(flatten)]
|
#[clap(flatten)]
|
||||||
pub build_arguments: Build,
|
pub build_arguments: Build,
|
||||||
|
@ -28,7 +29,7 @@ impl Deref for Bundle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub enum PackageType {
|
pub enum PackageType {
|
||||||
MacOsBundle,
|
MacOsBundle,
|
||||||
IosBundle,
|
IosBundle,
|
||||||
|
@ -162,6 +163,15 @@ impl Bundle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drain any resources set in the config into the resources map. Tauri bundle doesn't let you set both resources and resources_map https://github.com/DioxusLabs/dioxus/issues/2941
|
||||||
|
for resource_path in bundle_settings.resources.take().into_iter().flatten() {
|
||||||
|
if let Some(resources) = &mut bundle_settings.resources_map {
|
||||||
|
resources.insert(resource_path, "".to_string());
|
||||||
|
} else {
|
||||||
|
bundle_settings.resources_map = Some([(resource_path, "".to_string())].into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut settings = SettingsBuilder::new()
|
let mut settings = SettingsBuilder::new()
|
||||||
.project_out_directory(dioxus_crate.out_dir())
|
.project_out_directory(dioxus_crate.out_dir())
|
||||||
.package_settings(PackageSettings {
|
.package_settings(PackageSettings {
|
||||||
|
@ -174,13 +184,8 @@ impl Bundle {
|
||||||
})
|
})
|
||||||
.binaries(binaries)
|
.binaries(binaries)
|
||||||
.bundle_settings(bundle_settings);
|
.bundle_settings(bundle_settings);
|
||||||
if let Some(packages) = &self.package {
|
if let Some(packages) = &self.packages {
|
||||||
settings = settings.package_types(
|
settings = settings.package_types(packages.iter().map(|p| (*p).into()).collect());
|
||||||
packages
|
|
||||||
.iter()
|
|
||||||
.map(|p| p.parse::<PackageType>().unwrap().into())
|
|
||||||
.collect(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(target) = &self.target_args.target {
|
if let Some(target) = &self.target_args.target {
|
||||||
|
|
Loading…
Reference in a new issue