Skip to content

Commit 54e5369

Browse files
committed
feat(build-dir): Added build-directory to cargo metadata output
1 parent 155aaae commit 54e5369

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/cargo/ops/cargo_output_metadata.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ pub fn output_metadata(ws: &Workspace<'_>, opt: &OutputMetadataOptions) -> Cargo
5252
.collect(),
5353
resolve,
5454
target_directory: ws.target_dir().into_path_unlocked(),
55+
build_directory: ws
56+
.gctx()
57+
.cli_unstable()
58+
.build_dir
59+
.then(|| ws.build_dir().into_path_unlocked()),
5560
version: VERSION,
5661
workspace_root: ws.root().to_path_buf(),
5762
metadata: ws.custom_metadata().cloned(),
@@ -68,6 +73,8 @@ pub struct ExportInfo {
6873
workspace_default_members: Vec<PackageIdSpec>,
6974
resolve: Option<MetadataResolve>,
7075
target_directory: PathBuf,
76+
#[serde(skip_serializing_if = "Option::is_none")]
77+
build_directory: Option<PathBuf>,
7178
version: u32,
7279
workspace_root: PathBuf,
7380
metadata: Option<toml::Value>,

tests/testsuite/metadata.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,6 +4312,7 @@ fn build_dir() {
43124312
.with_stdout_data(
43134313
str![[r#"
43144314
{
4315+
"build_directory": "[ROOT]/foo/build-dir",
43154316
"metadata": null,
43164317
"packages": "{...}",
43174318
"resolve": "{...}",

0 commit comments

Comments
 (0)