fix: remove AbsPath requirement from linkedProjects

This commit is contained in:
David Barsky 2024-07-31 10:07:48 -04:00
parent 4feec4b0c1
commit 8ac0ffecc1

View file

@ -1677,7 +1677,7 @@ impl Config {
!self.linkedProjects(None).is_empty() !self.linkedProjects(None).is_empty()
} }
pub fn linked_manifests(&self) -> impl Iterator<Item = &AbsPath> + '_ { pub fn linked_manifests(&self) -> impl Iterator<Item = &Utf8Path> + '_ {
self.linkedProjects(None).iter().filter_map(|it| match it { self.linkedProjects(None).iter().filter_map(|it| match it {
ManifestOrProjectJson::Manifest(p) => Some(&**p), ManifestOrProjectJson::Manifest(p) => Some(&**p),
// despite having a buildfile, using this variant as a manifest // despite having a buildfile, using this variant as a manifest
@ -2273,11 +2273,7 @@ mod single_or_array {
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(untagged)] #[serde(untagged)]
enum ManifestOrProjectJson { enum ManifestOrProjectJson {
Manifest( Manifest(Utf8PathBuf),
#[serde(serialize_with = "serialize_abs_pathbuf")]
#[serde(deserialize_with = "deserialize_abs_pathbuf")]
AbsPathBuf,
),
ProjectJson(ProjectJsonData), ProjectJson(ProjectJsonData),
DiscoveredProjectJson { DiscoveredProjectJson {
data: ProjectJsonData, data: ProjectJsonData,
@ -2306,10 +2302,12 @@ where
} }
impl ManifestOrProjectJson { impl ManifestOrProjectJson {
fn manifest(&self) -> Option<&AbsPath> { fn manifest(&self) -> Option<&Utf8Path> {
match self { match self {
ManifestOrProjectJson::Manifest(manifest) => Some(manifest), ManifestOrProjectJson::Manifest(manifest) => Some(manifest),
ManifestOrProjectJson::DiscoveredProjectJson { buildfile, .. } => Some(buildfile), ManifestOrProjectJson::DiscoveredProjectJson { buildfile, .. } => {
Some(buildfile.as_ref())
}
ManifestOrProjectJson::ProjectJson(_) => None, ManifestOrProjectJson::ProjectJson(_) => None,
} }
} }