From ef7fd8c7e4964a75069fd579295ca35f930d7eb1 Mon Sep 17 00:00:00 2001 From: Gavin Zhao Date: Wed, 13 Dec 2023 20:48:42 -0500 Subject: [PATCH] Support conflicts Signed-off-by: Gavin Zhao --- source/mason/build/builder.d | 2 ++ source/mason/build/manifest/package.d | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/source/mason/build/builder.d b/source/mason/build/builder.d index 5be19e6d70..c76c739689 100644 --- a/source/mason/build/builder.d +++ b/source/mason/build/builder.d @@ -453,9 +453,11 @@ private: oldPkg.runtimeDependencies = oldPkg.runtimeDependencies.chain(pkd.runtimeDependencies) .uniq.array; oldPkg.paths = oldPkg.paths.chain(pkd.paths).uniq.array; + oldPkg.conflicts = oldPkg.conflicts.chain(pkd.conflicts).uniq.array; sort(oldPkg.runtimeDependencies); sort(oldPkg.paths); + sort(oldPkg.conflicts); /* Merge details */ if (oldPkg.summary is null) diff --git a/source/mason/build/manifest/package.d b/source/mason/build/manifest/package.d index 65360bf931..31c8430d3c 100644 --- a/source/mason/build/manifest/package.d +++ b/source/mason/build/manifest/package.d @@ -106,6 +106,19 @@ public MetaPayload generateMetadata(scope AnalysisBucket bucket, } } + auto conflicts = pkg.pd.conflicts.map!((const n) => fromString!Dependency(n)); + if (!conflicts.empty) + { + foreach (conflict; conflicts) + { + if (shouldLog) + { + info(format!"[%s] conflicts with %s"(pkg.pd.name, conflict)); + } + met.addRecord(RecordType.Provider, RecordTag.Conflicts, conflict); + } + } + return met; }