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. Public Function
dependencyFromBuildZig
Public Function
std.Build.dependencyFromBuildZig
pubfndependencyFromBuildZig(
b: *Build,
/// The build.zig struct of the dependency, normally obtained by `@import` of the dependency./// If called from the build.zig file itself, use `@This` to obtain a reference to the struct.comptimebuild_zig: type,
args: anytype,
) *Dependency
pubfndependencyFromBuildZig(
b: *Build,
/// The build.zig struct of the dependency, normally obtained by `@import` of the dependency./// If called from the build.zig file itself, use `@This` to obtain a reference to the struct.comptimebuild_zig: type,
args: anytype,
) *Dependency {
constarena = b.graph.arena;
find_dep: {
constpkg_hash = pkgHashFromBuildZig(build_zig) orelsebreak :find_dep;
constdep_name = for (b.available_deps) |dep| {
if (mem.eql(u8, dep[1], pkg_hash)) breakdep[1];
} elsebreak :find_dep;
constentry = package_map.get(pkg_hash) orelsebreak :find_dep;
varmap: PackageOptions.Map = .empty;
PackageOptions.fromArgs(arena, &map, args);
returndependencyResolved(b, dep_name, entry, &map);
}
constfull_path = b.root.join(arena, "build.zig.zon") catch@panic("OOM");
panic("{} is not a build.zig struct of a dependency in {f}", .{ build_zig, full_path });
}
Build system implementation detail.