project-model: fix JSON project PackageRoot buildfile inclusion

This commit is contained in:
Bogdan Mircea 2025-01-07 13:47:17 +02:00
parent 4a03036744
commit 4382331a36

View file

@ -606,18 +606,18 @@ impl ProjectWorkspace {
ProjectWorkspaceKind::Json(project) => project ProjectWorkspaceKind::Json(project) => project
.crates() .crates()
.map(|(_, krate)| { .map(|(_, krate)| {
let build_files = project // FIXME: PackageRoots dont allow specifying files, only directories
.crates() let build_file = krate
.filter_map(|(_, krate)| { .build
krate.build.as_ref().map(|build| build.build_file.clone()) .as_ref()
}) .map(|build| self.workspace_root().join(&build.build_file))
// FIXME: PackageRoots dont allow specifying files, only directories .as_deref()
.filter_map(|build_file| { .and_then(AbsPath::parent)
self.workspace_root().join(build_file).parent().map(ToOwned::to_owned) .map(ToOwned::to_owned);
});
PackageRoot { PackageRoot {
is_local: krate.is_workspace_member, is_local: krate.is_workspace_member,
include: krate.include.iter().cloned().chain(build_files).collect(), include: krate.include.iter().cloned().chain(build_file).collect(),
exclude: krate.exclude.clone(), exclude: krate.exclude.clone(),
} }
}) })