Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › Build › dependencyResolved Private Function dependencyResolved Doc Source 2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141 fn dependencyResolved (
b : *Build ,
name : []const u8 ,
entry : PackageEntry ,
package_options : *PackageOptions .Map ,
) *Dependency {
const graph = b .graph ;
const io = graph .io ;
const arena = graph .arena ;
PackageOptions .sort (package_options );
if (graph .dependency_cache .getContext (.{
.pkg_hash = entry .hash ,
.options = package_options ,
}, .{})) |dep | return dep ;
const dep_root : Cache .Path = .{
.root_dir = .{
.path = entry .build_root ,
.handle = Io .Dir .cwd ().openDir (io , entry .build_root , .{}) catch |err |
fatal ("failed to open {q}: {t}" , .{ entry .build_root , err }),
},
};
const sub_builder = b .createChild (name , dep_root , entry .hash , entry .deps , package_options .*) catch @panic ("OOM" );
if (entry .run_build ) |run_build | {
run_build (sub_builder );
if (sub_builder .validateUserInputDidItFail ()) {
std .debug .dumpCurrentStackTrace (.{ .first_address = @returnAddress () });
}
}
const dep = graph .create (Dependency );
dep .* = .{ .builder = sub_builder };
graph .dependency_cache .putContext (arena , .{
.pkg_hash = entry .hash ,
.options = &sub_builder .user_input_options ,
}, dep , .{}) catch @panic ("OOM" );
return dep ;
}
Takes ownership of
package_options, which may be unsorted.