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
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -831,6 +831,21 @@
 checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
 
 [[package]]
+name = "foreign-types"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
+dependencies = [
+ "foreign-types-shared",
+]
+
+[[package]]
+name = "foreign-types-shared"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
+
+[[package]]
 name = "form_urlencoded"
 version = "1.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1356,7 +1371,7 @@
 checksum = "39eb0623e15e4cb83c02ce6a959e48fadd1ae3b715b36b5acc01816e01388c82"
 dependencies = [
  "bstr",
- "hashbrown 0.16.1",
+ "hashbrown 0.15.5",
 ]
 
 [[package]]
@@ -2125,6 +2140,22 @@
 ]
 
 [[package]]
+name = "hyper-tls"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
+dependencies = [
+ "bytes",
+ "http-body-util",
+ "hyper",
+ "hyper-util",
+ "native-tls",
+ "tokio",
+ "tokio-native-tls",
+ "tower-service",
+]
+
+[[package]]
 name = "hyper-util"
 version = "0.1.20"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2934,6 +2965,23 @@
 ]
 
 [[package]]
+name = "native-tls"
+version = "0.2.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2"
+dependencies = [
+ "libc",
+ "log",
+ "openssl",
+ "openssl-probe",
+ "openssl-sys",
+ "schannel",
+ "security-framework",
+ "security-framework-sys",
+ "tempfile",
+]
+
+[[package]]
 name = "nix"
 version = "0.31.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3017,12 +3065,50 @@
 checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
 
 [[package]]
+name = "openssl"
+version = "0.10.78"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f38c4372413cdaaf3cc79dd92d29d7d9f5ab09b51b10dded508fb90bb70b9222"
+dependencies = [
+ "bitflags",
+ "cfg-if",
+ "foreign-types",
+ "libc",
+ "once_cell",
+ "openssl-macros",
+ "openssl-sys",
+]
+
+[[package]]
+name = "openssl-macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
 name = "openssl-probe"
 version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
 
 [[package]]
+name = "openssl-sys"
+version = "0.9.114"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13ce1245cd07fcc4cfdb438f7507b0c7e4f3849a69fd84d52374c66d83741bb6"
+dependencies = [
+ "cc",
+ "libc",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
 name = "option-ext"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3131,6 +3217,12 @@
 checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
 
 [[package]]
+name = "pkg-config"
+version = "0.3.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"
+
+[[package]]
 name = "plain"
 version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3470,10 +3562,12 @@
  "http-body-util",
  "hyper",
  "hyper-rustls",
+ "hyper-tls",
  "hyper-util",
  "js-sys",
  "log",
  "mime",
+ "native-tls",
  "percent-encoding",
  "pin-project-lite",
  "quinn",
@@ -3482,6 +3576,7 @@
  "rustls-platform-verifier",
  "sync_wrapper",
  "tokio",
+ "tokio-native-tls",
  "tokio-rustls",
  "tower",
  "tower-http",
@@ -4096,6 +4191,16 @@
 ]
 
 [[package]]
+name = "tokio-native-tls"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
+dependencies = [
+ "native-tls",
+ "tokio",
+]
+
+[[package]]
 name = "tokio-rustls"
 version = "0.26.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4333,6 +4438,12 @@
 checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
 
 [[package]]
+name = "vcpkg"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+
+[[package]]
 name = "version_check"
 version = "0.9.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
