mirror of
https://github.com/tauri-apps/cargo-mobile2.git
synced 2026-01-31 00:35:21 +01:00
fix: ignore log lines in avd_list, fix docs.rs build (#414)
This commit is contained in:
5
.changes/avd-list-log-lines.md
Normal file
5
.changes/avd-list-log-lines.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"cargo-mobile2": "patch"
|
||||
---
|
||||
|
||||
Fix `android::emulator::avd_list` function interpreting log lines from `emulator -list-avd` as valid `Emulator`
|
||||
13
Cargo.toml
13
Cargo.toml
@@ -15,6 +15,17 @@ keywords = [ "cargo", "mobile", "ios", "android", "tauri" ]
|
||||
categories = [ "development-tools::cargo-plugins" ]
|
||||
license = "Apache-2.0 OR MIT"
|
||||
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
no-default-features = true
|
||||
features = ["native-tls"]
|
||||
default-target = "x86_64-unknown-linux-gnu"
|
||||
targets = [
|
||||
"x86_64-pc-windows-msvc",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-apple-darwin",
|
||||
]
|
||||
|
||||
[[bin]]
|
||||
name = "cargo-mobile"
|
||||
required-features = [ "cli" ]
|
||||
@@ -42,7 +53,7 @@ cli = [
|
||||
brainium = [ ]
|
||||
rustls = [ "ureq/tls" ]
|
||||
native-tls = [ "ureq/native-tls" ]
|
||||
default = [ "cli", "ureq/native-tls" ]
|
||||
default = [ "cli", "native-tls" ]
|
||||
|
||||
[dependencies]
|
||||
handlebars = "6.0"
|
||||
|
||||
@@ -21,7 +21,7 @@ pub fn avd_list(env: &Env) -> Result<BTreeSet<Emulator>, Error> {
|
||||
raw_list
|
||||
.split('\n')
|
||||
.filter_map(|name| {
|
||||
if name.is_empty() {
|
||||
if name.is_empty() || is_emulator_log_line(name) {
|
||||
None
|
||||
} else {
|
||||
Some(Emulator::new(name.trim().into()))
|
||||
@@ -31,3 +31,9 @@ pub fn avd_list(env: &Env) -> Result<BTreeSet<Emulator>, Error> {
|
||||
})
|
||||
.map_err(Error::ListAvdsFailed)
|
||||
}
|
||||
|
||||
fn is_emulator_log_line(name: &str) -> bool {
|
||||
["INFO |", "WARNING |", "ERROR |"]
|
||||
.iter()
|
||||
.any(|prefix| name.starts_with(prefix))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user