mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Use native tls as default tls backend, add features to use rustls or openssl instead
This commit is contained in:
parent
185b65fc9b
commit
8eda8df3f7
6 changed files with 103 additions and 56 deletions
23
build.rs
23
build.rs
|
|
@ -3,6 +3,29 @@ use clap_complete::shells;
|
|||
use std::path::{Path, PathBuf};
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let rustls_tls = cfg!(feature = "rustls-tls");
|
||||
let native_tls = cfg!(feature = "native-tls");
|
||||
let openssl_tls = cfg!(any(feature = "openssl-tls", feature = "openssl-tls-static"));
|
||||
|
||||
if rustls_tls as u8 + native_tls as u8 + openssl_tls as u8 > 1 {
|
||||
let active_tls_backend = if openssl_tls {
|
||||
"openssl"
|
||||
} else if native_tls {
|
||||
"native tls"
|
||||
} else {
|
||||
"rustls"
|
||||
};
|
||||
|
||||
println!("cargo:warning=Multiple tls backends are activated (through the '*-tls' features). Consider to activate only one as it is not possible to change the backend during runtime. The active backend for this build will be '{}'.", active_tls_backend)
|
||||
}
|
||||
|
||||
if cfg!(feature = "openssl") {
|
||||
println!("cargo:warning=The 'openssl' feature is deprecated and will be removed in a future version. Use the 'openssl-tls' feature instead.")
|
||||
}
|
||||
if cfg!(feature = "openssl-static") {
|
||||
println!("cargo:warning=The 'openssl-static' feature is deprecated and will be removed in a future version. Use the 'openssl-tls-static' feature instead.")
|
||||
}
|
||||
|
||||
// note that we're using an anti-pattern here / violate the rust conventions. build script are
|
||||
// not supposed to write outside of 'OUT_DIR'. to have the generated files in the build "root"
|
||||
// (the same directory where the output binary lives) is much simpler than in 'OUT_DIR' since
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue