Skip to content

Commit 30c01da

Browse files
committed
refactor(gctx): Pull out build-dir templating logic
1 parent 63aed0c commit 30c01da

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/cargo/util/context/mod.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,18 @@ impl GlobalContext {
658658
let Some(val) = &self.build_config()?.build_dir else {
659659
return Ok(None);
660660
};
661+
self.custom_build_dir(val, workspace_manifest_path)
662+
.map(Some)
663+
}
664+
665+
/// The directory to use for intermediate build artifacts.
666+
///
667+
/// Callers should prefer [`Workspace::build_dir`] instead.
668+
pub fn custom_build_dir(
669+
&self,
670+
val: &ConfigRelativePath,
671+
workspace_manifest_path: &PathBuf,
672+
) -> CargoResult<Filesystem> {
661673
let replacements = vec![
662674
(
663675
"{workspace-root}",
@@ -724,7 +736,7 @@ impl GlobalContext {
724736
)
725737
}
726738

727-
Ok(Some(Filesystem::new(path)))
739+
Ok(Filesystem::new(path))
728740
}
729741

730742
/// Get a configuration value by key.

0 commit comments

Comments
 (0)