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
after · Cargo.lock
488 packageslockfile v4
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))?;
 			}
 		}
 	}