Skip to content

Commit 4b36a8b

Browse files
committed
update version info message
1 parent 26c52aa commit 4b36a8b

29 files changed

Lines changed: 98 additions & 107 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/vey-build-env/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,3 @@ pub use basic::check_basic;
88

99
mod openssl;
1010
pub use openssl::check_openssl;
11-
12-
mod rustls;
13-
pub use rustls::check_rustls_provider;

lib/vey-build-env/src/openssl.rs

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,17 @@
66
use std::env;
77

88
pub fn check_openssl() {
9-
println!("cargo:rustc-check-cfg=cfg(libressl)");
10-
println!("cargo:rustc-check-cfg=cfg(tongsuo)");
11-
println!("cargo:rustc-check-cfg=cfg(boringssl)");
12-
println!("cargo:rustc-check-cfg=cfg(awslc)");
13-
149
if env::var("DEP_OPENSSL_LIBRESSL").is_ok() {
15-
println!("cargo:rustc-cfg=libressl");
1610
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=LibreSSL");
17-
return;
18-
}
19-
20-
if env::var("DEP_OPENSSL_TONGSUO").is_ok() {
21-
println!("cargo:rustc-cfg=tongsuo");
11+
} else if env::var("DEP_OPENSSL_TONGSUO").is_ok() {
2212
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=Tongsuo");
23-
return;
24-
}
25-
26-
if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
27-
println!("cargo:rustc-cfg=boringssl");
13+
} else if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
2814
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=BoringSSL");
29-
return;
30-
}
31-
32-
if env::var("DEP_OPENSSL_AWSLC").is_ok() {
33-
println!("cargo:rustc-cfg=awslc");
34-
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC");
35-
return;
36-
}
37-
38-
if env::var("DEP_OPENSSL_AWSLC_FIPS").is_ok() {
39-
println!("cargo:rustc-cfg=awslc");
40-
println!("cargo:rustc-cfg=awslc_fips");
15+
} else if env::var("DEP_OPENSSL_AWSLC_FIPS").is_ok() {
4116
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC-FIPS");
42-
return;
17+
} else if env::var("DEP_OPENSSL_AWSLC").is_ok() {
18+
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC");
19+
} else {
20+
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=OpenSSL");
4321
}
44-
45-
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=OpenSSL");
4622
}

lib/vey-openssl/build.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,31 @@ use std::env;
88
#[allow(clippy::unusual_byte_groupings)]
99
fn main() {
1010
println!("cargo:rustc-check-cfg=cfg(libressl)");
11+
println!("cargo:rustc-check-cfg=cfg(tongsuo)");
1112
println!("cargo:rustc-check-cfg=cfg(boringssl)");
1213
println!("cargo:rustc-check-cfg=cfg(awslc)");
14+
println!("cargo:rustc-check-cfg=cfg(awslc_fips)");
1315

1416
println!("cargo:rustc-check-cfg=cfg(ossl300)");
1517

1618
if env::var("DEP_OPENSSL_LIBRESSL").is_ok() {
1719
println!("cargo:rustc-cfg=libressl");
18-
}
19-
20-
if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
20+
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=LibreSSL");
21+
} else if env::var("DEP_OPENSSL_TONGSUO").is_ok() {
22+
println!("cargo:rustc-cfg=tongsuo");
23+
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=Tongsuo");
24+
} else if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
2125
println!("cargo:rustc-cfg=boringssl");
22-
}
23-
24-
if env::var("DEP_OPENSSL_AWSLC").is_ok() {
26+
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=BoringSSL");
27+
} else if env::var("DEP_OPENSSL_AWSLC_FIPS").is_ok() {
28+
println!("cargo:rustc-cfg=awslc");
29+
println!("cargo:rustc-cfg=awslc_fips");
30+
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC-FIPS");
31+
} else if env::var("DEP_OPENSSL_AWSLC").is_ok() {
2532
println!("cargo:rustc-cfg=awslc");
33+
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC");
34+
} else {
35+
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=OpenSSL");
2636
}
2737

