Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/mobile-args.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-cli": "minor:feat"
"@tauri-apps/cli": "minor:feat"
---

Allow passing Cargo arguments to mobile dev and build commands.
8 changes: 7 additions & 1 deletion crates/tauri-cli/src/mobile/android/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ pub struct Options {
/// Skip prompting for values
#[clap(long, env = "CI")]
pub ci: bool,
/// Command line arguments passed to the runner.
/// Use `--` to explicitly mark the start of the arguments.
/// e.g. `tauri android build -- [runnerArgs]`.
#[clap(last(true))]
pub args: Vec<String>,
}

impl From<Options> for BuildOptions {
Expand All @@ -85,7 +90,7 @@ impl From<Options> for BuildOptions {
bundles: None,
no_bundle: false,
config: options.config,
args: Vec::new(),
args: options.args,
ci: options.ci,
}
}
Expand Down Expand Up @@ -197,6 +202,7 @@ fn run_build(
let interface_options = InterfaceOptions {
debug: build_options.debug,
target: build_options.target.clone(),
args: build_options.args.clone(),
..Default::default()
};

Expand Down
9 changes: 7 additions & 2 deletions crates/tauri-cli/src/mobile/android/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ pub struct Options {
/// Specify port for the built-in dev server for static files. Defaults to 1430.
#[clap(long, env = "TAURI_CLI_PORT")]
pub port: Option<u16>,
/// Command line arguments passed to the runner.
/// Use `--` to explicitly mark the start of the arguments.
/// e.g. `tauri android dev -- [runnerArgs]`.
#[clap(last(true))]
pub args: Vec<String>,
}

impl From<Options> for DevOptions {
Expand All @@ -106,7 +111,7 @@ impl From<Options> for DevOptions {
features: options.features,
exit_on_panic: options.exit_on_panic,
config: options.config,
args: Vec::new(),
args: options.args,
no_watch: options.no_watch,
no_dev_server_wait: options.no_dev_server_wait,
no_dev_server: options.no_dev_server,
Expand Down Expand Up @@ -257,7 +262,7 @@ fn run_dev(
MobileOptions {
debug: !options.release_mode,
features: options.features,
args: Vec::new(),
args: options.args,
config: dev_options.config.clone(),
no_watch: options.no_watch,
},
Expand Down
8 changes: 7 additions & 1 deletion crates/tauri-cli/src/mobile/ios/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ pub struct Options {
/// Use this to create a package ready for the App Store (app-store-connect option) or TestFlight (release-testing option).
#[clap(long, value_enum)]
pub export_method: Option<ExportMethod>,
/// Command line arguments passed to the runner.
/// Use `--` to explicitly mark the start of the arguments.
/// e.g. `tauri ios build -- [runnerArgs]`.
#[clap(last(true))]
pub args: Vec<String>,
}

#[derive(Debug, Clone, Copy, ValueEnum)]
Expand Down Expand Up @@ -125,7 +130,7 @@ impl From<Options> for BuildOptions {
bundles: None,
no_bundle: false,
config: options.config,
args: Vec::new(),
args: options.args,
ci: options.ci,
}
}
Expand Down Expand Up @@ -282,6 +287,7 @@ fn run_build(
let out_dir = app_settings.out_dir(&InterfaceOptions {
debug: build_options.debug,
target: build_options.target.clone(),
args: build_options.args.clone(),
..Default::default()
})?;
let _lock = flock::open_rw(out_dir.join("lock").with_extension("ios"), "iOS")?;
Expand Down
9 changes: 7 additions & 2 deletions crates/tauri-cli/src/mobile/ios/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ pub struct Options {
/// Specify port for the built-in dev server for static files. Defaults to 1430.
#[clap(long, env = "TAURI_CLI_PORT")]
pub port: Option<u16>,
/// Command line arguments passed to the runner.
/// Use `--` to explicitly mark the start of the arguments.
/// e.g. `tauri ios dev -- [runnerArgs]`.
#[clap(last(true))]
pub args: Vec<String>,
}

impl From<Options> for DevOptions {
Expand All @@ -112,7 +117,7 @@ impl From<Options> for DevOptions {
exit_on_panic: options.exit_on_panic,
config: options.config,
release_mode: options.release_mode,
args: Vec::new(),
args: options.args,
no_watch: options.no_watch,
no_dev_server: options.no_dev_server,
no_dev_server_wait: options.no_dev_server_wait,
Expand Down Expand Up @@ -265,7 +270,7 @@ fn run_dev(
MobileOptions {
debug: true,
features: options.features,
args: Vec::new(),
args: options.args,
config: dev_options.config.clone(),
no_watch: options.no_watch,
},
Expand Down
Loading