diff --git a/source/dub/dependency.d b/source/dub/dependency.d index fc444e0..ddadb84 100644 --- a/source/dub/dependency.d +++ b/source/dub/dependency.d @@ -99,6 +99,12 @@ this.spec = s; } + int opCmp(in typeof(this) other) @safe const { + return name == other.name + ? spec.opCmp(other.spec) + : name.opCmp(other.name); + } + /// Name of the referenced package. PackageName name; diff --git a/source/dub/package_.d b/source/dub/package_.d index 94d2597..9b25558 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -573,13 +573,18 @@ // Left as package until the final API for this has been found package auto getAllDependenciesRange() const { + import std.algorithm: sort, uniq; + import std.array: array; return chain( only(this.recipe.buildSettings.dependencies.byKeyValue), this.recipe.configurations.map!(c => c.buildSettings.dependencies.byKeyValue) ) .joiner() - .map!(d => PackageDependency(PackageName(d.key), d.value)); + .map!(d => PackageDependency(PackageName(d.key), d.value)) + .array + .sort + .uniq; } diff --git a/source/dub/project.d b/source/dub/project.d index 0f4ce82..50d27a3 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -724,6 +724,13 @@ void determineDependencyConfigs(in Package p, string c) { + + // below we call createConfig for the main package if + // config.length is not zero. Carry on for that case, + // otherwise we've handle the pair (p, c) already + if(haveConfig(p.name, c) && !(config.length && p.name == m_rootPackage.name && config == c)) + return; + string[][string] depconfigs; foreach (d; p.getAllDependencies()) { auto dp = getDependency(d.name.toString(), true);