File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -514,6 +514,9 @@ pub struct BuildConfig {
514
514
/// specified is the value of build.target-dir
515
515
///
516
516
/// [Cargo Reference](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-dir)
517
+ ///
518
+ /// **Note:** If a template variable is used the path will be unresolved. For available template
519
+ /// variables see the Cargo reference.
517
520
#[ cfg( feature = "unstable" ) ]
518
521
#[ serde( skip_serializing_if = "Option::is_none" ) ]
519
522
pub build_dir : Option < PathBuf > ,
@@ -582,7 +585,16 @@ impl BuildConfig {
582
585
} ) ;
583
586
let target_dir = de. target_dir . map ( |v| v. resolve_as_path ( current_dir) . into_owned ( ) ) ;
584
587
#[ cfg( feature = "unstable" ) ]
585
- let build_dir = de. build_dir . map ( |v| v. resolve_as_path ( current_dir) . into_owned ( ) ) ;
588
+ let build_dir = de. build_dir . map ( |v| {
589
+ if v. val . starts_with ( "{workspace-root}" )
590
+ || v. val . starts_with ( "{cargo-cache-home}" )
591
+ || v. val . contains ( "{workspace-path-hash}" )
592
+ {
593
+ return PathBuf :: from ( v. val ) ;
594
+ }
595
+
596
+ v. resolve_as_path ( current_dir) . into_owned ( )
597
+ } ) ;
586
598
let de_rustflags = de. rustflags . clone ( ) ;
587
599
let rustflags =
588
600
de. rustflags . map ( |v| Flags { flags : v. flags . into_iter ( ) . map ( |v| v. val ) . collect ( ) } ) ;
You can’t perform that action at this time.
0 commit comments