@@ -28,7 +28,7 @@ pub(crate) const SHORT_VERSION: &str =
28
28
/// Build Timestamp: 2023-05-19T01:47:19.815651705Z
29
29
/// Build Features: jemalloc
30
30
/// ```
31
- pub ( crate ) const LONG_VERSION : & str = concat ! (
31
+ pub ( crate ) const LONG_VERSION : & str = const_str :: concat!(
32
32
"Version: " ,
33
33
env!( "CARGO_PKG_VERSION" ) ,
34
34
"\n " ,
@@ -39,7 +39,10 @@ pub(crate) const LONG_VERSION: &str = concat!(
39
39
env!( "VERGEN_BUILD_TIMESTAMP" ) ,
40
40
"\n " ,
41
41
"Build Features: " ,
42
- env!( "VERGEN_CARGO_FEATURES" )
42
+ env!( "VERGEN_CARGO_FEATURES" ) ,
43
+ "\n " ,
44
+ "Build Profile: " ,
45
+ build_profile_name( )
43
46
) ;
44
47
45
48
/// The version information for reth formatted for P2P (devp2p).
@@ -76,6 +79,16 @@ pub fn default_extradata() -> String {
76
79
format ! ( "reth/v{}/{}" , env!( "CARGO_PKG_VERSION" ) , std:: env:: consts:: OS )
77
80
}
78
81
82
+ const fn build_profile_name ( ) -> & ' static str {
83
+ // Derived from https://stackoverflow.com/questions/73595435/how-to-get-profile-from-cargo-toml-in-build-rs-or-at-runtime
84
+ // We split on the path separator of the *host* machine, which may be different from
85
+ // `std::path::MAIN_SEPARATOR_STR`.
86
+ const OUT_DIR : & str = env ! ( "OUT_DIR" ) ;
87
+ const SEP : char = if const_str:: contains!( OUT_DIR , "/" ) { '/' } else { '\\' } ;
88
+ let parts = const_str:: split!( OUT_DIR , SEP ) ;
89
+ parts[ parts. len ( ) - 4 ]
90
+ }
91
+
79
92
#[ cfg( test) ]
80
93
mod tests {
81
94
use super :: * ;
0 commit comments