File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 11use bindgen:: callbacks:: IntKind ;
22use std:: collections:: HashSet ;
3- use std:: env;
3+ use std:: { env, fs } ;
44use std:: path:: Path ;
55use std:: path:: PathBuf ;
66use std:: process:: Command ;
@@ -21,6 +21,14 @@ fn main() {
2121 }
2222 }
2323
24+ // Read the version from the VERSION file
25+ let version = fs:: read_to_string ( "../VERSION" )
26+ . expect ( "Failed to read VERSION file" )
27+ . trim ( )
28+ . to_string ( ) ;
29+ println ! ( "cargo:rustc-env=PROFILER_VERSION={}" , version) ;
30+ println ! ( "cargo:rerun-if-changed=../VERSION" ) ;
31+
2432 let php_config_includes = std:: str:: from_utf8 ( php_config_includes_output. stdout . as_slice ( ) )
2533 . expect ( "`php-config`'s stdout to be valid utf8" ) ;
2634
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ static PROFILER_NAME_CSTR: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(
5858
5959/// Version of the profiling module and zend_extension. Must not contain any
6060/// interior null bytes and must be null terminated.
61- static PROFILER_VERSION : & [ u8 ] = concat ! ( include_str !( "../../VERSION " ) , "\0 " ) . as_bytes ( ) ;
61+ static PROFILER_VERSION : & [ u8 ] = concat ! ( env !( "PROFILER_VERSION " ) , "\0 " ) . as_bytes ( ) ;
6262
6363/// Version ID of PHP at run-time, not the version it was built against at
6464/// compile-time. Its value is overwritten during minit.
@@ -82,7 +82,7 @@ lazy_static! {
8282 static ref LAZY_STATICS_TAGS : Vec <Tag > = {
8383 vec![
8484 tag!( "language" , "php" ) ,
85- tag!( "profiler_version" , include_str !( "../../VERSION " ) ) ,
85+ tag!( "profiler_version" , env !( "PROFILER_VERSION " ) ) ,
8686 // Safety: calling getpid() is safe.
8787 Tag :: new( "process_id" , unsafe { libc:: getpid( ) } . to_string( ) )
8888 . expect( "process_id tag to be valid" ) ,
You can’t perform that action at this time.
0 commit comments