feat(build-dir): Added build-directory to cargo metadata output

This commit is contained in:
Ross Sullivan 2025-04-02 21:38:35 +09:00
parent 155aaae22e
commit 54e5369584
No known key found for this signature in database
GPG Key ID: A7D198C212395322
2 changed files with 8 additions and 0 deletions

View File

@ -52,6 +52,11 @@ pub fn output_metadata(ws: &Workspace<'_>, opt: &OutputMetadataOptions) -> Cargo
.collect(),
resolve,
target_directory: ws.target_dir().into_path_unlocked(),
build_directory: ws
.gctx()
.cli_unstable()
.build_dir
.then(|| ws.build_dir().into_path_unlocked()),
version: VERSION,
workspace_root: ws.root().to_path_buf(),
metadata: ws.custom_metadata().cloned(),
@ -68,6 +73,8 @@ pub struct ExportInfo {
workspace_default_members: Vec<PackageIdSpec>,
resolve: Option<MetadataResolve>,
target_directory: PathBuf,
#[serde(skip_serializing_if = "Option::is_none")]
build_directory: Option<PathBuf>,
version: u32,
workspace_root: PathBuf,
metadata: Option<toml::Value>,

View File

@ -4312,6 +4312,7 @@ fn build_dir() {
.with_stdout_data(
str![[r#"
{
"build_directory": "[ROOT]/foo/build-dir",
"metadata": null,
"packages": "{...}",
"resolve": "{...}",