git.delta.rocks / jrsonnet / refs/commits / 80f6128c09ce

difftreelog

feat(jrb) use native-tls on apple/windows-mingw

pkwxmtqpYaroslav Bolyukin2026-05-07parent: #de9f0cb.patch.diff
in: master
Otherwise it is has some quirks. Also allows downstreams to have
different features for rustls if not building with jrb.

5 files changed

modifiedCargo.lockdiffbeforeafterboth
830source = "registry+https://github.com/rust-lang/crates.io-index"830source = "registry+https://github.com/rust-lang/crates.io-index"
831checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"831checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
832
833[[package]]
834name = "foreign-types"
835version = "0.3.2"
836source = "registry+https://github.com/rust-lang/crates.io-index"
837checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
838dependencies = [
839 "foreign-types-shared",
840]
841
842[[package]]
843name = "foreign-types-shared"
844version = "0.1.1"
845source = "registry+https://github.com/rust-lang/crates.io-index"
846checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
832847
833[[package]]848[[package]]
834name = "form_urlencoded"849name = "form_urlencoded"
1356checksum = "39eb0623e15e4cb83c02ce6a959e48fadd1ae3b715b36b5acc01816e01388c82"1371checksum = "39eb0623e15e4cb83c02ce6a959e48fadd1ae3b715b36b5acc01816e01388c82"
1357dependencies = [1372dependencies = [
1358 "bstr",1373 "bstr",
1359 "hashbrown 0.16.1",1374 "hashbrown 0.15.5",
1360]1375]
13611376
1362[[package]]1377[[package]]
2124 "tower-service",2139 "tower-service",
2125]2140]
2141
2142[[package]]
2143name = "hyper-tls"
2144version = "0.6.0"
2145source = "registry+https://github.com/rust-lang/crates.io-index"
2146checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
2147dependencies = [
2148 "bytes",
2149 "http-body-util",
2150 "hyper",
2151 "hyper-util",
2152 "native-tls",
2153 "tokio",
2154 "tokio-native-tls",
2155 "tower-service",
2156]
21262157
2127[[package]]2158[[package]]
2128name = "hyper-util"2159name = "hyper-util"
2933 "windows-sys 0.61.2",2964 "windows-sys 0.61.2",
2934]2965]
2966
2967[[package]]
2968name = "native-tls"
2969version = "0.2.18"
2970source = "registry+https://github.com/rust-lang/crates.io-index"
2971checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2"
2972dependencies = [
2973 "libc",
2974 "log",
2975 "openssl",
2976 "openssl-probe",
2977 "openssl-sys",
2978 "schannel",
2979 "security-framework",
2980 "security-framework-sys",
2981 "tempfile",
2982]
29352983
2936[[package]]2984[[package]]
2937name = "nix"2985name = "nix"
3016source = "registry+https://github.com/rust-lang/crates.io-index"3064source = "registry+https://github.com/rust-lang/crates.io-index"
3017checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"3065checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
3066
3067[[package]]
3068name = "openssl"
3069version = "0.10.78"
3070source = "registry+https://github.com/rust-lang/crates.io-index"
3071checksum = "f38c4372413cdaaf3cc79dd92d29d7d9f5ab09b51b10dded508fb90bb70b9222"
3072dependencies = [
3073 "bitflags",
3074 "cfg-if",
3075 "foreign-types",
3076 "libc",
3077 "once_cell",
3078 "openssl-macros",
3079 "openssl-sys",
3080]
3081
3082[[package]]
3083name = "openssl-macros"
3084version = "0.1.1"
3085source = "registry+https://github.com/rust-lang/crates.io-index"
3086checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
3087dependencies = [
3088 "proc-macro2",
3089 "quote",
3090 "syn",
3091]
30183092
3019[[package]]3093[[package]]
3020name = "openssl-probe"3094name = "openssl-probe"
3021version = "0.2.1"3095version = "0.2.1"
3022source = "registry+https://github.com/rust-lang/crates.io-index"3096source = "registry+https://github.com/rust-lang/crates.io-index"
3023checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"3097checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
3098
3099[[package]]
3100name = "openssl-sys"
3101version = "0.9.114"
3102source = "registry+https://github.com/rust-lang/crates.io-index"
3103checksum = "13ce1245cd07fcc4cfdb438f7507b0c7e4f3849a69fd84d52374c66d83741bb6"
3104dependencies = [
3105 "cc",
3106 "libc",
3107 "pkg-config",
3108 "vcpkg",
3109]
30243110
3025[[package]]3111[[package]]
3026name = "option-ext"3112name = "option-ext"
3130source = "registry+https://github.com/rust-lang/crates.io-index"3216source = "registry+https://github.com/rust-lang/crates.io-index"
3131checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"3217checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
3218
3219[[package]]
3220name = "pkg-config"
3221version = "0.3.33"
3222source = "registry+https://github.com/rust-lang/crates.io-index"
3223checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"
31323224
3133[[package]]3225[[package]]
3134name = "plain"3226name = "plain"
3470 "http-body-util",3562 "http-body-util",
3471 "hyper",3563 "hyper",
3472 "hyper-rustls",3564 "hyper-rustls",
3565 "hyper-tls",
3473 "hyper-util",3566 "hyper-util",
3474 "js-sys",3567 "js-sys",
3475 "log",3568 "log",
3476 "mime",3569 "mime",
3570 "native-tls",
3477 "percent-encoding",3571 "percent-encoding",
3478 "pin-project-lite",3572 "pin-project-lite",
3479 "quinn",3573 "quinn",
3482 "rustls-platform-verifier",3576 "rustls-platform-verifier",
3483 "sync_wrapper",3577 "sync_wrapper",
3484 "tokio",3578 "tokio",
3579 "tokio-native-tls",
3485 "tokio-rustls",3580 "tokio-rustls",
3486 "tower",3581 "tower",
3487 "tower-http",3582 "tower-http",
4095 "windows-sys 0.61.2",4190 "windows-sys 0.61.2",
4096]4191]
4192
4193[[package]]
4194name = "tokio-native-tls"
4195version = "0.3.1"
4196source = "registry+https://github.com/rust-lang/crates.io-index"
4197checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
4198dependencies = [
4199 "native-tls",
4200 "tokio",
4201]
40974202
4098[[package]]4203[[package]]
4099name = "tokio-rustls"4204name = "tokio-rustls"
4332source = "registry+https://github.com/rust-lang/crates.io-index"4437source = "registry+https://github.com/rust-lang/crates.io-index"
4333checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"4438checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
4439
4440[[package]]
4441name = "vcpkg"
4442version = "0.2.15"
4443source = "registry+https://github.com/rust-lang/crates.io-index"
4444checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
43344445
4335[[package]]4446[[package]]
4336name = "version_check"4447name = "version_check"
modifiedCargo.tomldiffbeforeafterboth
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -125,16 +125,12 @@
 # Bundler
 tracing = "0.1.44"
 tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
