From 569ee82cf61a358b4c73ba52f2e99f3317ec05d0 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 30 Sep 2026 17:56:45 -0300 Subject: [PATCH] fix: mobile docs.rs builds --- .changes/docs-rs-android-build.md | 22 +++++++++++++++ Cargo.lock | 43 +++++++++++------------------- Cargo.toml | 2 +- plugins/barcode-scanner/build.rs | 7 +++-- plugins/biometric/build.rs | 7 +++-- plugins/clipboard-manager/build.rs | 7 +++-- plugins/deep-link/build.rs | 7 +++-- plugins/dialog/build.rs | 7 +++-- plugins/geolocation/build.rs | 7 +++-- plugins/haptics/build.rs | 7 +++-- plugins/nfc/build.rs | 7 +++-- plugins/notification/build.rs | 7 +++-- 12 files changed, 84 insertions(+), 46 deletions(-) create mode 100644 .changes/docs-rs-android-build.md diff --git a/.changes/docs-rs-android-build.md b/.changes/docs-rs-android-build.md new file mode 100644 index 000000000..2e6afa975 --- /dev/null +++ b/.changes/docs-rs-android-build.md @@ -0,0 +1,22 @@ +--- +"barcode-scanner": patch +"barcode-scanner-js": patch +"biometric": patch +"biometric-js": patch +"clipboard-manager": patch +"clipboard-manager-js": patch +"deep-link": patch +"deep-link-js": patch +"dialog": patch +"dialog-js": patch +"geolocation": patch +"geolocation-js": patch +"haptics": patch +"haptics-js": patch +"nfc": patch +"nfc-js": patch +"notification": patch +"notification-js": patch +--- + +Fix the docs.rs build for Android: the build script now detects docs.rs through the `DOCS_RS` environment variable, since `cfg(docsrs)` is never set for build scripts. diff --git a/Cargo.lock b/Cargo.lock index bf81fa51e..7e1278a33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -560,7 +560,7 @@ dependencies = [ "os_info", "smappservice-rs", "thiserror 2.0.12", - "windows-registry 0.6.1", + "windows-registry", "windows-result 0.4.1", ] @@ -1553,7 +1553,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.0", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -1596,7 +1596,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.7.4", + "libloading 0.8.9", ] [[package]] @@ -2794,7 +2794,7 @@ dependencies = [ "tokio", "tower-service", "tracing", - "windows-registry 0.5.1", + "windows-registry", ] [[package]] @@ -3708,7 +3708,7 @@ dependencies = [ "png 0.18.1", "serde", "thiserror 2.0.12", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -3921,7 +3921,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -5280,7 +5280,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -5337,7 +5337,7 @@ dependencies = [ "security-framework 3.5.1", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -6546,9 +6546,9 @@ dependencies = [ [[package]] name = "tauri-plugin" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ff3ebb9fda56ceb93d46f6cbb126bae82951bf43498543a5163dde5def49a1" +checksum = "1140cf34a3b3b836a13103dcab17f18831d5cc3534cbd435dc01a5c6daa65aa2" dependencies = [ "anyhow", "glob", @@ -6654,7 +6654,7 @@ dependencies = [ "thiserror 2.0.12", "tracing", "url", - "windows-registry 0.6.1", + "windows-registry", "windows-result 0.4.1", ] @@ -7116,9 +7116,9 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd257082deff79550de3409ed146104aeaf86fe38649615b04a304144939677" +checksum = "2ff55a614843b9a3f010f211df637c94df2607175b8d0f6e0f4a7c19e18621ee" dependencies = [ "aes-gcm", "anyhow", @@ -7186,7 +7186,7 @@ dependencies = [ "getrandom 0.3.2", "once_cell", "rustix 1.1.3", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -7628,7 +7628,7 @@ dependencies = [ "png 0.18.1", "serde", "thiserror 2.0.12", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -8353,7 +8353,7 @@ dependencies = [ "objc2-foundation 0.3.2", "objc2-quartz-core 0.3.2", "raw-window-handle", - "windows-sys 0.60.2", + "windows-sys 0.61.2", "windows-version", ] @@ -8514,17 +8514,6 @@ dependencies = [ "windows-link 0.2.1", ] -[[package]] -name = "windows-registry" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1da3e436dc7653dfdf3da67332e22bff09bb0e28b0239e1624499c7830842e" -dependencies = [ - "windows-link 0.1.1", - "windows-result 0.3.2", - "windows-strings 0.4.0", -] - [[package]] name = "windows-registry" version = "0.6.1" diff --git a/Cargo.toml b/Cargo.toml index c61f37e10..3342bf728 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ tracing = "0.1" log = "0.4.21" tauri = { version = "2.12", default-features = false } tauri-build = "2.7" -tauri-plugin = "2.7" +tauri-plugin = "2.7.1" tauri-utils = "2.10" serde_json = "1" thiserror = "2" diff --git a/plugins/barcode-scanner/build.rs b/plugins/barcode-scanner/build.rs index 25896b570..f040c34a9 100644 --- a/plugins/barcode-scanner/build.rs +++ b/plugins/barcode-scanner/build.rs @@ -18,8 +18,11 @@ fn main() { .ios_path("ios") .try_build(); - // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + // when building documentation for Android the plugin build result is always Err() (docs.rs mounts the sources read-only) and is irrelevant to the crate documentation build + // `cfg(docsrs)` only reaches rustdoc, build scripts must check the `DOCS_RS` env var instead + if !(std::env::var_os("DOCS_RS").is_some() + && std::env::var("TARGET").unwrap().contains("android")) + { result.unwrap(); } } diff --git a/plugins/biometric/build.rs b/plugins/biometric/build.rs index 070986b24..18e85e01f 100644 --- a/plugins/biometric/build.rs +++ b/plugins/biometric/build.rs @@ -11,8 +11,11 @@ fn main() { .ios_path("ios") .try_build(); - // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + // when building documentation for Android the plugin build result is always Err() (docs.rs mounts the sources read-only) and is irrelevant to the crate documentation build + // `cfg(docsrs)` only reaches rustdoc, build scripts must check the `DOCS_RS` env var instead + if !(std::env::var_os("DOCS_RS").is_some() + && std::env::var("TARGET").unwrap().contains("android")) + { result.unwrap(); } } diff --git a/plugins/clipboard-manager/build.rs b/plugins/clipboard-manager/build.rs index 9bbeddfcb..fa3d2b3d8 100644 --- a/plugins/clipboard-manager/build.rs +++ b/plugins/clipboard-manager/build.rs @@ -18,8 +18,11 @@ fn main() { .ios_path("ios") .try_build(); - // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + // when building documentation for Android the plugin build result is always Err() (docs.rs mounts the sources read-only) and is irrelevant to the crate documentation build + // `cfg(docsrs)` only reaches rustdoc, build scripts must check the `DOCS_RS` env var instead + if !(std::env::var_os("DOCS_RS").is_some() + && std::env::var("TARGET").unwrap().contains("android")) + { result.unwrap(); } } diff --git a/plugins/deep-link/build.rs b/plugins/deep-link/build.rs index f308ffe5f..a08a6e9b5 100644 --- a/plugins/deep-link/build.rs +++ b/plugins/deep-link/build.rs @@ -78,8 +78,11 @@ fn main() { .android_path("android") .try_build(); - // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + // when building documentation for Android the plugin build result is always Err() (docs.rs mounts the sources read-only) and is irrelevant to the crate documentation build + // `cfg(docsrs)` only reaches rustdoc, build scripts must check the `DOCS_RS` env var instead + if !(std::env::var_os("DOCS_RS").is_some() + && std::env::var("TARGET").unwrap().contains("android")) + { result.unwrap(); } diff --git a/plugins/dialog/build.rs b/plugins/dialog/build.rs index a94f61ac7..ff625140d 100644 --- a/plugins/dialog/build.rs +++ b/plugins/dialog/build.rs @@ -11,8 +11,11 @@ fn main() { .ios_path("ios") .try_build(); - // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + // when building documentation for Android the plugin build result is always Err() (docs.rs mounts the sources read-only) and is irrelevant to the crate documentation build + // `cfg(docsrs)` only reaches rustdoc, build scripts must check the `DOCS_RS` env var instead + if !(std::env::var_os("DOCS_RS").is_some() + && std::env::var("TARGET").unwrap().contains("android")) + { result.unwrap(); } } diff --git a/plugins/geolocation/build.rs b/plugins/geolocation/build.rs index b52497618..8ca1d4d59 100644 --- a/plugins/geolocation/build.rs +++ b/plugins/geolocation/build.rs @@ -17,8 +17,11 @@ fn main() { .ios_path("ios") .try_build(); - // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + // when building documentation for Android the plugin build result is always Err() (docs.rs mounts the sources read-only) and is irrelevant to the crate documentation build + // `cfg(docsrs)` only reaches rustdoc, build scripts must check the `DOCS_RS` env var instead + if !(std::env::var_os("DOCS_RS").is_some() + && std::env::var("TARGET").unwrap().contains("android")) + { result.unwrap(); } } diff --git a/plugins/haptics/build.rs b/plugins/haptics/build.rs index 2556cb674..4b69f7b3c 100644 --- a/plugins/haptics/build.rs +++ b/plugins/haptics/build.rs @@ -16,8 +16,11 @@ fn main() { .ios_path("ios") .try_build(); - // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + // when building documentation for Android the plugin build result is always Err() (docs.rs mounts the sources read-only) and is irrelevant to the crate documentation build + // `cfg(docsrs)` only reaches rustdoc, build scripts must check the `DOCS_RS` env var instead + if !(std::env::var_os("DOCS_RS").is_some() + && std::env::var("TARGET").unwrap().contains("android")) + { result.unwrap(); } } diff --git a/plugins/nfc/build.rs b/plugins/nfc/build.rs index bdcd84bf7..983884639 100644 --- a/plugins/nfc/build.rs +++ b/plugins/nfc/build.rs @@ -11,8 +11,11 @@ fn main() { .ios_path("ios") .try_build(); - // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + // when building documentation for Android the plugin build result is always Err() (docs.rs mounts the sources read-only) and is irrelevant to the crate documentation build + // `cfg(docsrs)` only reaches rustdoc, build scripts must check the `DOCS_RS` env var instead + if !(std::env::var_os("DOCS_RS").is_some() + && std::env::var("TARGET").unwrap().contains("android")) + { result.unwrap(); } diff --git a/plugins/notification/build.rs b/plugins/notification/build.rs index d7c0b3ed5..6858d0601 100644 --- a/plugins/notification/build.rs +++ b/plugins/notification/build.rs @@ -29,8 +29,11 @@ fn main() { .ios_path("ios") .try_build(); - // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + // when building documentation for Android the plugin build result is always Err() (docs.rs mounts the sources read-only) and is irrelevant to the crate documentation build + // `cfg(docsrs)` only reaches rustdoc, build scripts must check the `DOCS_RS` env var instead + if !(std::env::var_os("DOCS_RS").is_some() + && std::env::var("TARGET").unwrap().contains("android")) + { result.unwrap(); } }