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/fix-android-bundle-flag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---

Fix `android build`'s `--aab` and `--apk` flags requiring a value to be provided.
16 changes: 9 additions & 7 deletions crates/tauri-cli/src/mobile/android/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ pub struct Options {
pub split_per_abi: bool,
/// Build APKs.
#[clap(long)]
pub apk: Option<bool>,
pub apk: bool,
/// Build AABs.
#[clap(long)]
pub aab: Option<bool>,
pub aab: bool,
#[clap(skip)]
pub skip_bundle: bool,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's its purpose?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gonna merge but would still love to hear about this

/// Open Android Studio
#[clap(short, long)]
pub open: bool,
Expand Down Expand Up @@ -242,10 +244,10 @@ fn run_build(
noise_level: NoiseLevel,
tauri_dir: &Path,
) -> Result<OptionsHandle> {
if !(options.apk.is_some() || options.aab.is_some()) {
if !(options.skip_bundle || options.apk || options.aab) {
// if the user didn't specify the format to build, we'll do both
options.apk = Some(true);
options.aab = Some(true);
options.apk = true;
options.aab = true;
}

let interface_options = InterfaceOptions {
Expand All @@ -272,7 +274,7 @@ fn run_build(

inject_resources(config, tauri_config)?;

let apk_outputs = if options.apk.unwrap_or_default() {
let apk_outputs = if options.apk {
apk::build(
config,
env,
Expand All @@ -286,7 +288,7 @@ fn run_build(
Vec::new()
};

let aab_outputs = if options.aab.unwrap_or_default() {
let aab_outputs = if options.aab {
aab::build(
config,
env,
Expand Down
5 changes: 3 additions & 2 deletions crates/tauri-cli/src/mobile/android/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
features: options.features,
config: options.config.clone(),
split_per_abi: true,
apk: Some(false),
aab: Some(false),
apk: false,
aab: false,
skip_bundle: false,
open: options.open,
ci: false,
args: options.args,
Expand Down
Loading