-reqwest = { version = "0.13", features = [
+reqwest = { version = "0.13", default-features = false, features = [
   "blocking",
-  "rustls",
-], default-features = false }
+] }
 zip = { version = "8", default-features = false, features = ["deflate"] }
 directories = "6.0.0"
-gix = { version = "0.83.0", features = [
-  "blocking-network-client",
-  "blocking-http-transport-reqwest-rust-tls",
-] }
+gix = { version = "0.83.0", features = ["blocking-network-client"] }
 camino = { version = "1.2.2", features = ["serde1"] }
 
 [workspace.lints.rust]
modifiedcrates/jrsonnet-pkg/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-pkg/Cargo.toml
+++ b/crates/jrsonnet-pkg/Cargo.toml
@@ -20,11 +20,21 @@
 peg.workspace = true
 
 # Gix for git repos, reqwest + zip for github
-gix.workspace = true
-reqwest.workspace = true
 zip.workspace = true
 url.workspace = true
 camino.workspace = true
 
 # Global cache dir
 directories.workspace = true
+
+[target.'cfg(not(any(all(target_os = "windows", target_env = "gnu"), target_vendor = "apple")))'.dependencies]
+gix = { workspace = true, features = [
+  "blocking-http-transport-reqwest-rust-tls",
+] }
+reqwest = { workspace = true, features = ["rustls"] }
+
+[target.'cfg(any(all(target_os = "windows", target_env = "gnu"), target_vendor = "apple"))'.dependencies]
+gix = { workspace = true, features = [
+  "blocking-http-transport-reqwest-native-tls",
+] }
+reqwest = { workspace = true, features = ["native-tls"] }
modifiedcrates/jrsonnet-pkg/src/install/github.rsdiffbeforeafterboth
--- a/crates/jrsonnet-pkg/src/install/github.rs
+++ b/crates/jrsonnet-pkg/src/install/github.rs
@@ -14,6 +14,7 @@
 use super::{
 	Error, LocalExtraction, ResolveResult, Result, VendorSource,
 	accessor::{AccessorEntry, ZipFileAccessor},
+	make_symlink,
 };
 use crate::{
 	install::{PKG_USER_AGENT, cache_dir},
@@ -84,24 +85,6 @@
 	Ok(ZipFileAccessor::new_prefixed(
 		File::open(zip_path).map_err(|e| Error::Io(zip_path.to_owned(), e))?,
 	)?)
-}
-
-#[cfg(unix)]
-fn make_symlink(target: &str, link: &Path) -> std::io::Result<()> {
-	std::os::unix::fs::symlink(target, link)
-}
-
-#[cfg(windows)]
-fn make_symlink(target: &str, link: &Path) -> std::io::Result<()> {
-	std::os::windows::fs::symlink_file(target, link)
-}
-
-#[cfg(not(any(unix, windows)))]
-fn make_symlink(_target: &str, _link: &Path) -> std::io::Result<()> {
-	Err(std::io::Error::new(
-		std::io::ErrorKind::Unsupported,
-		"symlinks are not supported on this platform",
-	))
 }
 
 fn extract_subdir(archive: &ZipFileAccessor, subdir: &SubDir, dest: &Path) -> Result<()> {
modifiedcrates/jrsonnet-pkg/src/install/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-pkg/src/install/mod.rs
+++ b/crates/jrsonnet-pkg/src/install/mod.rs
@@ -120,6 +120,24 @@
 	Ok(plan)
 }
 
