mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
refactor(cli): reorder a few parameters (#14792)
This commit is contained in:
@@ -104,7 +104,7 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> {
|
||||
|
||||
let mut interface = AppInterface::new(&config, options.target.clone(), dirs.tauri)?;
|
||||
|
||||
setup(&interface, &mut options, &config, false, &dirs)?;
|
||||
setup(&interface, &mut options, &config, &dirs, false)?;
|
||||
|
||||
if let Some(minimum_system_version) = &config.bundle.macos.minimum_system_version {
|
||||
std::env::set_var("MACOSX_DEPLOYMENT_TARGET", minimum_system_version);
|
||||
@@ -129,8 +129,8 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> {
|
||||
&interface,
|
||||
&*app_settings,
|
||||
&config,
|
||||
&out_dir,
|
||||
&dirs,
|
||||
&out_dir,
|
||||
)?;
|
||||
}
|
||||
|
||||
@@ -141,8 +141,8 @@ pub fn setup(
|
||||
interface: &AppInterface,
|
||||
options: &mut Options,
|
||||
config: &ConfigMetadata,
|
||||
mobile: bool,
|
||||
dirs: &Dirs,
|
||||
mobile: bool,
|
||||
) -> Result<()> {
|
||||
// TODO: Maybe optimize this to run in parallel in the future
|
||||
// see https://github.com/tauri-apps/tauri/pull/13993#discussion_r2280697117
|
||||
|
||||
@@ -154,8 +154,8 @@ pub fn command(options: Options, verbosity: u8) -> crate::Result<()> {
|
||||
&interface,
|
||||
&*app_settings,
|
||||
&config,
|
||||
&out_dir,
|
||||
&dirs,
|
||||
&out_dir,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -167,8 +167,8 @@ pub fn bundle<A: AppSettings>(
|
||||
interface: &AppInterface,
|
||||
app_settings: &A,
|
||||
config: &ConfigMetadata,
|
||||
out_dir: &Path,
|
||||
dirs: &Dirs,
|
||||
out_dir: &Path,
|
||||
) -> crate::Result<()> {
|
||||
let package_types: Vec<PackageType> = if let Some(bundles) = &options.bundles {
|
||||
bundles.iter().map(|bundle| bundle.0).collect::<Vec<_>>()
|
||||
|
||||
@@ -55,8 +55,7 @@ impl ConfigMetadata {
|
||||
for (ext, config) in &self.extensions {
|
||||
if let Some(identifier) = config
|
||||
.as_object()
|
||||
.and_then(|bundle_config| bundle_config.get("identifier"))
|
||||
.and_then(|id| id.as_str())
|
||||
.and_then(|bundle_config| bundle_config.get("identifier")?.as_str())
|
||||
{
|
||||
if identifier == self.inner.identifier {
|
||||
return Some(ext.clone());
|
||||
@@ -163,8 +162,7 @@ fn load_config(
|
||||
|
||||
let original_identifier = config
|
||||
.as_object()
|
||||
.and_then(|config| config.get("identifier"))
|
||||
.and_then(|id| id.as_str())
|
||||
.and_then(|config| config.get("identifier")?.as_str())
|
||||
.map(ToString::to_string);
|
||||
|
||||
if let Some((platform_config, config_path)) =
|
||||
|
||||
@@ -351,10 +351,7 @@ mod tests {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if let Some(f) = item_table
|
||||
.and_then(|t| t.get("features").cloned())
|
||||
.and_then(|f| f.as_array().cloned())
|
||||
{
|
||||
if let Some(f) = item_table.and_then(|t| t.get("features")?.as_array().cloned()) {
|
||||
for feature in f.iter() {
|
||||
let feature = feature.as_str().expect("feature is not a string");
|
||||
if !dep.all_cli_managed_features.contains(&feature) {
|
||||
|
||||
@@ -188,7 +188,7 @@ pub fn run(
|
||||
|
||||
generate_tauri_properties(&config, tauri_config, false)?;
|
||||
|
||||
crate::build::setup(&interface, &mut build_options, tauri_config, true, dirs)?;
|
||||
crate::build::setup(&interface, &mut build_options, tauri_config, dirs, true)?;
|
||||
|
||||
let installed_targets =
|
||||
crate::interface::rust::installation::installed_targets().unwrap_or_default();
|
||||
|
||||
@@ -357,7 +357,7 @@ fn run_build(
|
||||
Profile::Release
|
||||
};
|
||||
|
||||
crate::build::setup(interface, &mut build_options, &tauri_config, true, dirs)?;
|
||||
crate::build::setup(interface, &mut build_options, &tauri_config, dirs, true)?;
|
||||
|
||||
let app_settings = interface.app_settings();
|
||||
let out_dir = app_settings.out_dir(
|
||||
|
||||
Reference in New Issue
Block a user