modifiedCargo.tomldiffbeforeafterboth
before · Cargo.toml
1[workspace]2members = [3  "crates/*",4  "bindings/jrsonnet-web",5  "bindings/jsonnet",6  "cmds/*",7  "tests",8  "xtask",9]10default-members = [11  "cmds/jrsonnet",12  "cmds/jrsonnet-fmt",13  "cmds/jrb",14  "bindings/jsonnet",15]16resolver = "2"1718[workspace.package]19authors = ["Yaroslav Bolyukin <iam@lach.pw>"]20edition = "2024"21license = "MIT"22repository = "https://github.com/CertainLach/jrsonnet"23version = "0.5.0-pre98"2425[workspace.dependencies]26jrsonnet-evaluator = { path = "./crates/jrsonnet-evaluator", version = "0.5.0-pre98" }27jrsonnet-macros = { path = "./crates/jrsonnet-macros", version = "0.5.0-pre98" }28jrsonnet-ir = { path = "./crates/jrsonnet-ir", version = "0.5.0-pre98" }29jrsonnet-ir-parser = { path = "./crates/jrsonnet-ir-parser", version = "0.5.0-pre98" }30jrsonnet-peg-parser = { path = "./crates/jrsonnet-peg-parser", version = "0.5.0-pre98" }31jrsonnet-rowan-parser = { path = "./crates/jrsonnet-rowan-parser", version = "0.5.0-pre98" }32jrsonnet-interner = { path = "./crates/jrsonnet-interner", version = "0.5.0-pre98" }33jrsonnet-stdlib = { path = "./crates/jrsonnet-stdlib", version = "0.5.0-pre98" }34jrsonnet-cli = { path = "./crates/jrsonnet-cli", version = "0.5.0-pre98" }35jrsonnet-types = { path = "./crates/jrsonnet-types", version = "0.5.0-pre98" }36jrsonnet-formatter = { path = "./crates/jrsonnet-formatter", version = "0.5.0-pre98" }37jrsonnet-lexer = { path = "./crates/jrsonnet-lexer", version = "0.5.0-pre98" }38jrsonnet-pkg = { path = "./crates/jrsonnet-pkg", version = "0.5.0-pre98" }39jrsonnet-gcmodule = { version = "0.5.0" }40# Diagnostics.41# hi-doc is my library, which handles text formatting very well, but isn't polished enough yet42# Previous implementation was based on annotate-snippets, which I don't like for many reasons.43#44# I'm against using miette, because I want to reuse data between interpreter and annotations, yet miette45#   and other libraries want to handle spans etc by itself, which is okay for compiler diagnostics, but is46#   bad for interpreter, where interpreter and parser are paired much closer.47hi-doc = { version = "0.3.0", default-features = false }4849# CLI50clap = "4.5"51clap_complete = "4.5"5253# Parsing, manifestification is implemented manually everywhere54serde = "1.0.228"55serde_json = "1.0.149"56serde-saphyr = { version = "0.0.26", default-features = false, features = [57  "deserialize",58] }5960# Error handling61anyhow = "1.0.101"62thiserror = "2.0.18"6364# Code formatting65dprint-core = "0.67.4"6667# Evaluator68stacker = "0.1.23"69smallvec = "1.15.1"70educe = { version = "0.6.0", default-features = false }71url = "2.5.8"72rustversion = "1.0.22"7374# Stdlib hashing functions75md5 = "0.8.0"76sha1 = "0.11.0"77sha2 = "0.11.0"78sha3 = "0.11.0"79hex = "0.4.3"8081# Source code parsing.82# Jrsonnet has two parsers for jsonnet - one is for execution, and another is for better parsing diagnostics/lints/LSP.83# First (and fast one) is based on peg, second is based on rowan.84peg = "0.8.5"85logos = "0.16.1"86ungrammar = "1.16.1"87rowan = "0.16.1"8889mimallocator = "0.1.3"90indoc = "2.0"91tempfile = "3.24"92pathdiff = "0.2.3"93hashbrown = "0.17.0"94static_assertions = "1.1"95rustc-hash = "2.1"96num-bigint = "0.4.6"97strsim = "0.11.1"98proc-macro2 = "1.0"99quote = "1.0"100syn = "2.0"101drop_bomb = "0.1.5"102base64 = "0.22.1"103indexmap = "2.13.0"104itertools = "0.14.0"105xshell = "0.2.7"106107regex = "1.12"108lru = "0.18.0"109110syn-dissect-closure = "0.1.0"111112# Tests/benchmarks113insta = { version = "1.46", features = ["glob"] }114criterion = { version = "0.8" }115strip-ansi-escapes = "0.2.1"116nix = { version = "0.31", features = ["process"] }117118# Web119wasm-bindgen = "=0.2.106"120wasm-bindgen-futures = "0.4.56"121js-sys = "0.3.83"122console_error_panic_hook = "0.1"123getrandom = "0.3.4"124125# Bundler126tracing = "0.1.44"127tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }128reqwest = { version = "0.13", features = [129  "blocking",130  "rustls",131], default-features = false }132zip = { version = "8", default-features = false, features = ["deflate"] }133directories = "6.0.0"134gix = { version = "0.83.0", features = [135  "blocking-network-client",136  "blocking-http-transport-reqwest-rust-tls",137] }138camino = { version = "1.2.2", features = ["serde1"] }139140[workspace.lints.rust]141unsafe_op_in_unsafe_fn = "deny"142143# TODO: add docs everywhere144# missing_doc = "warn"145146elided_lifetimes_in_paths = "allow"147explicit_outlives_requirements = "allow"148noop_method_call = "allow"149single_use_lifetimes = "allow"150variant_size_differences = "allow"151macro_expanded_macro_exports_accessed_by_absolute_paths = "allow"152153[workspace.lints.rustdoc]154all = "warn"155156[workspace.lints.clippy]157all = { level = "warn", priority = -1 }158nursery = { level = "warn", priority = -1 }159pedantic = { level = "warn", priority = -1 }160161ptr_arg = "allow"162# Too verbose163must_use_candidate = "allow"164# A lot of functions pass around errors thrown by code165missing_errors_doc = "allow"166# A lot of pointers have interior Rc167needless_pass_by_value = "allow"168# Its fine169wildcard_imports = "allow"170enum_glob_use = "allow"171module_name_repetitions = "allow"172# False positives173# https://github.com/rust-lang/rust-clippy/issues/6902174use_self = "allow"175# https://github.com/rust-lang/rust-clippy/issues/8539176iter_with_drain = "allow"177type_repetition_in_bounds = "allow"178# ci is being run with nightly, but library should work on stable179missing_const_for_fn = "allow"180# too many false-positives with .expect() calls181missing_panics_doc = "allow"182# false positive for IStr type. There is an configuration option for183# such cases, but it doesn't work:184# https://github.com/rust-lang/rust-clippy/issues/9801185mutable_key_type = "allow"186# false positives187redundant_pub_crate = "allow"188# Sometimes code is fancier without that189manual_let_else = "allow"190# Something is broken about that lint, can't be allowed for191# codegenerated-stdlib block192similar_names = "allow"193194[profile.release]195opt-level = 3196lto = "fat"197codegen-units = 1198debug = 0199panic = "abort"200strip = true201202[profile.releasedebug]203inherits = "release"204debug = 2205panic = "unwind"206strip = false
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))?;
 			}
 		}
 	}