Detect dependency cycles after version resolution and before configuration resolution. Fixes #280.
1 parent 20a5022 commit 11893895c5f52346ce69dc2f268a69842e317449
@Sönke Ludwig Sönke Ludwig authored on 14 Apr 2014
Showing 1 changed file
View
6
source/dub/project.d
foreach (bool v; r) if (!v) return false;
return true;
}
 
string[] allconfigs_path;
// create a graph of all possible package configurations (package, config) -> (subpackage, subconfig)
void determineAllConfigs(in Package p)
{
auto idx = allconfigs_path.countUntil(p.name);
enforce(idx < 0, format("Detected dependency cycle: %s", (allconfigs_path[idx .. $] ~ p.name).join("->")));
allconfigs_path ~= p.name;
scope (exit) allconfigs_path.length--;
 
// first, add all dependency configurations
foreach (dn; p.dependencies.byKey) {
auto dp = getDependency(dn, true);
if (!dp) continue;