authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-24 13:35:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:36-07:00
logbc031bedaa470d14348a6be1da09a8ba5fd31c5d
tree02d6a7e2ea5439ee726609e0e84bdd10f1e9c6a5
parent2a8e15bc067a02b979bc06006f423a6a700ad36f

std.Build.Step: delete legacy Maker fields


1 files changed, 21 insertions(+), 40 deletions(-)

lib/std/Build/Step.zig+21-40
......@@ -1,20 +1,15 @@
11const Step = @This();
2const builtin = @import("builtin");
32
43const std = @import("../std.zig");
5const Io = std.Io;
64const Build = std.Build;
7const Allocator = std.mem.Allocator;
85const assert = std.debug.assert;
9const Cache = Build.Cache;
10const Path = Cache.Path;
11const ArrayList = std.ArrayList;
6const Configuration = std.Build.Configuration;
127
13tag: std.Build.Configuration.Step.Tag,
8tag: Configuration.Step.Tag,
149name: []const u8,
1510owner: *Build,
1611
17dependencies: ArrayList(*Step),
12dependencies: std.ArrayList(*Step),
1813
1914/// Set this field to declare an upper bound on the amount of bytes of memory it will
2015/// take to run the step. Zero means no limit.
......@@ -37,43 +32,30 @@ dependencies: ArrayList(*Step),
3732/// total system memory available.
3833max_rss: usize,
3934
40state: State,
41
4235/// The return address associated with creation of this step that can be useful
4336/// to print along with debugging messages.
4437debug_stack_trace: std.debug.StackTrace,
4538
46pub const State = enum {
47 precheck_unstarted,
48 precheck_started,
49 /// This is also used to indicate "dirty" steps that have been modified
50 /// after a previous build completed, in which case, the step may or may
51 /// not have been completed before. Either way, one or more of its direct
52 /// file system inputs have been modified, meaning that the step needs to
53 /// be re-evaluated.
54 precheck_done,
55 dependency_failure,
56};
57
58pub const Tag = std.Build.Configuration.Step.Tag;
39pub const Tag = Configuration.Step.Tag;
5940
6041pub fn Type(comptime tag: Tag) type {
6142 return switch (tag) {
62 .top_level => Build.TopLevelStep,
43 .check_file => CheckFile,
6344 .compile => Compile,
64 .install_artifact => InstallArtifact,
65 .install_file => InstallFile,
66 .install_dir => InstallDir,
45 .config_header => ConfigHeader,
6746 .fail => Fail,
47 .find_program => FindProgram,
6848 .fmt => Fmt,
69 .translate_c => TranslateC,
70 .write_file => WriteFile,
71 .update_source_files => UpdateSourceFiles,
72 .run => Run,
73 .check_file => CheckFile,
74 .config_header => ConfigHeader,
49 .install_artifact => InstallArtifact,
50 .install_dir => InstallDir,
51 .install_file => InstallFile,
7552 .obj_copy => ObjCopy,
7653 .options => Options,
54 .run => Run,
55 .top_level => TopLevel,
56 .translate_c => TranslateC,
57 .update_source_files => UpdateSourceFiles,
58 .write_file => WriteFile,
7759 };
7860}
7961
......@@ -116,7 +98,6 @@ pub fn init(options: StepOptions) Step {
11698 .name = arena.dupe(u8, options.name) catch @panic("OOM"),
11799 .owner = options.owner,
118100 .dependencies = .empty,
119 .state = .precheck_unstarted,
120101 .max_rss = options.max_rss,
121102 .debug_stack_trace = blk: {
122103 const addr_buf = arena.alloc(usize, options.owner.debug_stack_frames_count) catch @panic("OOM");
......@@ -132,14 +113,12 @@ pub fn dependOn(step: *Step, other: *Step) void {
132113}
133114
134115pub fn cast(step: *Step, comptime T: type) ?*T {
135 if (step.tag == T.base_tag) {
136 return @fieldParentPtr("step", step);
137 }
116 if (step.tag == T.base_tag) return @fieldParentPtr("step", step);
138117 return null;
139118}
140119
141120/// For debugging purposes, prints identifying information about this Step.
142pub fn dump(step: *Step, t: Io.Terminal) void {
121pub fn dump(step: *Step, t: std.Io.Terminal) void {
143122 const w = t.writer;
144123 if (step.debug_stack_trace.return_addresses.len > 0) {
145124 w.print("name: '{s}'. creation stack trace:\n", .{step.name}) catch {};
......@@ -155,16 +134,18 @@ pub fn dump(step: *Step, t: Io.Terminal) void {
155134
156135test {
157136 _ = CheckFile;
137 _ = Compile;
138 _ = ConfigHeader;
158139 _ = Fail;
140 _ = FindProgram;
159141 _ = Fmt;
160142 _ = InstallArtifact;
161143 _ = InstallDir;
162144 _ = InstallFile;
163145 _ = ObjCopy;
164 _ = Compile;
165146 _ = Options;
166147 _ = Run;
167148 _ = TranslateC;
168 _ = WriteFile;
169149 _ = UpdateSourceFiles;
150 _ = WriteFile;
170151}