File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
//! Get config from the shader crate's `Cargo.toml` `[*.metadata.rust-gpu.*]`
2
2
3
+ use serde_json:: Value ;
4
+
3
5
/// `Metadata` refers to the `[metadata.*]` section of `Cargo.toml` that `cargo` formally
4
6
/// ignores so that packages can implement their own behaviour with it.
5
7
#[ derive( Debug ) ]
@@ -59,8 +61,19 @@ impl Metadata {
59
61
& mut metadata,
60
62
{
61
63
log:: debug!( "looking for crate metadata" ) ;
62
- let crate_meta = Self :: get_crate_metadata ( cargo_json, path) ?;
64
+ let mut crate_meta = Self :: get_crate_metadata ( cargo_json, path) ?;
63
65
log:: trace!( "crate_metadata: {crate_meta:#?}" ) ;
66
+ if let Some ( output_path) = crate_meta. pointer_mut ( "/build/output_dir" ) {
67
+ log:: debug!( "found output-dir path in crate metadata: {:?}" , output_path) ;
68
+ if let Some ( output_dir) = output_path. clone ( ) . as_str ( ) {
69
+ let new_output_path = path. join ( output_dir) ;
70
+ * output_path = Value :: String ( format ! ( "{}" , new_output_path. display( ) ) ) ;
71
+ log:: debug!(
72
+ "setting that to be relative to the Cargo.toml it was found in: {}" ,
73
+ new_output_path. display( )
74
+ ) ;
75
+ }
76
+ }
64
77
crate_meta
65
78
} ,
66
79
None ,
You can’t perform that action at this time.
0 commit comments