Skip to content

Commit 3f4c4ce

Browse files
authored
fix(cli/android): fallback to all targets (#7028)
fix regression introduced in d03e47d
1 parent aa6c916 commit 3f4c4ce

2 files changed

Lines changed: 30 additions & 21 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'cli.rs': 'patch'
3+
---
4+
5+
Fix `--split-per-abi` not building any targets unless specified by `--target` flag.

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

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn run_build(
186186
env,
187187
noise_level,
188188
profile,
189-
get_targets(options.targets.clone().unwrap_or_default())?,
189+
get_targets_or_all(options.targets.clone().unwrap_or_default())?,
190190
options.split_per_abi,
191191
)?
192192
} else {
@@ -199,7 +199,7 @@ fn run_build(
199199
env,
200200
noise_level,
201201
profile,
202-
get_targets(options.targets.unwrap_or_default())?,
202+
get_targets_or_all(options.targets.unwrap_or_default())?,
203203
options.split_per_abi,
204204
)?
205205
} else {
@@ -212,24 +212,28 @@ fn run_build(
212212
Ok(())
213213
}
214214

215-
fn get_targets<'a>(targets: Vec<String>) -> Result<Vec<&'a Target<'a>>> {
216-
let mut outs = Vec::new();
217-
218-
let possible_targets = Target::all()
219-
.keys()
220-
.map(|key| key.to_string())
221-
.collect::<Vec<String>>()
222-
.join(",");
223-
224-
for t in targets {
225-
let target = Target::for_name(&t).ok_or_else(|| {
226-
anyhow::anyhow!(
227-
"Target {} is invalid; the possible targets are {}",
228-
t,
229-
possible_targets
230-
)
231-
})?;
232-
outs.push(target);
215+
fn get_targets_or_all<'a>(targets: Vec<String>) -> Result<Vec<&'a Target<'a>>> {
216+
if targets.is_empty() {
217+
Ok(Target::all().iter().map(|t| t.1).collect())
218+
} else {
219+
let mut outs = Vec::new();
220+
221+
let possible_targets = Target::all()
222+
.keys()
223+
.map(|key| key.to_string())
224+
.collect::<Vec<String>>()
225+
.join(",");
226+
227+
for t in targets {
228+
let target = Target::for_name(&t).ok_or_else(|| {
229+
anyhow::anyhow!(
230+
"Target {} is invalid; the possible targets are {}",
231+
t,
232+
possible_targets
233+
)
234+
})?;
235+
outs.push(target);
236+
}
237+
Ok(outs)
233238
}
234-
Ok(outs)
235239
}

0 commit comments

Comments
 (0)