From fdec66c69f2eda1172eb4d8f4ab2d0be3fca5a9a Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Fri, 19 May 2023 06:59:26 -0700 Subject: [PATCH] fix: adjust Cargo features to fix android build (#375) --- .github/workflows/test-rust.yml | 2 +- Cargo.lock | 60 ++++++++++++++----- examples/api/src-tauri/Cargo.toml | 4 +- .../java/com/tauri/api/kotlin/RustPlugin.kt | 2 +- plugins/dialog/src/lib.rs | 1 + plugins/http/Cargo.toml | 1 - plugins/sql/Cargo.toml | 1 - plugins/updater/Cargo.toml | 1 - plugins/upload/Cargo.toml | 3 +- plugins/websocket/Cargo.toml | 3 +- 10 files changed, 53 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test-rust.yml b/.github/workflows/test-rust.yml index a9a1067a..66254085 100644 --- a/.github/workflows/test-rust.yml +++ b/.github/workflows/test-rust.yml @@ -140,7 +140,7 @@ jobs: sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libudev-dev - name: install openssl - if: ${{ matrix.platform == 'windows-latest' && matrix.package == 'tauri-plugin-authenticator' }} + if: ${{ matrix.platform == 'windows-latest' && contains(fromJSON('["tauri-plugin-http", "tauri-plugin-upload", "tauri-plugin-updater", "tauri-plugin-websocket", "tauri-plugin-authenticator"]'), matrix.package) }} run: | echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append vcpkg install openssl:x64-windows-static-md diff --git a/Cargo.lock b/Cargo.lock index 72e63f92..11300c86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2254,15 +2254,15 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.2" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7" dependencies = [ "http", "hyper", - "rustls", + "rustls 0.21.1", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.0", ] [[package]] @@ -4013,9 +4013,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "reqwest" -version = "0.11.16" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ "base64 0.21.0", "bytes 1.4.0", @@ -4037,14 +4037,14 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls", + "rustls 0.21.1", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", - "tokio-rustls", + "tokio-rustls 0.24.0", "tokio-util", "tower-service", "url", @@ -4169,6 +4169,18 @@ dependencies = [ "webpki", ] +[[package]] +name = "rustls" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + [[package]] name = "rustls-pemfile" version = "1.0.2" @@ -4178,6 +4190,16 @@ dependencies = [ "base64 0.21.0", ] +[[package]] +name = "rustls-webpki" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.12" @@ -4637,7 +4659,7 @@ dependencies = [ "percent-encoding", "rand 0.8.5", "rsa", - "rustls", + "rustls 0.20.8", "rustls-pemfile", "serde", "serde_json", @@ -4683,7 +4705,7 @@ checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024" dependencies = [ "once_cell", "tokio", - "tokio-rustls", + "tokio-rustls 0.23.4", ] [[package]] @@ -5725,11 +5747,21 @@ version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "rustls", + "rustls 0.20.8", "tokio", "webpki", ] +[[package]] +name = "tokio-rustls" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5" +dependencies = [ + "rustls 0.21.1", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.12" @@ -5763,10 +5795,10 @@ dependencies = [ "futures-util", "log", "native-tls", - "rustls", + "rustls 0.20.8", "tokio", "tokio-native-tls", - "tokio-rustls", + "tokio-rustls 0.23.4", "tungstenite", "webpki", "webpki-roots", @@ -5926,7 +5958,7 @@ dependencies = [ "log", "native-tls", "rand 0.8.5", - "rustls", + "rustls 0.20.8", "sha1", "thiserror", "url", diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index 9e98d669..e65c3044 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -22,7 +22,7 @@ tauri-plugin-log = { path = "../../../plugins/log", version = "1.0.0" } tauri-plugin-fs = { path = "../../../plugins/fs", version = "1.0.0" } tauri-plugin-clipboard = { path = "../../../plugins/clipboard", version = "1.0.0" } tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "1.0.0" } -tauri-plugin-http = { path = "../../../plugins/http", version = "1.0.0", features = [ "multipart" ] } +tauri-plugin-http = { path = "../../../plugins/http", features = [ "multipart" ], version = "1.0.0" } tauri-plugin-notification = { path = "../../../plugins/notification", version = "1.0.0", features = [ "windows7-compat" ] } tauri-plugin-os = { path = "../../../plugins/os", version = "1.0.0" } tauri-plugin-process = { path = "../../../plugins/process", version = "1.0.0" } @@ -37,7 +37,7 @@ features = [ "isolation", "macos-private-api", "system-tray", - "protocol-asset" + "protocol-asset", ] [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] diff --git a/examples/api/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/api/kotlin/RustPlugin.kt b/examples/api/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/api/kotlin/RustPlugin.kt index 2ea5ce5c..4aa7fcaf 100644 --- a/examples/api/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/api/kotlin/RustPlugin.kt +++ b/examples/api/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/api/kotlin/RustPlugin.kt @@ -21,7 +21,7 @@ open class RustPlugin : Plugin { val abiList = (findProperty("abiList") as? String)?.split(',') ?: defaultAbiList val defaultArchList = listOf("arm64", "arm", "x86", "x86_64"); - val archList = (findProperty("archList") as? String)?.split(',') ?: listOf("arm64", "arm", "x86", "x86_64") + val archList = (findProperty("archList") as? String)?.split(',') ?: defaultArchList val targetsList = (findProperty("targetList") as? String)?.split(',') ?: listOf("aarch64", "armv7", "i686", "x86_64") diff --git a/plugins/dialog/src/lib.rs b/plugins/dialog/src/lib.rs index 3349965b..2c07b591 100644 --- a/plugins/dialog/src/lib.rs +++ b/plugins/dialog/src/lib.rs @@ -69,6 +69,7 @@ impl Dialog { /// Initializes the plugin. pub fn init() -> TauriPlugin { + #[allow(unused_mut)] let mut builder = Builder::new("dialog"); // Dialogs are implemented natively on Android diff --git a/plugins/http/Cargo.toml b/plugins/http/Cargo.toml index 40863f17..cb67760d 100644 --- a/plugins/http/Cargo.toml +++ b/plugins/http/Cargo.toml @@ -19,7 +19,6 @@ http = "0.2" reqwest = { version = "0.11", default-features = false, features = [ "json", "stream" ] } [features] -default = [ "native-tls-vendored" ] multipart = [ "reqwest/multipart" ] native-tls = [ "reqwest/native-tls" ] native-tls-vendored = [ "reqwest/native-tls-vendored" ] diff --git a/plugins/sql/Cargo.toml b/plugins/sql/Cargo.toml index 00660c6e..da263e5f 100644 --- a/plugins/sql/Cargo.toml +++ b/plugins/sql/Cargo.toml @@ -21,7 +21,6 @@ time = "0.3" tokio = { version = "1", features = ["sync"] } [features] -default = [ "sqlite" ] sqlite = ["sqlx/sqlite"] mysql = ["sqlx/mysql"] postgres = ["sqlx/postgres"] \ No newline at end of file diff --git a/plugins/updater/Cargo.toml b/plugins/updater/Cargo.toml index a5cd01ed..3230da31 100644 --- a/plugins/updater/Cargo.toml +++ b/plugins/updater/Cargo.toml @@ -35,7 +35,6 @@ mockito = "0.31" tokio-test = "0.4.2" [features] -default = [ "native-tls-vendored" ] native-tls = [ "reqwest/native-tls" ] native-tls-vendored = [ "reqwest/native-tls-vendored" ] rustls-tls = [ "reqwest/rustls-tls" ] diff --git a/plugins/upload/Cargo.toml b/plugins/upload/Cargo.toml index e027968e..787a072c 100644 --- a/plugins/upload/Cargo.toml +++ b/plugins/upload/Cargo.toml @@ -17,12 +17,11 @@ log = { workspace = true } thiserror = { workspace = true } tokio = { version = "1", features = [ "fs" ] } tokio-util = { version = "0.7", features = [ "codec" ] } -reqwest = { version = "0.11", features = [ "json", "stream" ] } +reqwest = { version = "0.11", default-features = false, features = [ "json", "stream" ] } futures-util = "0.3" read-progress-stream = "1.0.0" [features] -default = [ "native-tls-vendored" ] native-tls = [ "reqwest/native-tls" ] native-tls-vendored = [ "reqwest/native-tls-vendored" ] rustls-tls = [ "reqwest/rustls-tls" ] \ No newline at end of file diff --git a/plugins/websocket/Cargo.toml b/plugins/websocket/Cargo.toml index b396bf27..3ab8ddb3 100644 --- a/plugins/websocket/Cargo.toml +++ b/plugins/websocket/Cargo.toml @@ -18,10 +18,9 @@ thiserror = { workspace = true } rand = "0.8" futures-util = "0.3" tokio = { version = "1", features = ["net", "sync"] } -tokio-tungstenite = { version = "0.18", features = ["native-tls"] } +tokio-tungstenite = { version = "0.18" } [features] -default = [ "native-tls-vendored" ] native-tls = [ "tokio-tungstenite/native-tls" ] native-tls-vendored = [ "tokio-tungstenite/native-tls-vendored" ] rustls-tls-webpki-roots = [ "tokio-tungstenite/rustls-tls-webpki-roots" ]