From 13f91dd28fedf080c777e5469098236afea33f37 Mon Sep 17 00:00:00 2001 From: electricface Date: Thu, 18 Apr 2024 16:07:05 +0800 Subject: [PATCH] Remove duplicates and sort dub dependencies Co-authored-by: Jan Jurzitza --- workspace-d/source/workspaced/com/dub.d | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workspace-d/source/workspaced/com/dub.d b/workspace-d/source/workspaced/com/dub.d index 059956ed..c008eb74 100644 --- a/workspace-d/source/workspaced/com/dub.d +++ b/workspace-d/source/workspaced/com/dub.d @@ -1036,6 +1036,10 @@ string[] listDependencies(scope const Package pkg) return dependencies; foreach (dep; deps) dependencies ~= dep.name; + dependencies.sort(); + // filter duplicates in-place using copy. + // copy + this length construct allows us to `uniq` in-place + dependencies.length -= dependencies.uniq().copy(dependencies).length; return dependencies; }