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 @@...@@ -1,20 +1,15 @@
1const Step = @This();1const Step = @This();
2const builtin = @import("builtin");
32
4const std = @import("../std.zig");3const std = @import("../std.zig");
5const Io = std.Io;
6const Build = std.Build;4const Build = std.Build;
7const Allocator = std.mem.Allocator;
8const assert = std.debug.assert;5const assert = std.debug.assert;
9const Cache = Build.Cache;6const Configuration = std.Build.Configuration;
10const Path = Cache.Path;
11const ArrayList = std.ArrayList;
127
13tag: std.Build.Configuration.Step.Tag,8tag: Configuration.Step.Tag,
14name: []const u8,9name: []const u8,
15owner: *Build,10owner: *Build,
1611
17dependencies: ArrayList(*Step),12dependencies: std.ArrayList(*Step),
1813
19/// Set this field to declare an upper bound on the amount of bytes of memory it will14/// Set this field to declare an upper bound on the amount of bytes of memory it will
20/// take to run the step. Zero means no limit.15/// take to run the step. Zero means no limit.
...@@ -37,43 +32,30 @@ dependencies: ArrayList(*Step),...@@ -37,43 +32,30 @@ dependencies: ArrayList(*Step),
37/// total system memory available.32/// total system memory available.
38max_rss: usize,33max_rss: usize,
3934
40state: State,
41
42/// The return address associated with creation of this step that can be useful35/// The return address associated with creation of this step that can be useful
43/// to print along with debugging messages.36/// to print along with debugging messages.
44debug_stack_trace: std.debug.StackTrace,37debug_stack_trace: std.debug.StackTrace,
4538
46pub const State = enum {39pub const Tag = Configuration.Step.Tag;
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;
5940
60pub fn Type(comptime tag: Tag) type {41pub fn Type(comptime tag: Tag) type {
61 return switch (tag) {42 return switch (tag) {
62 .top_level => Build.TopLevelStep,43 .check_file => CheckFile,
63 .compile => Compile,44 .compile => Compile,
64 .install_artifact => InstallArtifact,45 .config_header => ConfigHeader,
65 .install_file => InstallFile,
66 .install_dir => InstallDir,
67 .fail => Fail,46 .fail => Fail,
47 .find_program => FindProgram,
68 .fmt => Fmt,48 .fmt => Fmt,
69 .translate_c => TranslateC,49 .install_artifact => InstallArtifact,
70 .write_file => WriteFile,50 .install_dir => InstallDir,
71 .update_source_files => UpdateSourceFiles,51 .install_file => InstallFile,
72 .run => Run,
73 .check_file => CheckFile,
74 .config_header => ConfigHeader,
75 .obj_copy => ObjCopy,52 .obj_copy => ObjCopy,
76 .options => Options,53 .options => Options,
54 .run => Run,
55 .top_level => TopLevel,
56 .translate_c => TranslateC,
57 .update_source_files => UpdateSourceFiles,
58 .write_file => WriteFile,
77 };59 };
78}60}
7961
...@@ -116,7 +98,6 @@ pub fn init(options: StepOptions) Step {...@@ -116,7 +98,6 @@ pub fn init(options: StepOptions) Step {
116 .name = arena.dupe(u8, options.name) catch @panic("OOM"),98 .name = arena.dupe(u8, options.name) catch @panic("OOM"),
117 .owner = options.owner,99 .owner = options.owner,
118 .dependencies = .empty,100 .dependencies = .empty,
119 .state = .precheck_unstarted,
120 .max_rss = options.max_rss,101 .max_rss = options.max_rss,
121 .debug_stack_trace = blk: {102 .debug_stack_trace = blk: {
122 const addr_buf = arena.alloc(usize, options.owner.debug_stack_frames_count) catch @panic("OOM");103 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 {...@@ -132,14 +113,12 @@ pub fn dependOn(step: *Step, other: *Step) void {
132}113}
133114
134pub fn cast(step: *Step, comptime T: type) ?*T {115pub fn cast(step: *Step, comptime T: type) ?*T {
135 if (step.tag == T.base_tag) {116 if (step.tag == T.base_tag) return @fieldParentPtr("step", step);
136 return @fieldParentPtr("step", step);
137 }
138 return null;117 return null;
139}118}
140119
141/// For debugging purposes, prints identifying information about this Step.120/// 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 {
143 const w = t.writer;122 const w = t.writer;
144 if (step.debug_stack_trace.return_addresses.len > 0) {123 if (step.debug_stack_trace.return_addresses.len > 0) {
145 w.print("name: '{s}'. creation stack trace:\n", .{step.name}) catch {};124 w.print("name: '{s}'. creation stack trace:\n", .{step.name}) catch {};
...@@ -155,16 +134,18 @@ pub fn dump(step: *Step, t: Io.Terminal) void {...@@ -155,16 +134,18 @@ pub fn dump(step: *Step, t: Io.Terminal) void {
155134
156test {135test {
157 _ = CheckFile;136 _ = CheckFile;
137 _ = Compile;
138 _ = ConfigHeader;
158 _ = Fail;139 _ = Fail;
140 _ = FindProgram;
159 _ = Fmt;141 _ = Fmt;
160 _ = InstallArtifact;142 _ = InstallArtifact;
161 _ = InstallDir;143 _ = InstallDir;
162 _ = InstallFile;144 _ = InstallFile;
163 _ = ObjCopy;145 _ = ObjCopy;
164 _ = Compile;
165 _ = Options;146 _ = Options;
166 _ = Run;147 _ = Run;
167 _ = TranslateC;148 _ = TranslateC;
168 _ = WriteFile;
169 _ = UpdateSourceFiles;149 _ = UpdateSourceFiles;
150 _ = WriteFile;
170}151}