+#[cfg(unix)]
+fn make_symlink(target: &str, link: &Path) -> std::io::Result<()> {
+	std::os::unix::fs::symlink(target, link)
+}
+
+#[cfg(windows)]
+fn make_symlink(target: &str, link: &Path) -> std::io::Result<()> {
+	std::os::windows::fs::symlink_dir(target, link)
+}
+
+#[cfg(not(any(unix, windows)))]
+fn make_symlink(_target: &str, _link: &Path) -> std::io::Result<()> {
+	Err(std::io::Error::new(
+		std::io::ErrorKind::Unsupported,
+		"symlinks are not supported on this platform",
+	))
+}
+
 fn is_up_to_date(dest: &Path, version: &str) -> bool {
 	fs::read_to_string(dest.join(VERSION_FILE)).is_ok_and(|v| v.trim() == version)
 }
@@ -182,8 +200,7 @@
 					fs::remove_file(&dest).map_err(|e| Error::Io(dest.clone(), e))?;
 				}
 				info!("symlink {path} -> {target}");
-				std::os::unix::fs::symlink(target.as_std_path(), &dest)
-					.map_err(|e| Error::Io(dest.clone(), e))?;
+				make_symlink(target.as_str(), &dest).map_err(|e| Error::Io(dest.clone(), e))?;
 			}
 		}
 	}