Files
termux-packages/packages/cargo-leptos/01_target_os_android.patch
2025-11-30 10:39:03 +00:00

75 lines
2.6 KiB
Diff

From 21f9b812bf2a2f3a3ded6df1f56764e8f6d5ecd6 Mon Sep 17 00:00:00 2001
From: Konstantin Podsvirov <konstantin@podsvirov.su>
Date: Thu, 27 Nov 2025 23:17:07 +0300
Subject: [PATCH] fix: android support
---
README.md | 2 ++
src/ext/exe.rs | 16 ++++++++++++----
src/ext/util.rs | 2 ++
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 6ee75b6..2637f46 100644
--- a/README.md
+++ b/README.md
@@ -83,6 +83,8 @@ install it with the `no_downloads` feature enabled to prevent cargo-leptos from
> `cargo install --features no_downloads --locked cargo-leptos`
+On Android OS cargo-leptos never trying to download any dependencies and you should do it himself.
+
<br/>
## Completions
diff --git a/src/ext/exe.rs b/src/ext/exe.rs
index 30ea097..d91c7b7 100644
--- a/src/ext/exe.rs
+++ b/src/ext/exe.rs
@@ -222,8 +222,12 @@ impl Exe {
let path = if let Some(path) = meta.from_global_path() {
path
- } else if cfg!(feature = "no_downloads") {
- bail!("{} is required but was not found. Please install it using your OS's tool of choice", &meta.name);
+ } else if cfg!(any(feature = "no_downloads", target_os = "android")) {
+ bail!(
+ "{} is required but was not found. {}",
+ &meta.name,
+ &meta.manual
+ );
} else {
meta.cached().await.wrap_err(meta.manual)?
};
@@ -692,8 +696,12 @@ trait Command {
///
async fn exe_meta(&self, target_os: &str, target_arch: &str) -> Result<ExeMeta> {
let version = self.resolve_version().await;
- let url = self.download_url(target_os, target_arch, version.as_str())?;
- let exe = self.executable_name(target_os, target_arch, version.as_str())?;
+ let mut url = String::new();
+ let mut exe = String::new();
+ if cfg!(not(any(feature = "no_downloads", target_os = "android"))) {
+ url = self.download_url(target_os, target_arch, version.as_str())?;
+ exe = self.executable_name(target_os, target_arch, version.as_str())?;
+ }
Ok(ExeMeta {
name: self.name(),
version,
diff --git a/src/ext/util.rs b/src/ext/util.rs
index b9f5fba..b1b24b8 100644
--- a/src/ext/util.rs
+++ b/src/ext/util.rs
@@ -10,6 +10,8 @@ pub fn os_arch() -> Result<(&'static str, &'static str)> {
"macos"
} else if cfg!(target_os = "linux") {
"linux"
+ } else if cfg!(target_os = "android") {
+ "android"
} else {
bail!("unsupported OS")
};
--
2.52.0