mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
feat(cli): add --release for android dev (#6638)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio> closes #6594
This commit is contained in:
6
.changes/cli-android-dev-release.md
Normal file
6
.changes/cli-android-dev-release.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'cli.rs': 'patch'
|
||||
'cli.js': 'patch'
|
||||
---
|
||||
|
||||
Add `--release` flag for `tauri android dev` however you will need to sign your Android app, see https://next--tauri.netlify.app/next/guides/distribution/sign-android
|
||||
@@ -68,6 +68,9 @@ pub struct Options {
|
||||
/// Force prompting for an IP to use to connect to the dev server on mobile.
|
||||
#[clap(long)]
|
||||
pub force_ip_prompt: bool,
|
||||
/// Run the code in release mode
|
||||
#[clap(long = "release")]
|
||||
pub release_mode: bool,
|
||||
}
|
||||
|
||||
impl From<Options> for DevOptions {
|
||||
@@ -78,12 +81,12 @@ impl From<Options> for DevOptions {
|
||||
features: options.features,
|
||||
exit_on_panic: options.exit_on_panic,
|
||||
config: options.config,
|
||||
release_mode: false,
|
||||
args: Vec::new(),
|
||||
no_watch: options.no_watch,
|
||||
no_dev_server: options.no_dev_server,
|
||||
port: options.port,
|
||||
force_ip_prompt: options.force_ip_prompt,
|
||||
release_mode: options.release_mode,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,14 +155,25 @@ fn run_dev(
|
||||
.values()
|
||||
.find(|t| t.triple == target_triple)
|
||||
.unwrap_or_else(|| Target::all().values().next().unwrap());
|
||||
target.build(config, metadata, &env, noise_level, true, Profile::Debug)?;
|
||||
target.build(
|
||||
config,
|
||||
metadata,
|
||||
&env,
|
||||
noise_level,
|
||||
true,
|
||||
if options.release_mode {
|
||||
Profile::Release
|
||||
} else {
|
||||
Profile::Debug
|
||||
},
|
||||
)?;
|
||||
|
||||
let open = options.open;
|
||||
let exit_on_panic = options.exit_on_panic;
|
||||
let no_watch = options.no_watch;
|
||||
interface.mobile_dev(
|
||||
MobileOptions {
|
||||
debug: true,
|
||||
debug: !options.release_mode,
|
||||
features: options.features,
|
||||
args: Vec::new(),
|
||||
config: options.config,
|
||||
|
||||
@@ -316,8 +316,7 @@ fn ensure_init(project_dir: PathBuf, target: Target) -> Result<()> {
|
||||
target.command_name(),
|
||||
)
|
||||
} else {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let Target::Android = target {
|
||||
if target == Target::Android {
|
||||
create_dir_all(project_dir.join(".tauri").join("plugins"))?;
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user