authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-28 17:49:46-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-06-29 23:50:18-07:00
log6a052277c37dff298b1ca18c4f07c0facf1beecf
tree08840b32fd1d914151c13b2c97b834ebf0ea746e
parent1d1193aa7b015174276b01ae17c68ca4271a0e1e

std.Build: document a handful of functions


1 files changed, 15 insertions(+), 3 deletions(-)

lib/std/Build.zig+15-3
......@@ -290,6 +290,7 @@ const UserValue = union(enum) {
290290 lazy_path_list: std.array_list.Managed(LazyPath),
291291};
292292
293/// Build system implementation detail.
293294pub fn create(
294295 graph: *Graph,
295296 root: Cache.Path,
......@@ -681,9 +682,9 @@ fn hashUserInputOptionsMap(allocator: Allocator, user_input_options: UserInputOp
681682
682683/// Create a set of key-value pairs that can be converted into a Zig source
683684/// file and then inserted into a Zig compilation's module table for importing.
684/// In other words, this provides a way to expose build.zig values to Zig
685/// source code with `@import`.
686/// Related: `Module.addOptions`.
685///
686/// This provides a way to expose build.zig values to Zig source code with
687/// `@import`. Related: `Module.addOptions`.
687688pub fn addOptions(b: *Build) *Step.Options {
688689 return Step.Options.create(b);
689690}
......@@ -970,6 +971,7 @@ pub fn addConfigHeader(
970971 return config_header_step;
971972}
972973
974/// Deprecated, call `Graph.dupeString` instead.
973975pub fn dupe(b: *Build, bytes: []const u8) []const u8 {
974976 return b.graph.dupeString(bytes);
975977}
......@@ -1292,6 +1294,8 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
12921294 }
12931295}
12941296
1297/// Creates a top-level build step, exposed to the CLI user and advertised in
1298/// the "--help" menu.
12951299pub fn step(b: *Build, name: []const u8, description: []const u8) *Step {
12961300 const graph = b.graph;
12971301 const arena = graph.arena;
......@@ -1476,6 +1480,7 @@ pub fn standardTargetOptionsQueryOnly(b: *Build, args: StandardTargetOptionsArgs
14761480 return args.default_target;
14771481}
14781482
1483/// Build system implementation detail.
14791484pub fn addUserInputOption(b: *Build, name_raw: []const u8, value_raw: []const u8) error{OutOfMemory}!bool {
14801485 const graph = b.graph;
14811486 const arena = graph.arena;
......@@ -1532,6 +1537,7 @@ pub fn addUserInputOption(b: *Build, name_raw: []const u8, value_raw: []const u8
15321537 return false;
15331538}
15341539
1540/// Build system implementation detail.
15351541pub fn addUserInputFlag(b: *Build, name_raw: []const u8) error{OutOfMemory}!bool {
15361542 const graph = b.graph;
15371543 const name = graph.dupeString(name_raw);
......@@ -1592,6 +1598,7 @@ fn markInvalidUserInput(b: *Build) void {
15921598 b.invalid_user_input = true;
15931599}
15941600
1601/// Build system implementation detail.
15951602pub fn validateUserInputDidItFail(b: *Build) bool {
15961603 // Make sure all args are used.
15971604 var it = b.user_input_options.iterator();
......@@ -2178,6 +2185,7 @@ pub inline fn lazyImport(
21782185 comptime unreachable; // Bad @dependencies source
21792186}
21802187
2188/// Build system implementation detail.
21812189pub fn dependencyFromBuildZig(
21822190 b: *Build,
21832191 /// The build.zig struct of the dependency, normally obtained by `@import` of the dependency.
......@@ -2334,6 +2342,7 @@ fn dependencyInner(
23342342 return dep;
23352343}
23362344
2345/// Build system implementation detail.
23372346pub fn runBuild(b: *Build, build_zig: anytype) anyerror!void {
23382347 switch (@typeInfo(@typeInfo(@TypeOf(build_zig.build)).@"fn".return_type.?)) {
23392348 .void => build_zig.build(b),
......@@ -2710,7 +2719,10 @@ pub fn systemIntegrationOption(
27102719
27112720test {
27122721 _ = Cache;
2722 _ = Configuration;
2723 _ = Module;
27132724 _ = Step;
27142725 _ = Configuration;
27152726 _ = &findProgram;
2727 _ = abi;
27162728}