Function getCompileDependencies [src]
Return the full set of Step.Compile which start depends on, recursively. start itself is
always returned as the first element. If chase_dynamic is false, then dynamic libraries are
not included, and their dependencies are not considered; if chase_dynamic is true, dynamic
libraries are treated the same as other linked Compiles.
Prototype
pub fn getCompileDependencies(start: *Compile, chase_dynamic: bool) []const *Compile
Parameters
start: *Compile
chase_dynamic: bool
Source
pub fn getCompileDependencies(start: *Compile, chase_dynamic: bool) []const *Compile {
const arena = start.step.owner.graph.arena;
var compiles: std.AutoArrayHashMapUnmanaged(*Compile, void) = .empty;
var next_idx: usize = 0;
compiles.putNoClobber(arena, start, {}) catch @panic("OOM");
while (next_idx < compiles.count()) {
const compile = compiles.keys()[next_idx];
next_idx += 1;
for (compile.root_module.getGraph().modules) |mod| {
for (mod.link_objects.items) |lo| {
switch (lo) {
.other_step => |other_compile| {
if (!chase_dynamic and other_compile.isDynamicLibrary()) continue;
compiles.put(arena, other_compile, {}) catch @panic("OOM");
},
else => {},
}
}
}
}
return compiles.keys();
}