This repository was archived by the owner on Apr 15, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ description = "Generates shader .spv files from rust-gpu shader crates"
66repository = " https://github.com/Rust-GPU/cargo-gpu"
77readme = " ../../README.md"
88keywords = [" gpu" , " compiler" ]
9+ build = " build.rs"
910# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1011
1112[dependencies ]
Original file line number Diff line number Diff line change 1+ //! cargo-gpu build script.
2+
3+ fn main ( ) {
4+ let git_hash = std:: process:: Command :: new ( "git" )
5+ . args ( [ "rev-parse" , "HEAD" ] )
6+ . output ( )
7+ . map_or_else (
8+ |_| "unknown" . to_owned ( ) ,
9+ |output| String :: from_utf8 ( output. stdout ) . unwrap_or_else ( |_| "unknown" . to_owned ( ) ) ,
10+ ) ;
11+ println ! ( "cargo:rustc-env=GIT_HASH={git_hash}" ) ;
12+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ pub enum Info {
1717 CacheDirectory ,
1818 /// The source location of spirv-std
1919 SpirvSource ( SpirvSourceDep ) ,
20+ /// The git commitsh of this cli tool.
21+ Commitsh ,
2022}
2123
2224/// `cargo gpu show`
@@ -48,6 +50,9 @@ impl Show {
4850 println ! ( "{rust_gpu_source}\n " ) ;
4951 }
5052 }
53+ Info :: Commitsh => {
54+ println ! ( "{}" , std:: env!( "GIT_HASH" ) ) ;
55+ }
5156 }
5257
5358 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments