Skip to content

Commit 63f088e

Browse files
feat(cli): add --release for android dev (#6638)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio> closes #6594
1 parent d03e47d commit 63f088e

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'cli.rs': 'patch'
3+
'cli.js': 'patch'
4+
---
5+
6+
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

tooling/cli/src/mobile/android/dev.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ pub struct Options {
6868
/// Force prompting for an IP to use to connect to the dev server on mobile.
6969
#[clap(long)]
7070
pub force_ip_prompt: bool,
71+
/// Run the code in release mode
72+
#[clap(long = "release")]
73+
pub release_mode: bool,
7174
}
7275

7376
impl From<Options> for DevOptions {
@@ -78,12 +81,12 @@ impl From<Options> for DevOptions {
7881
features: options.features,
7982
exit_on_panic: options.exit_on_panic,
8083
config: options.config,
81-
release_mode: false,
8284
args: Vec::new(),
8385
no_watch: options.no_watch,
8486
no_dev_server: options.no_dev_server,
8587
port: options.port,
8688
force_ip_prompt: options.force_ip_prompt,
89+
release_mode: options.release_mode,
8790
}
8891
}
8992
}
@@ -152,14 +155,25 @@ fn run_dev(
152155
.values()
153156
.find(|t| t.triple == target_triple)
154157
.unwrap_or_else(|| Target::all().values().next().unwrap());
155-
target.build(config, metadata, &env, noise_level, true, Profile::Debug)?;
158+
target.build(
159+
config,
160+
metadata,
161+
&env,
162+
noise_level,
163+
true,
164+
if options.release_mode {
165+
Profile::Release
166+
} else {
167+
Profile::Debug
168+
},
169+
)?;
156170

157171
let open = options.open;
158172
let exit_on_panic = options.exit_on_panic;
159173
let no_watch = options.no_watch;
160174
interface.mobile_dev(
161175
MobileOptions {
162-
debug: true,
176+
debug: !options.release_mode,
163177
features: options.features,
164178
args: Vec::new(),
165179
config: options.config,

tooling/cli/src/mobile/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,7 @@ fn ensure_init(project_dir: PathBuf, target: Target) -> Result<()> {
316316
target.command_name(),
317317
)
318318
} else {
319-
#[allow(irrefutable_let_patterns)]
320-
if let Target::Android = target {
319+
if target == Target::Android {
321320
create_dir_all(project_dir.join(".tauri").join("plugins"))?;
322321
}
323322
Ok(())

0 commit comments

Comments
 (0)