2838
if let Ok(version) = env::var("DEP_OPENSSL_VERSION_NUMBER") {

lib/vey-openssl/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ pub use ssl::SslAsyncModeExt;
1414
#[cfg(not(libressl))]
1515
pub use ssl::SslLazyAcceptor;
1616
pub use ssl::{SslAcceptor, SslConnector, SslError, SslInfoCallbackWhere, SslStream};
17+
18+
const OPENSSL_VARIANT: Option<&str> = option_env!("VEY_OPENSSL_VARIANT");
19+
20+
pub fn variant_name() -> Option<&'static str> {
21+
OPENSSL_VARIANT
22+
}

lib/vey-resolver/src/driver/c_ares/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ mod config;
1010
pub use config::CAresDriverConfig;
1111

1212
mod error;
13+
14+
pub fn lib_version() -> &'static str {
15+
c_ares::version().0
16+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* SPDX-License-Identifier: Apache-2.0
3-
* SPDX-FileCopyrightText: 2024-2025 ByteDance and/or its affiliates.
3+
* SPDX-FileCopyrightText: 2026 VEY-OSS Developers.
44
*/
55

66
use std::env;
77

8-
pub fn check_rustls_provider() {
8+
fn main() {
99
if env::var("CARGO_FEATURE_RUSTLS_RING").is_ok() {
1010
println!("cargo:rustc-env=VEY_RUSTLS_PROVIDER=ring");
1111
}

lib/vey-rustls-provider/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use anyhow::anyhow;
77
use cfg_if::cfg_if;
88

9+
const PROVIDER_NAME: Option<&str> = option_env!("VEY_RUSTLS_PROVIDER");
10+
911
pub fn install_default() -> anyhow::Result<()> {
1012
// TODO use cfg_select
1113

@@ -23,3 +25,7 @@ pub fn install_default() -> anyhow::Result<()> {
2325
}
2426
}
2527
}
28+
29+
pub fn provider_name() -> Option<&'static str> {
30+
PROVIDER_NAME
31+
}

vey-bench/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ use std::env;
77

88
fn main() {
99
vey_build_env::check_basic();
10-
vey_build_env::check_openssl();
11-
vey_build_env::check_rustls_provider();
10+
11+
println!("cargo:rustc-check-cfg=cfg(tongsuo)");
12+
if env::var("DEP_OPENSSL_TONGSUO").is_ok() {
13+
println!("cargo:rustc-cfg=tongsuo");
14+
}
1215

1316
if env::var("CARGO_FEATURE_QUIC").is_ok() {
1417
println!("cargo:rustc-env=VEY_QUIC_FEATURE=quinn");

vey-bench/src/build.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ const PACKAGE_VERSION: Option<&str> = option_env!("VEY_PACKAGE_VERSION");
1919

2020
const QUIC_FEATURE: Option<&str> = option_env!("VEY_QUIC_FEATURE");
2121

22-
const OPENSSL_VARIANT: Option<&str> = option_env!("VEY_OPENSSL_VARIANT");
23-
const RUSTLS_PROVIDER: Option<&str> = option_env!("VEY_RUSTLS_PROVIDER");
24-
2522
pub fn print_version() {
2623
println!("{PKG_NAME} {VERSION}");
2724
print!("Features:");
@@ -33,10 +30,10 @@ pub fn print_version() {
3330
print!(" {quic}");
3431
}
3532
println!();
36-
if let Some(variant) = OPENSSL_VARIANT {
33+
if let Some(variant) = vey_openssl::variant_name() {
3734
println!("OpenSSL Variant: {variant}");
3835
}
39-
if let Some(provider) = RUSTLS_PROVIDER {
36+
if let Some(provider) = vey_rustls_provider::provider_name() {
4037
println!("Rustls Provider: {provider}");
4138
}
4239
println!("Compiler: {RUSTC_VERSION} ({RUSTC_CHANNEL})");

0 commit comments

Comments
 (0)