@@ -28,7 +28,7 @@ pub(crate) const SHORT_VERSION: &str =
2828/// Build Timestamp: 2023-05-19T01:47:19.815651705Z
2929/// Build Features: jemalloc
3030/// ```
31- pub ( crate ) const LONG_VERSION : & str = concat ! (
31+ pub ( crate ) const LONG_VERSION : & str = const_str :: concat!(
3232 "Version: " ,
3333 env!( "CARGO_PKG_VERSION" ) ,
3434 "\n " ,
@@ -39,7 +39,10 @@ pub(crate) const LONG_VERSION: &str = concat!(
3939 env!( "VERGEN_BUILD_TIMESTAMP" ) ,
4040 "\n " ,
4141 "Build Features: " ,
42- env!( "VERGEN_CARGO_FEATURES" )
42+ env!( "VERGEN_CARGO_FEATURES" ) ,
43+ "\n " ,
44+ "Build Profile: " ,
45+ build_profile_name( )
4346) ;
4447
4548/// The version information for reth formatted for P2P (devp2p).
@@ -76,6 +79,16 @@ pub fn default_extradata() -> String {
7679 format ! ( "reth/v{}/{}" , env!( "CARGO_PKG_VERSION" ) , std:: env:: consts:: OS )
7780}
7881
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+
7992#[ cfg( test) ]
8093mod tests {
8194 use super :: * ;
0 commit comments