Skip to content

Commit

Permalink
Do dependency resolution after checking valid configs
Browse files Browse the repository at this point in the history
  • Loading branch information
grillo-delmal authored and Geod24 committed Sep 24, 2024
1 parent c6da2dd commit 0ca04db
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions source/dub/dependencyresolver.d
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ class DependencyResolver(CONFIGS, CONFIG) {
ulong loop_counter = this.loop_limit;
constrain(root, context, loop_counter);

// Get best available results
foreach (base; context.configs.keys)
foreach (j, ref sc; context.configs[base])
if (sc.included){
context.result[base] = sc.config;
break;
}

// remove any non-default optional dependencies
purgeOptionalDependencies(root, context.result);

Expand Down Expand Up @@ -176,9 +184,6 @@ class DependencyResolver(CONFIGS, CONFIG) {
assert(base in context.configs);
if (context.isVisited(n.pack)) return;
context.setVisited(n.pack);
context.result[base] = n.config;
foreach (j, ref sc; context.configs[base])
sc.included = sc.config == n.config;

auto dependencies = getChildren(n);

Expand Down Expand Up @@ -316,10 +321,19 @@ class DependencyResolver(CONFIGS, CONFIG) {

auto failbase = failedNode.main;

// Get partial results
CONFIG[PackageName] partial_result;
foreach (base; context.configs.keys)
foreach (j, ref sc; context.configs[base])
if (sc.included){
partial_result[base] = sc.config;
break;
}

// get the list of all dependencies to the failed package
auto deps = context.visited.byKey
.filter!(p => !!(p.main in context.result))
.map!(p => TreeNode(p, context.result[p.main]))
.filter!(p => !!(p.main in partial_result))
.map!(p => TreeNode(p, partial_result[p.main]))
.map!(n => getChildren(n)
.filter!(d => d.pack.main == failbase)
.map!(d => tuple(n, d))
Expand Down

0 comments on commit 0ca04db

Please sign in to comment.