File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ description = "Generates shader .spv files from rust-gpu shader crates"
6
6
repository = " https://github.com/Rust-GPU/cargo-gpu"
7
7
readme = " ../../README.md"
8
8
keywords = [" gpu" , " compiler" ]
9
+ build = " build.rs"
9
10
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
10
11
11
12
[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 {
17
17
CacheDirectory ,
18
18
/// The source location of spirv-std
19
19
SpirvSource ( SpirvSourceDep ) ,
20
+ /// The git commitsh of this cli tool.
21
+ Commitsh ,
20
22
}
21
23
22
24
/// `cargo gpu show`
@@ -48,6 +50,9 @@ impl Show {
48
50
println ! ( "{rust_gpu_source}\n " ) ;
49
51
}
50
52
}
53
+ Info :: Commitsh => {
54
+ println ! ( "{}" , std:: env!( "GIT_HASH" ) ) ;
55
+ }
51
56
}
52
57
53
58
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments