| ... | @@ -82,604 +82,606 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi | ... | @@ -82,604 +82,606 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 82 | .steps = .{ .slice = dep_steps }, | 82 | .steps = .{ .slice = dep_steps }, |
| 83 | }); | 83 | }); |
| 84 | | 84 | |
| 85 | try wc.steps.ensureTotalCapacity(gpa, s.step_map.entries.capacity); | 85 | const extended: u32 = switch (step.tag) { |
| 86 | wc.steps.appendAssumeCapacity(.{ | 86 | .top_level => e: { |
| 87 | .name = try wc.addString(step.name), | 87 | const top_level: *Step.TopLevel = @fieldParentPtr("step", step); |
| 88 | .owner = try s.builderToPackage(step.owner), | 88 | break :e try wc.addExtraErased(Configuration.Step.TopLevel, .{ |
| 89 | .deps = deps, | 89 | .description = try wc.addString(top_level.description), |
| 90 | .max_rss = .fromBytes(step.max_rss), | 90 | }); |
| 91 | .extended = @fromBackingInt(@intCast(switch (step.tag) { | 91 | }, |
| 92 | .top_level => e: { | 92 | .compile => e: { |
| 93 | const top_level: *Step.TopLevel = @fieldParentPtr("step", step); | 93 | const c: *Step.Compile = @fieldParentPtr("step", step); |
| 94 | break :e try wc.addExtraErased(Configuration.Step.TopLevel, .{ | 94 | const installed_headers: []u32 = try arena.alloc(u32, c.installed_headers.items.len); |
| 95 | .description = try wc.addString(top_level.description), | 95 | for (installed_headers, c.installed_headers.items) |*dst, src| switch (src) { |
| 96 | }); | 96 | .file => |file| { |
| 97 | }, | 97 | dst.* = try wc.addExtraErased(Configuration.Step.Compile.InstalledHeader.File, .{ |
| 98 | .compile => e: { | 98 | .source = try s.addLazyPath(file.source), |
| 99 | const c: *Step.Compile = @fieldParentPtr("step", step); | 99 | .dest_sub_path = try wc.addString(file.dest_rel_path), |
| 100 | const installed_headers: []u32 = try arena.alloc(u32, c.installed_headers.items.len); | 100 | }); |
| 101 | for (installed_headers, c.installed_headers.items) |*dst, src| switch (src) { | 101 | }, |
| 102 | .file => |file| { | 102 | .directory => |directory| { |
| 103 | dst.* = try wc.addExtraErased(Configuration.Step.Compile.InstalledHeader.File, .{ | 103 | const include_extensions = directory.options.include_extensions orelse &.{}; |
| 104 | .source = try s.addLazyPath(file.source), | 104 | dst.* = try wc.addExtraErased(Configuration.Step.Compile.InstalledHeader.Directory, .{ |
| 105 | .dest_sub_path = try wc.addString(file.dest_rel_path), | 105 | .flags = .{ |
| 106 | }); | 106 | .include_extensions = include_extensions.len != 0, |
| 107 | }, | 107 | .exclude_extensions = directory.options.exclude_extensions.len != 0, |
| 108 | .directory => |directory| { | | |
| 109 | const include_extensions = directory.options.include_extensions orelse &.{}; | | |
| 110 | dst.* = try wc.addExtraErased(Configuration.Step.Compile.InstalledHeader.Directory, .{ | | |
| 111 | .flags = .{ | | |
| 112 | .include_extensions = include_extensions.len != 0, | | |
| 113 | .exclude_extensions = directory.options.exclude_extensions.len != 0, | | |
| 114 | }, | | |
| 115 | .source = try s.addLazyPath(directory.source), | | |
| 116 | .dest_sub_path = try wc.addString(directory.dest_rel_path), | | |
| 117 | .exclude_extensions = .{ .slice = try s.initStringList(directory.options.exclude_extensions) }, | | |
| 118 | .include_extensions = .{ .slice = try s.initStringList(include_extensions) }, | | |
| 119 | }); | | |
| 120 | }, | | |
| 121 | }; | | |
| 122 | | | |
| 123 | break :e try wc.addExtraErased(Configuration.Step.Compile, .{ | | |
| 124 | .flags = .{ | | |
| 125 | .filters_len = c.filters.len != 0, | | |
| 126 | .installed_headers_len = installed_headers.len != 0, | | |
| 127 | .force_undefined_symbols_len = c.force_undefined_symbols.entries.len != 0, | | |
| 128 | | | |
| 129 | .verbose_link = c.verbose_link, | | |
| 130 | .verbose_cc = c.verbose_cc, | | |
| 131 | .rdynamic = c.rdynamic, | | |
| 132 | .import_memory = c.import_memory, | | |
| 133 | .export_memory = c.export_memory, | | |
| 134 | .import_symbols = c.import_symbols, | | |
| 135 | .import_table = c.import_table, | | |
| 136 | .export_table = c.export_table, | | |
| 137 | .growable_table = c.growable_table, | | |
| 138 | .shared_memory = c.shared_memory, | | |
| 139 | .link_eh_frame_hdr = c.link_eh_frame_hdr, | | |
| 140 | .link_emit_relocs = c.link_emit_relocs, | | |
| 141 | .link_function_sections = c.link_function_sections, | | |
| 142 | .link_data_sections = c.link_data_sections, | | |
| 143 | .linker_dynamicbase = c.linker_dynamicbase, | | |
| 144 | .link_z_notext = c.link_z_notext, | | |
| 145 | .link_z_relro = c.link_z_relro, | | |
| 146 | .link_z_lazy = c.link_z_lazy, | | |
| 147 | .link_z_defs = c.link_z_defs, | | |
| 148 | .headerpad_max_install_names = c.headerpad_max_install_names, | | |
| 149 | .dead_strip_dylibs = c.dead_strip_dylibs, | | |
| 150 | .force_load_objc = c.force_load_objc, | | |
| 151 | .discard_local_symbols = c.discard_local_symbols, | | |
| 152 | .mingw_unicode_entry_point = c.mingw_unicode_entry_point, | | |
| 153 | }, | | |
| 154 | .flags2 = .{ | | |
| 155 | .pie = .init(c.pie), | | |
| 156 | .formatted_panics = .init(c.formatted_panics), | | |
| 157 | .bundle_compiler_rt = .init(c.bundle_compiler_rt), | | |
| 158 | .bundle_ubsan_rt = .init(c.bundle_ubsan_rt), | | |
| 159 | .each_lib_rpath = .init(c.each_lib_rpath), | | |
| 160 | .link_gc_sections = .init(c.link_gc_sections), | | |
| 161 | .linker_allow_shlib_undefined = .init(c.linker_allow_shlib_undefined), | | |
| 162 | .linker_allow_undefined_version = .init(c.linker_allow_undefined_version), | | |
| 163 | .linker_enable_new_dtags = .init(c.linker_enable_new_dtags), | | |
| 164 | .dll_export_fns = .init(c.dll_export_fns), | | |
| 165 | .use_llvm = .init(c.use_llvm), | | |
| 166 | .use_lld = .init(c.use_lld), | | |
| 167 | .use_new_linker = .init(c.use_new_linker), | | |
| 168 | .allow_so_scripts = .init(c.allow_so_scripts), | | |
| 169 | .sanitize_coverage_trace_pc_guard = .init(c.sanitize_coverage_trace_pc_guard), | | |
| 170 | .linkage = .init(c.linkage), | | |
| 171 | }, | | |
| 172 | .flags3 = .{ | | |
| 173 | .version = c.version != null, | | |
| 174 | .compress_debug_sections = c.compress_debug_sections, | | |
| 175 | .initial_memory = c.initial_memory != null, | | |
| 176 | .max_memory = c.max_memory != null, | | |
| 177 | .kind = c.kind, | | |
| 178 | .global_base = c.global_base != null, | | |
| 179 | .test_runner = if (c.test_runner) |tr| switch (tr.mode) { | | |
| 180 | .simple => .simple, | | |
| 181 | .server => .server, | | |
| 182 | } else .default, | | |
| 183 | .wasi_exec_model = .init(c.wasi_exec_model), | | |
| 184 | .win32_manifest = c.win32_manifest != null, | | |
| 185 | .win32_module_definition = c.win32_module_definition != null, | | |
| 186 | .zig_lib_dir = c.zig_lib_dir != null, | | |
| 187 | .rc_includes = c.rc_includes, | | |
| 188 | .image_base = c.image_base != null, | | |
| 189 | .build_id = .init(c.build_id), | | |
| 190 | .entry = switch (c.entry) { | | |
| 191 | .default => .default, | | |
| 192 | .disabled => .disabled, | | |
| 193 | .enabled => .enabled, | | |
| 194 | .symbol_name => .symbol_name, | | |
| 195 | }, | 108 | }, |
| 196 | .lto = .init(c.lto), | 109 | .source = try s.addLazyPath(directory.source), |
| 197 | .subsystem = .init(c.subsystem), | 110 | .dest_sub_path = try wc.addString(directory.dest_rel_path), |
| 198 | }, | 111 | .exclude_extensions = .{ .slice = try s.initStringList(directory.options.exclude_extensions) }, |
| 199 | .flags4 = .{ | 112 | .include_extensions = .{ .slice = try s.initStringList(include_extensions) }, |
| 200 | .libc_file = c.libc_file != null, | 113 | }); |
| 201 | .link_z_common_page_size = c.link_z_common_page_size != null, | 114 | }, |
| 202 | .link_z_max_page_size = c.link_z_max_page_size != null, | 115 | }; |
| 203 | .pagezero_size = c.pagezero_size != null, | 116 | |
| 204 | .stack_size = c.stack_size != null, | 117 | break :e try wc.addExtraErased(Configuration.Step.Compile, .{ |
| 205 | .headerpad_size = c.headerpad_size != null, | 118 | .flags = .{ |
| 206 | .error_limit = c.error_limit != null, | 119 | .filters_len = c.filters.len != 0, |
| 207 | .install_name = c.install_name != null, | 120 | .installed_headers_len = installed_headers.len != 0, |
| 208 | .entitlements = c.entitlements != null, | 121 | .force_undefined_symbols_len = c.force_undefined_symbols.entries.len != 0, |
| 209 | .expect_errors = if (c.expect_errors) |x| switch (x) { | 122 | |
| 210 | .contains => .contains, | 123 | .verbose_link = c.verbose_link, |
| 211 | .exact => .exact, | 124 | .verbose_cc = c.verbose_cc, |
| 212 | .starts_with => .starts_with, | 125 | .rdynamic = c.rdynamic, |
| 213 | .stderr_contains => .stderr_contains, | 126 | .import_memory = c.import_memory, |
| 214 | } else .none, | 127 | .export_memory = c.export_memory, |
| 215 | .linker_script = c.linker_script != null, | 128 | .import_symbols = c.import_symbols, |
| 216 | .version_script = c.version_script != null, | 129 | .import_table = c.import_table, |
| 217 | .emit_directory = c.emit_directory != .none, | 130 | .export_table = c.export_table, |
| 218 | .generated_docs = c.generated_docs != .none, | 131 | .growable_table = c.growable_table, |
| 219 | .generated_asm = c.generated_asm != .none, | 132 | .shared_memory = c.shared_memory, |
| 220 | .generated_bin = c.generated_bin != .none, | 133 | .link_eh_frame_hdr = c.link_eh_frame_hdr, |
| 221 | .generated_pdb = c.generated_pdb != .none, | 134 | .link_emit_relocs = c.link_emit_relocs, |
| 222 | .generated_implib = c.generated_implib != .none, | 135 | .link_function_sections = c.link_function_sections, |
| 223 | .generated_llvm_bc = c.generated_llvm_bc != .none, | 136 | .link_data_sections = c.link_data_sections, |
| 224 | .generated_llvm_ir = c.generated_llvm_ir != .none, | 137 | .linker_dynamicbase = c.linker_dynamicbase, |
| 225 | .generated_h = c.generated_h != .none, | 138 | .link_z_notext = c.link_z_notext, |
| 226 | .incremental = .init(c.incremental), | 139 | .link_z_relro = c.link_z_relro, |
| | 140 | .link_z_lazy = c.link_z_lazy, |
| | 141 | .link_z_defs = c.link_z_defs, |
| | 142 | .headerpad_max_install_names = c.headerpad_max_install_names, |
| | 143 | .dead_strip_dylibs = c.dead_strip_dylibs, |
| | 144 | .force_load_objc = c.force_load_objc, |
| | 145 | .discard_local_symbols = c.discard_local_symbols, |
| | 146 | .mingw_unicode_entry_point = c.mingw_unicode_entry_point, |
| | 147 | }, |
| | 148 | .flags2 = .{ |
| | 149 | .pie = .init(c.pie), |
| | 150 | .formatted_panics = .init(c.formatted_panics), |
| | 151 | .bundle_compiler_rt = .init(c.bundle_compiler_rt), |
| | 152 | .bundle_ubsan_rt = .init(c.bundle_ubsan_rt), |
| | 153 | .each_lib_rpath = .init(c.each_lib_rpath), |
| | 154 | .link_gc_sections = .init(c.link_gc_sections), |
| | 155 | .linker_allow_shlib_undefined = .init(c.linker_allow_shlib_undefined), |
| | 156 | .linker_allow_undefined_version = .init(c.linker_allow_undefined_version), |
| | 157 | .linker_enable_new_dtags = .init(c.linker_enable_new_dtags), |
| | 158 | .dll_export_fns = .init(c.dll_export_fns), |
| | 159 | .use_llvm = .init(c.use_llvm), |
| | 160 | .use_lld = .init(c.use_lld), |
| | 161 | .use_new_linker = .init(c.use_new_linker), |
| | 162 | .allow_so_scripts = .init(c.allow_so_scripts), |
| | 163 | .sanitize_coverage_trace_pc_guard = .init(c.sanitize_coverage_trace_pc_guard), |
| | 164 | .linkage = .init(c.linkage), |
| | 165 | }, |
| | 166 | .flags3 = .{ |
| | 167 | .version = c.version != null, |
| | 168 | .compress_debug_sections = c.compress_debug_sections, |
| | 169 | .initial_memory = c.initial_memory != null, |
| | 170 | .max_memory = c.max_memory != null, |
| | 171 | .kind = c.kind, |
| | 172 | .global_base = c.global_base != null, |
| | 173 | .test_runner = if (c.test_runner) |tr| switch (tr.mode) { |
| | 174 | .simple => .simple, |
| | 175 | .server => .server, |
| | 176 | } else .default, |
| | 177 | .wasi_exec_model = .init(c.wasi_exec_model), |
| | 178 | .win32_manifest = c.win32_manifest != null, |
| | 179 | .win32_module_definition = c.win32_module_definition != null, |
| | 180 | .zig_lib_dir = c.zig_lib_dir != null, |
| | 181 | .rc_includes = c.rc_includes, |
| | 182 | .image_base = c.image_base != null, |
| | 183 | .build_id = .init(c.build_id), |
| | 184 | .entry = switch (c.entry) { |
| | 185 | .default => .default, |
| | 186 | .disabled => .disabled, |
| | 187 | .enabled => .enabled, |
| | 188 | .symbol_name => .symbol_name, |
| 227 | }, | 189 | }, |
| 228 | .root_module = try s.addModule(c.root_module), | 190 | .lto = .init(c.lto), |
| 229 | .root_name = try wc.addString(c.name), | 191 | .subsystem = .init(c.subsystem), |
| 230 | .linker_script = .{ .value = try s.addOptionalLazyPath(c.linker_script) }, | 192 | }, |
| 231 | .version_script = .{ .value = try s.addOptionalLazyPath(c.version_script) }, | 193 | .flags4 = .{ |
| 232 | .zig_lib_dir = .{ .value = try s.addOptionalLazyPath(c.zig_lib_dir) }, | 194 | .libc_file = c.libc_file != null, |
| 233 | .libc_file = .{ .value = try s.addOptionalLazyPath(c.libc_file) }, | 195 | .link_z_common_page_size = c.link_z_common_page_size != null, |
| 234 | .win32_manifest = .{ .value = try s.addOptionalLazyPath(c.win32_manifest) }, | 196 | .link_z_max_page_size = c.link_z_max_page_size != null, |
| 235 | .win32_module_definition = .{ .value = try s.addOptionalLazyPath(c.win32_module_definition) }, | 197 | .pagezero_size = c.pagezero_size != null, |
| 236 | .entitlements = .{ .value = try s.addOptionalLazyPath(c.entitlements) }, | 198 | .stack_size = c.stack_size != null, |
| 237 | .version = .{ .value = try s.addOptionalSemVer(c.version) }, | 199 | .headerpad_size = c.headerpad_size != null, |
| 238 | .install_name = .{ .value = try s.addOptionalString(c.install_name) }, | 200 | .error_limit = c.error_limit != null, |
| 239 | .initial_memory = .{ .value = c.initial_memory }, | 201 | .install_name = c.install_name != null, |
| 240 | .max_memory = .{ .value = c.max_memory }, | 202 | .entitlements = c.entitlements != null, |
| 241 | .global_base = .{ .value = c.global_base }, | 203 | .expect_errors = if (c.expect_errors) |x| switch (x) { |
| 242 | .image_base = .{ .value = c.image_base }, | 204 | .contains => .contains, |
| 243 | .link_z_common_page_size = .{ .value = c.link_z_common_page_size }, | 205 | .exact => .exact, |
| 244 | .link_z_max_page_size = .{ .value = c.link_z_max_page_size }, | 206 | .starts_with => .starts_with, |
| 245 | .pagezero_size = .{ .value = c.pagezero_size }, | 207 | .stderr_contains => .stderr_contains, |
| 246 | .stack_size = .{ .value = c.stack_size }, | 208 | } else .none, |
| 247 | .headerpad_size = .{ .value = c.headerpad_size }, | 209 | .linker_script = c.linker_script != null, |
| 248 | .error_limit = .{ .value = c.error_limit }, | 210 | .version_script = c.version_script != null, |
| 249 | .entry = .{ .value = switch (c.entry) { | 211 | .emit_directory = c.emit_directory != .none, |
| 250 | .symbol_name => |name| try wc.addString(name), | 212 | .generated_docs = c.generated_docs != .none, |
| 251 | .default, .disabled, .enabled => null, | 213 | .generated_asm = c.generated_asm != .none, |
| 252 | } }, | 214 | .generated_bin = c.generated_bin != .none, |
| 253 | .build_id = .{ .value = if (c.build_id) |id| switch (id) { | 215 | .generated_pdb = c.generated_pdb != .none, |
| 254 | .hexstring => |*hexstring| try wc.addString(hexstring.toSlice()), | 216 | .generated_implib = c.generated_implib != .none, |
| 255 | .none, .fast, .uuid, .sha1, .md5 => null, | 217 | .generated_llvm_bc = c.generated_llvm_bc != .none, |
| 256 | } else null }, | 218 | .generated_llvm_ir = c.generated_llvm_ir != .none, |
| 257 | .filters = .{ .slice = try s.initStringList(c.filters) }, | 219 | .generated_h = c.generated_h != .none, |
| 258 | .installed_headers = .initErased(installed_headers), | 220 | .incremental = .init(c.incremental), |
| 259 | .force_undefined_symbols = .{ .slice = try s.initStringList(c.force_undefined_symbols.keys()) }, | 221 | }, |
| 260 | .expect_errors = .{ .u = if (c.expect_errors) |x| switch (x) { | 222 | .root_module = try s.addModule(c.root_module), |
| 261 | .contains => |slice| .{ .contains = try wc.addString(slice) }, | 223 | .root_name = try wc.addString(c.name), |
| 262 | .exact => |exact| .{ .exact = .{ .slice = try s.initStringList(exact) } }, | 224 | .linker_script = .{ .value = try s.addOptionalLazyPath(c.linker_script) }, |
| 263 | .starts_with => |slice| .{ .starts_with = try wc.addString(slice) }, | 225 | .version_script = .{ .value = try s.addOptionalLazyPath(c.version_script) }, |
| 264 | .stderr_contains => |slice| .{ .stderr_contains = try wc.addString(slice) }, | 226 | .zig_lib_dir = .{ .value = try s.addOptionalLazyPath(c.zig_lib_dir) }, |
| 265 | } else .none }, | 227 | .libc_file = .{ .value = try s.addOptionalLazyPath(c.libc_file) }, |
| 266 | .test_runner = .{ .u = if (c.test_runner) |tr| switch (tr.mode) { | 228 | .win32_manifest = .{ .value = try s.addOptionalLazyPath(c.win32_manifest) }, |
| 267 | .simple => .{ .simple = try s.addLazyPath(tr.path) }, | 229 | .win32_module_definition = .{ .value = try s.addOptionalLazyPath(c.win32_module_definition) }, |
| 268 | .server => .{ .server = try s.addLazyPath(tr.path) }, | 230 | .entitlements = .{ .value = try s.addOptionalLazyPath(c.entitlements) }, |
| 269 | } else .default }, | 231 | .version = .{ .value = try s.addOptionalSemVer(c.version) }, |
| 270 | | 232 | .install_name = .{ .value = try s.addOptionalString(c.install_name) }, |
| 271 | .emit_directory = .{ .value = c.emit_directory.unwrap() }, | 233 | .initial_memory = .{ .value = c.initial_memory }, |
| 272 | .generated_docs = .{ .value = c.generated_docs.unwrap() }, | 234 | .max_memory = .{ .value = c.max_memory }, |
| 273 | .generated_asm = .{ .value = c.generated_asm.unwrap() }, | 235 | .global_base = .{ .value = c.global_base }, |
| 274 | .generated_bin = .{ .value = c.generated_bin.unwrap() }, | 236 | .image_base = .{ .value = c.image_base }, |
| 275 | .generated_pdb = .{ .value = c.generated_pdb.unwrap() }, | 237 | .link_z_common_page_size = .{ .value = c.link_z_common_page_size }, |
| 276 | .generated_implib = .{ .value = c.generated_implib.unwrap() }, | 238 | .link_z_max_page_size = .{ .value = c.link_z_max_page_size }, |
| 277 | .generated_llvm_bc = .{ .value = c.generated_llvm_bc.unwrap() }, | 239 | .pagezero_size = .{ .value = c.pagezero_size }, |
| 278 | .generated_llvm_ir = .{ .value = c.generated_llvm_ir.unwrap() }, | 240 | .stack_size = .{ .value = c.stack_size }, |
| 279 | .generated_h = .{ .value = c.generated_h.unwrap() }, | 241 | .headerpad_size = .{ .value = c.headerpad_size }, |
| 280 | }); | 242 | .error_limit = .{ .value = c.error_limit }, |
| 281 | }, | 243 | .entry = .{ .value = switch (c.entry) { |
| 282 | .install_artifact => e: { | 244 | .symbol_name => |name| try wc.addString(name), |
| 283 | const ia: *Step.InstallArtifact = @fieldParentPtr("step", step); | 245 | .default, .disabled, .enabled => null, |
| 284 | break :e try wc.addExtraErased(Configuration.Step.InstallArtifact, .{ | 246 | } }, |
| 285 | .flags = .{ | 247 | .build_id = .{ .value = if (c.build_id) |id| switch (id) { |
| 286 | .dylib_symlinks = ia.dylib_symlinks, | 248 | .hexstring => |*hexstring| try wc.addString(hexstring.toSlice()), |
| 287 | .bin_dir = ia.dest_dir != null, | 249 | .none, .fast, .uuid, .sha1, .md5 => null, |
| 288 | .implib_dir = ia.implib_dir != null, | 250 | } else null }, |
| 289 | .pdb_dir = ia.pdb_dir != null, | 251 | .filters = .{ .slice = try s.initStringList(c.filters) }, |
| 290 | .h_dir = ia.h_dir != null, | 252 | .installed_headers = .initErased(installed_headers), |
| 291 | .bin_sub_path = ia.dest_sub_path != null, | 253 | .force_undefined_symbols = .{ .slice = try s.initStringList(c.force_undefined_symbols.keys()) }, |
| 292 | }, | 254 | .expect_errors = .{ .u = if (c.expect_errors) |x| switch (x) { |
| 293 | .bin_dir = .{ .value = try addInstallDirDefaultNull(wc, ia.dest_dir) }, | 255 | .contains => |slice| .{ .contains = try wc.addString(slice) }, |
| 294 | .implib_dir = .{ .value = try addInstallDirDefaultNull(wc, ia.implib_dir) }, | 256 | .exact => |exact| .{ .exact = .{ .slice = try s.initStringList(exact) } }, |
| 295 | .pdb_dir = .{ .value = try addInstallDirDefaultNull(wc, ia.pdb_dir) }, | 257 | .starts_with => |slice| .{ .starts_with = try wc.addString(slice) }, |
| 296 | .h_dir = .{ .value = try addInstallDirDefaultNull(wc, ia.h_dir) }, | 258 | .stderr_contains => |slice| .{ .stderr_contains = try wc.addString(slice) }, |
| 297 | .bin_sub_path = .{ .value = try s.addOptionalString(ia.dest_sub_path) }, | 259 | } else .none }, |
| 298 | }); | 260 | .test_runner = .{ .u = if (c.test_runner) |tr| switch (tr.mode) { |
| 299 | }, | 261 | .simple => .{ .simple = try s.addLazyPath(tr.path) }, |
| 300 | .install_file => e: { | 262 | .server => .{ .server = try s.addLazyPath(tr.path) }, |
| 301 | const sif: *Step.InstallFile = @fieldParentPtr("step", step); | 263 | } else .default }, |
| 302 | break :e try wc.addExtraErased(Configuration.Step.InstallFile, .{ | 264 | |
| 303 | .source = try s.addLazyPath(sif.source), | 265 | .emit_directory = .{ .value = c.emit_directory.unwrap() }, |
| 304 | .dest_dir = try addInstallDir(wc, sif.dir), | 266 | .generated_docs = .{ .value = c.generated_docs.unwrap() }, |
| 305 | .dest_sub_path = try wc.addString(sif.dest_rel_path), | 267 | .generated_asm = .{ .value = c.generated_asm.unwrap() }, |
| 306 | }); | 268 | .generated_bin = .{ .value = c.generated_bin.unwrap() }, |
| 307 | }, | 269 | .generated_pdb = .{ .value = c.generated_pdb.unwrap() }, |
| 308 | .install_dir => e: { | 270 | .generated_implib = .{ .value = c.generated_implib.unwrap() }, |
| 309 | const sid: *Step.InstallDir = @fieldParentPtr("step", step); | 271 | .generated_llvm_bc = .{ .value = c.generated_llvm_bc.unwrap() }, |
| 310 | const dest_sub_path: ?[]const u8 = if (sid.options.install_subdir.len != 0) | 272 | .generated_llvm_ir = .{ .value = c.generated_llvm_ir.unwrap() }, |
| 311 | sid.options.install_subdir | 273 | .generated_h = .{ .value = c.generated_h.unwrap() }, |
| 312 | else | 274 | }); |
| 313 | null; | 275 | }, |
| 314 | const include_extensions = sid.options.include_extensions orelse &.{}; | 276 | .install_artifact => e: { |
| 315 | break :e try wc.addExtraErased(Configuration.Step.InstallDir, .{ | 277 | const ia: *Step.InstallArtifact = @fieldParentPtr("step", step); |
| 316 | .flags = .{ | 278 | break :e try wc.addExtraErased(Configuration.Step.InstallArtifact, .{ |
| 317 | .dest_sub_path = dest_sub_path != null, | 279 | .flags = .{ |
| 318 | .exclude_extensions = sid.options.exclude_extensions.len != 0, | 280 | .dylib_symlinks = ia.dylib_symlinks, |
| 319 | .include_extensions = include_extensions.len != 0, | 281 | .bin_dir = ia.dest_dir != null, |
| 320 | .include_extensions_active = sid.options.include_extensions != null, | 282 | .implib_dir = ia.implib_dir != null, |
| 321 | .blank_extensions = sid.options.blank_extensions.len != 0, | 283 | .pdb_dir = ia.pdb_dir != null, |
| 322 | }, | 284 | .h_dir = ia.h_dir != null, |
| 323 | .source_dir = try s.addLazyPath(sid.options.source_dir), | 285 | .bin_sub_path = ia.dest_sub_path != null, |
| 324 | .dest_dir = try addInstallDir(wc, sid.options.install_dir), | 286 | }, |
| 325 | .dest_sub_path = .{ .value = try s.addOptionalString(dest_sub_path) }, | 287 | .bin_dir = .{ .value = try addInstallDirDefaultNull(wc, ia.dest_dir) }, |
| 326 | .exclude_extensions = .{ .slice = try s.initStringList(sid.options.exclude_extensions) }, | 288 | .implib_dir = .{ .value = try addInstallDirDefaultNull(wc, ia.implib_dir) }, |
| 327 | .include_extensions = .{ .slice = try s.initStringList(include_extensions) }, | 289 | .pdb_dir = .{ .value = try addInstallDirDefaultNull(wc, ia.pdb_dir) }, |
| 328 | .blank_extensions = .{ .slice = try s.initStringList(sid.options.blank_extensions) }, | 290 | .h_dir = .{ .value = try addInstallDirDefaultNull(wc, ia.h_dir) }, |
| 329 | }); | 291 | .bin_sub_path = .{ .value = try s.addOptionalString(ia.dest_sub_path) }, |
| 330 | }, | 292 | }); |
| 331 | .fail => e: { | 293 | }, |
| 332 | const sf: *Step.Fail = @fieldParentPtr("step", step); | 294 | .install_file => e: { |
| 333 | break :e try wc.addExtraErased(Configuration.Step.Fail, .{ | 295 | const sif: *Step.InstallFile = @fieldParentPtr("step", step); |
| 334 | .msg = sf.error_msg, | 296 | break :e try wc.addExtraErased(Configuration.Step.InstallFile, .{ |
| 335 | }); | 297 | .source = try s.addLazyPath(sif.source), |
| 336 | }, | 298 | .dest_dir = try addInstallDir(wc, sif.dir), |
| 337 | .find_program => e: { | 299 | .dest_sub_path = try wc.addString(sif.dest_rel_path), |
| 338 | const fp: *Step.FindProgram = @fieldParentPtr("step", step); | 300 | }); |
| 339 | break :e try wc.addExtraErased(Configuration.Step.FindProgram, .{ | 301 | }, |
| 340 | .names = fp.names, | 302 | .install_dir => e: { |
| 341 | .found_path = fp.found_path, | 303 | const sid: *Step.InstallDir = @fieldParentPtr("step", step); |
| 342 | }); | 304 | const dest_sub_path: ?[]const u8 = if (sid.options.install_subdir.len != 0) |
| 343 | }, | 305 | sid.options.install_subdir |
| 344 | .fmt => e: { | 306 | else |
| 345 | const sf: *Step.Fmt = @fieldParentPtr("step", step); | 307 | null; |
| 346 | break :e try wc.addExtraErased(Configuration.Step.Fmt, .{ | 308 | const include_extensions = sid.options.include_extensions orelse &.{}; |
| 347 | .flags = .{ | 309 | break :e try wc.addExtraErased(Configuration.Step.InstallDir, .{ |
| 348 | .paths = sf.paths.len != 0, | 310 | .flags = .{ |
| 349 | .exclude_paths = sf.exclude_paths.len != 0, | 311 | .dest_sub_path = dest_sub_path != null, |
| 350 | .check = sf.check, | 312 | .exclude_extensions = sid.options.exclude_extensions.len != 0, |
| | 313 | .include_extensions = include_extensions.len != 0, |
| | 314 | .include_extensions_active = sid.options.include_extensions != null, |
| | 315 | .blank_extensions = sid.options.blank_extensions.len != 0, |
| | 316 | }, |
| | 317 | .source_dir = try s.addLazyPath(sid.options.source_dir), |
| | 318 | .dest_dir = try addInstallDir(wc, sid.options.install_dir), |
| | 319 | .dest_sub_path = .{ .value = try s.addOptionalString(dest_sub_path) }, |
| | 320 | .exclude_extensions = .{ .slice = try s.initStringList(sid.options.exclude_extensions) }, |
| | 321 | .include_extensions = .{ .slice = try s.initStringList(include_extensions) }, |
| | 322 | .blank_extensions = .{ .slice = try s.initStringList(sid.options.blank_extensions) }, |
| | 323 | }); |
| | 324 | }, |
| | 325 | .fail => e: { |
| | 326 | const sf: *Step.Fail = @fieldParentPtr("step", step); |
| | 327 | break :e try wc.addExtraErased(Configuration.Step.Fail, .{ |
| | 328 | .msg = sf.error_msg, |
| | 329 | }); |
| | 330 | }, |
| | 331 | .find_program => e: { |
| | 332 | const fp: *Step.FindProgram = @fieldParentPtr("step", step); |
| | 333 | break :e try wc.addExtraErased(Configuration.Step.FindProgram, .{ |
| | 334 | .names = fp.names, |
| | 335 | .found_path = fp.found_path, |
| | 336 | }); |
| | 337 | }, |
| | 338 | .fmt => e: { |
| | 339 | const sf: *Step.Fmt = @fieldParentPtr("step", step); |
| | 340 | break :e try wc.addExtraErased(Configuration.Step.Fmt, .{ |
| | 341 | .flags = .{ |
| | 342 | .paths = sf.paths.len != 0, |
| | 343 | .exclude_paths = sf.exclude_paths.len != 0, |
| | 344 | .check = sf.check, |
| | 345 | }, |
| | 346 | .paths = .{ .slice = try s.initLazyPathList(sf.paths) }, |
| | 347 | .exclude_paths = .{ .slice = try s.initLazyPathList(sf.exclude_paths) }, |
| | 348 | }); |
| | 349 | }, |
| | 350 | .translate_c => e: { |
| | 351 | const tc: *Step.TranslateC = @fieldParentPtr("step", step); |
| | 352 | |
| | 353 | const system_libs = try arena.alloc(Configuration.SystemLib.Index, tc.system_libs.items.len); |
| | 354 | for (system_libs, tc.system_libs.items) |*dest, *src| dest.* = try s.addSystemLib(src); |
| | 355 | |
| | 356 | break :e try wc.addExtraErased(Configuration.Step.TranslateC, .{ |
| | 357 | .flags = .{ |
| | 358 | .include_dirs = tc.include_dirs.items.len != 0, |
| | 359 | .system_libs = system_libs.len != 0, |
| | 360 | .c_macros = tc.c_macros.items.len != 0, |
| | 361 | .link_libc = tc.link_libc, |
| | 362 | .optimize = .init(tc.optimize), |
| | 363 | }, |
| | 364 | .src_path = try s.addLazyPath(tc.source), |
| | 365 | .output_file = tc.output_file, |
| | 366 | .include_dirs = .init(try s.initIncludeDirList(tc.include_dirs.items)), |
| | 367 | .system_libs = .{ .slice = system_libs }, |
| | 368 | .c_macros = .{ .slice = tc.c_macros.items }, |
| | 369 | .target = try addOptionalResolvedTarget(wc, tc.target), |
| | 370 | }); |
| | 371 | }, |
| | 372 | .write_file => e: { |
| | 373 | const wf: *Step.WriteFile = @fieldParentPtr("step", step); |
| | 374 | |
| | 375 | const directories = try arena.alloc( |
| | 376 | Configuration.Step.WriteFile.Directory, |
| | 377 | wf.directories.items.len, |
| | 378 | ); |
| | 379 | for (directories, wf.directories.items) |*dest, src| dest.* = .{ |
| | 380 | .sub_path = src.sub_path, |
| | 381 | .src_path = try s.addLazyPath(src.src_path), |
| | 382 | .exclude_extensions = src.exclude_extensions, |
| | 383 | .include_extensions = src.include_extensions, |
| | 384 | }; |
| | 385 | |
| | 386 | break :e try wc.addExtraErased(Configuration.Step.WriteFile, .{ |
| | 387 | .flags = .{ |
| | 388 | .embeds = wf.embeds.items.len != 0, |
| | 389 | .copies = wf.copies.items.len != 0, |
| | 390 | .directories = directories.len != 0, |
| | 391 | .mode = switch (wf.mode) { |
| | 392 | .whole_cached => .whole_cached, |
| | 393 | .tmp => .tmp, |
| | 394 | .mutate => .mutate, |
| 351 | }, | 395 | }, |
| 352 | .paths = .{ .slice = try s.initLazyPathList(sf.paths) }, | 396 | }, |
| 353 | .exclude_paths = .{ .slice = try s.initLazyPathList(sf.exclude_paths) }, | 397 | .generated_directory = wf.generated_directory, |
| 354 | }); | 398 | .embeds = .{ .slice = wf.embeds.items }, |
| 355 | }, | 399 | .copies = .{ .slice = try s.initCopyList(wf.copies.items) }, |
| 356 | .translate_c => e: { | 400 | .directories = .{ .slice = directories }, |
| 357 | const tc: *Step.TranslateC = @fieldParentPtr("step", step); | 401 | .mutate_path = .{ .value = switch (wf.mode) { |
| 358 | | 402 | .mutate => |lp| try s.addLazyPath(lp), |
| 359 | const system_libs = try arena.alloc(Configuration.SystemLib.Index, tc.system_libs.items.len); | 403 | .whole_cached, .tmp => null, |
| 360 | for (system_libs, tc.system_libs.items) |*dest, *src| dest.* = try s.addSystemLib(src); | 404 | } }, |
| 361 | | 405 | }); |
| 362 | break :e try wc.addExtraErased(Configuration.Step.TranslateC, .{ | 406 | }, |
| 363 | .flags = .{ | 407 | .update_source_files => e: { |
| 364 | .include_dirs = tc.include_dirs.items.len != 0, | 408 | const usf: *Step.UpdateSourceFiles = @fieldParentPtr("step", step); |
| 365 | .system_libs = system_libs.len != 0, | 409 | break :e try wc.addExtraErased(Configuration.Step.UpdateSourceFiles, .{ |
| 366 | .c_macros = tc.c_macros.items.len != 0, | 410 | .flags = .{ |
| 367 | .link_libc = tc.link_libc, | 411 | .embeds = usf.embeds.items.len != 0, |
| 368 | .optimize = .init(tc.optimize), | 412 | .copies = usf.copies.items.len != 0, |
| | 413 | }, |
| | 414 | .embeds = .{ .slice = usf.embeds.items }, |
| | 415 | .copies = .{ .slice = try s.initCopyList(usf.copies.items) }, |
| | 416 | }); |
| | 417 | }, |
| | 418 | .run => e: { |
| | 419 | const run: *Step.Run = @fieldParentPtr("step", step); |
| | 420 | var expect_stderr_exact: ?Configuration.Bytes = null; |
| | 421 | var expect_stdout_exact: ?Configuration.Bytes = null; |
| | 422 | var expect_stderr_match: std.ArrayList(Configuration.Bytes) = .empty; |
| | 423 | var expect_stdout_match: std.ArrayList(Configuration.Bytes) = .empty; |
| | 424 | var expect_term: ?struct { |
| | 425 | status: Configuration.Step.Run.ExpectTermStatus, |
| | 426 | value: u32, |
| | 427 | } = null; |
| | 428 | var expect_stderr_snapshot: ?Configuration.LazyPath.Index = null; |
| | 429 | var expect_stdout_snapshot: ?Configuration.LazyPath.Index = null; |
| | 430 | switch (run.stdio) { |
| | 431 | .check => |checks| for (checks.items) |check| switch (check) { |
| | 432 | .expect_stderr_exact => |bytes| expect_stderr_exact = try wc.addBytes(bytes), |
| | 433 | .expect_stdout_exact => |bytes| expect_stdout_exact = try wc.addBytes(bytes), |
| | 434 | .expect_stderr_match => |bytes| { |
| | 435 | try expect_stderr_match.append(arena, try wc.addBytes(bytes)); |
| 369 | }, | 436 | }, |
| 370 | .src_path = try s.addLazyPath(tc.source), | 437 | .expect_stdout_match => |bytes| { |
| 371 | .output_file = tc.output_file, | 438 | try expect_stdout_match.append(arena, try wc.addBytes(bytes)); |
| 372 | .include_dirs = .init(try s.initIncludeDirList(tc.include_dirs.items)), | | |
| 373 | .system_libs = .{ .slice = system_libs }, | | |
| 374 | .c_macros = .{ .slice = tc.c_macros.items }, | | |
| 375 | .target = try addOptionalResolvedTarget(wc, tc.target), | | |
| 376 | }); | | |
| 377 | }, | | |
| 378 | .write_file => e: { | | |
| 379 | const wf: *Step.WriteFile = @fieldParentPtr("step", step); | | |
| 380 | | | |
| 381 | const directories = try arena.alloc( | | |
| 382 | Configuration.Step.WriteFile.Directory, | | |
| 383 | wf.directories.items.len, | | |
| 384 | ); | | |
| 385 | for (directories, wf.directories.items) |*dest, src| dest.* = .{ | | |
| 386 | .sub_path = src.sub_path, | | |
| 387 | .src_path = try s.addLazyPath(src.src_path), | | |
| 388 | .exclude_extensions = src.exclude_extensions, | | |
| 389 | .include_extensions = src.include_extensions, | | |
| 390 | }; | | |
| 391 | | | |
| 392 | break :e try wc.addExtraErased(Configuration.Step.WriteFile, .{ | | |
| 393 | .flags = .{ | | |
| 394 | .embeds = wf.embeds.items.len != 0, | | |
| 395 | .copies = wf.copies.items.len != 0, | | |
| 396 | .directories = directories.len != 0, | | |
| 397 | .mode = switch (wf.mode) { | | |
| 398 | .whole_cached => .whole_cached, | | |
| 399 | .tmp => .tmp, | | |
| 400 | .mutate => .mutate, | | |
| 401 | }, | | |
| 402 | }, | 439 | }, |
| 403 | .generated_directory = wf.generated_directory, | 440 | .expect_term => |t| expect_term = switch (t) { |
| 404 | .embeds = .{ .slice = wf.embeds.items }, | 441 | .exited => |x| .{ .status = .exited, .value = x }, |
| 405 | .copies = .{ .slice = try s.initCopyList(wf.copies.items) }, | 442 | .signal => |x| .{ .status = .signal, .value = @backingInt(x) }, |
| 406 | .directories = .{ .slice = directories }, | 443 | .stopped => |x| .{ .status = .stopped, .value = @backingInt(x) }, |
| 407 | .mutate_path = .{ .value = switch (wf.mode) { | 444 | .unknown => |x| .{ .status = .unknown, .value = x }, |
| 408 | .mutate => |lp| try s.addLazyPath(lp), | | |
| 409 | .whole_cached, .tmp => null, | | |
| 410 | } }, | | |
| 411 | }); | | |
| 412 | }, | | |
| 413 | .update_source_files => e: { | | |
| 414 | const usf: *Step.UpdateSourceFiles = @fieldParentPtr("step", step); | | |
| 415 | break :e try wc.addExtraErased(Configuration.Step.UpdateSourceFiles, .{ | | |
| 416 | .flags = .{ | | |
| 417 | .embeds = usf.embeds.items.len != 0, | | |
| 418 | .copies = usf.copies.items.len != 0, | | |
| 419 | }, | 445 | }, |
| 420 | .embeds = .{ .slice = usf.embeds.items }, | 446 | .expect_stderr_snapshot => |path| expect_stderr_snapshot = try s.addLazyPath(path), |
| 421 | .copies = .{ .slice = try s.initCopyList(usf.copies.items) }, | 447 | .expect_stdout_snapshot => |path| expect_stdout_snapshot = try s.addLazyPath(path), |
| 422 | }); | 448 | }, |
| 423 | }, | 449 | else => {}, |
| 424 | .run => e: { | 450 | } |
| 425 | const run: *Step.Run = @fieldParentPtr("step", step); | 451 | const preopens = try arena.alloc( |
| 426 | var expect_stderr_exact: ?Configuration.Bytes = null; | 452 | Configuration.Step.Run.Preopen, |
| 427 | var expect_stdout_exact: ?Configuration.Bytes = null; | 453 | run.preopens.count(), |
| 428 | var expect_stderr_match: std.ArrayList(Configuration.Bytes) = .empty; | 454 | ); |
| 429 | var expect_stdout_match: std.ArrayList(Configuration.Bytes) = .empty; | 455 | for (preopens, run.preopens.keys(), run.preopens.values()) |*dest, name, path| { |
| 430 | var expect_term: ?struct { | 456 | dest.* = .{ .name = name, .path = try s.addLazyPath(path) }; |
| 431 | status: Configuration.Step.Run.ExpectTermStatus, | 457 | } |
| 432 | value: u32, | 458 | |
| 433 | } = null; | 459 | break :e try wc.addExtraErased(Configuration.Step.Run, .{ |
| 434 | var expect_stderr_snapshot: ?Configuration.LazyPath.Index = null; | 460 | .flags = .{ |
| 435 | var expect_stdout_snapshot: ?Configuration.LazyPath.Index = null; | 461 | .disable_zig_progress = run.disable_zig_progress, |
| 436 | switch (run.stdio) { | 462 | .skip_foreign_checks = run.skip_foreign_checks, |
| 437 | .check => |checks| for (checks.items) |check| switch (check) { | 463 | .failing_to_execute_foreign_is_an_error = run.failing_to_execute_foreign_is_an_error, |
| 438 | .expect_stderr_exact => |bytes| expect_stderr_exact = try wc.addBytes(bytes), | 464 | .has_side_effects = run.has_side_effects, |
| 439 | .expect_stdout_exact => |bytes| expect_stdout_exact = try wc.addBytes(bytes), | 465 | .test_runner_mode = run.test_runner_mode, |
| 440 | .expect_stderr_match => |bytes| { | 466 | .color = run.color, |
| 441 | try expect_stderr_match.append(arena, try wc.addBytes(bytes)); | 467 | .stdio = switch (run.stdio) { |
| 442 | }, | 468 | .infer_from_args => .infer_from_args, |
| 443 | .expect_stdout_match => |bytes| { | 469 | .inherit => .inherit, |
| 444 | try expect_stdout_match.append(arena, try wc.addBytes(bytes)); | 470 | .check => .check, |
| 445 | }, | 471 | .zig_test => .zig_test, |
| 446 | .expect_term => |t| expect_term = switch (t) { | | |
| 447 | .exited => |x| .{ .status = .exited, .value = x }, | | |
| 448 | .signal => |x| .{ .status = .signal, .value = @backingInt(x) }, | | |
| 449 | .stopped => |x| .{ .status = .stopped, .value = @backingInt(x) }, | | |
| 450 | .unknown => |x| .{ .status = .unknown, .value = x }, | | |
| 451 | }, | | |
| 452 | .expect_stderr_snapshot => |path| expect_stderr_snapshot = try s.addLazyPath(path), | | |
| 453 | .expect_stdout_snapshot => |path| expect_stdout_snapshot = try s.addLazyPath(path), | | |
| 454 | }, | 472 | }, |
| 455 | else => {}, | 473 | .stdin = switch (run.stdin) { |
| 456 | } | 474 | .none => .none, |
| 457 | const preopens = try arena.alloc( | 475 | .bytes => .bytes, |
| 458 | Configuration.Step.Run.Preopen, | 476 | .lazy_path => .lazy_path, |
| 459 | run.preopens.count(), | | |
| 460 | ); | | |
| 461 | for (preopens, run.preopens.keys(), run.preopens.values()) |*dest, name, path| { | | |
| 462 | dest.* = .{ .name = name, .path = try s.addLazyPath(path) }; | | |
| 463 | } | | |
| 464 | | | |
| 465 | break :e try wc.addExtraErased(Configuration.Step.Run, .{ | | |
| 466 | .flags = .{ | | |
| 467 | .disable_zig_progress = run.disable_zig_progress, | | |
| 468 | .skip_foreign_checks = run.skip_foreign_checks, | | |
| 469 | .failing_to_execute_foreign_is_an_error = run.failing_to_execute_foreign_is_an_error, | | |
| 470 | .has_side_effects = run.has_side_effects, | | |
| 471 | .test_runner_mode = run.test_runner_mode, | | |
| 472 | .color = run.color, | | |
| 473 | .stdio = switch (run.stdio) { | | |
| 474 | .infer_from_args => .infer_from_args, | | |
| 475 | .inherit => .inherit, | | |
| 476 | .check => .check, | | |
| 477 | .zig_test => .zig_test, | | |
| 478 | }, | | |
| 479 | .stdin = switch (run.stdin) { | | |
| 480 | .none => .none, | | |
| 481 | .bytes => .bytes, | | |
| 482 | .lazy_path => .lazy_path, | | |
| 483 | }, | | |
| 484 | .stdout_trim_whitespace = if (run.captured_stdout) |cs| cs.trim_whitespace else .none, | | |
| 485 | .stderr_trim_whitespace = if (run.captured_stderr) |cs| cs.trim_whitespace else .none, | | |
| 486 | .stdio_limit = run.stdio_limit != .unlimited, | | |
| 487 | .producer = run.producer != null, | | |
| 488 | .cwd = run.cwd != null, | | |
| 489 | .captured_stdout = run.captured_stdout != null, | | |
| 490 | .captured_stderr = run.captured_stderr != null, | | |
| 491 | .environ_map = run.environ_map != null, | | |
| 492 | .preopens = run.preopens.count() > 0, | | |
| 493 | }, | 477 | }, |
| 494 | .flags2 = .{ | 478 | .stdout_trim_whitespace = if (run.captured_stdout) |cs| cs.trim_whitespace else .none, |
| 495 | .expect_stderr_exact = expect_stderr_exact != null, | 479 | .stderr_trim_whitespace = if (run.captured_stderr) |cs| cs.trim_whitespace else .none, |
| 496 | .expect_stdout_exact = expect_stdout_exact != null, | 480 | .stdio_limit = run.stdio_limit != .unlimited, |
| 497 | .expect_stderr_match = expect_stderr_match.items.len != 0, | 481 | .producer = run.producer != null, |
| 498 | .expect_stdout_match = expect_stdout_match.items.len != 0, | 482 | .cwd = run.cwd != null, |
| 499 | .expect_term = expect_term != null, | 483 | .captured_stdout = run.captured_stdout != null, |
| 500 | .expect_term_status = if (expect_term) |t| t.status else .exited, | 484 | .captured_stderr = run.captured_stderr != null, |
| 501 | .expect_stderr_snapshot = expect_stderr_snapshot != null, | 485 | .environ_map = run.environ_map != null, |
| 502 | .expect_stdout_snapshot = expect_stdout_snapshot != null, | 486 | .preopens = run.preopens.count() > 0, |
| | 487 | }, |
| | 488 | .flags2 = .{ |
| | 489 | .expect_stderr_exact = expect_stderr_exact != null, |
| | 490 | .expect_stdout_exact = expect_stdout_exact != null, |
| | 491 | .expect_stderr_match = expect_stderr_match.items.len != 0, |
| | 492 | .expect_stdout_match = expect_stdout_match.items.len != 0, |
| | 493 | .expect_term = expect_term != null, |
| | 494 | .expect_term_status = if (expect_term) |t| t.status else .exited, |
| | 495 | .expect_stderr_snapshot = expect_stderr_snapshot != null, |
| | 496 | .expect_stdout_snapshot = expect_stdout_snapshot != null, |
| | 497 | }, |
| | 498 | .file_inputs = .{ .slice = try s.initLazyPathList(run.file_inputs.items) }, |
| | 499 | .args = .{ .slice = try s.initArgsList(run.argv.items) }, |
| | 500 | .cwd = .{ .value = try s.addOptionalLazyPath(run.cwd) }, |
| | 501 | .preopens = .{ .slice = preopens }, |
| | 502 | .captured_stdout = .{ .value = if (run.captured_stdout) |cs| .{ |
| | 503 | .basename = try wc.addString(cs.basename), |
| | 504 | .generated_file = cs.generated_file, |
| | 505 | } else null }, |
| | 506 | .captured_stderr = .{ .value = if (run.captured_stderr) |cs| .{ |
| | 507 | .basename = try wc.addString(cs.basename), |
| | 508 | .generated_file = cs.generated_file, |
| | 509 | } else null }, |
| | 510 | .environ_map = .{ .value = try s.addEnvironMap(run.environ_map) }, |
| | 511 | .expect_term_value = .{ .value = if (expect_term) |t| t.value else null }, |
| | 512 | .stdio_limit = .{ .value = run.stdio_limit.toInt64() }, |
| | 513 | .producer = .{ .value = if (run.producer) |cs| s.stepIndex(&cs.step) else null }, |
| | 514 | .expect_stderr_exact = .{ .value = if (expect_stderr_exact) |bytes| bytes else null }, |
| | 515 | .expect_stdout_exact = .{ .value = if (expect_stdout_exact) |bytes| bytes else null }, |
| | 516 | .expect_stderr_match = .{ .slice = expect_stderr_match.items }, |
| | 517 | .expect_stdout_match = .{ .slice = expect_stdout_match.items }, |
| | 518 | .expect_stderr_snapshot = .{ .value = expect_stderr_snapshot orelse null }, |
| | 519 | .expect_stdout_snapshot = .{ .value = expect_stdout_snapshot orelse null }, |
| | 520 | .stdin = .{ .u = switch (run.stdin) { |
| | 521 | .none => .none, |
| | 522 | .bytes => |bytes| .{ .bytes = try wc.addBytes(bytes) }, |
| | 523 | .lazy_path => |lp| .{ .lazy_path = try s.addLazyPath(lp) }, |
| | 524 | } }, |
| | 525 | }); |
| | 526 | }, |
| | 527 | .check_file => e: { |
| | 528 | const cf: *Step.CheckFile = @fieldParentPtr("step", step); |
| | 529 | break :e try wc.addExtraErased(Configuration.Step.CheckFile, .{ |
| | 530 | .flags = .{ |
| | 531 | .expected_exact = cf.expected_exact != null, |
| | 532 | .expected_matches = cf.expected_matches.len != 0, |
| | 533 | .max_bytes = cf.max_bytes != null, |
| | 534 | }, |
| | 535 | .file = try s.addLazyPath(cf.file), |
| | 536 | .expected_exact = .{ .value = cf.expected_exact }, |
| | 537 | .expected_matches = .{ .slice = cf.expected_matches }, |
| | 538 | .max_bytes = .{ .value = cf.max_bytes }, |
| | 539 | }); |
| | 540 | }, |
| | 541 | .config_header => e: { |
| | 542 | const ch: *Step.ConfigHeader = @fieldParentPtr("step", step); |
| | 543 | const lazy_path: ?std.Build.LazyPath = ch.style.getPath(); |
| | 544 | const pairs = try arena.alloc(Configuration.Step.ConfigHeader.Value.Pair, ch.values.count()); |
| | 545 | for (pairs, ch.values.keys(), ch.values.values()) |*pair, key, value| pair.* = .{ |
| | 546 | .key = try wc.addString(key), |
| | 547 | .index = switch (value) { |
| | 548 | .undef => .undef, |
| | 549 | .defined => .defined, |
| | 550 | .boolean => |x| switch (x) { |
| | 551 | false => .bool_false, |
| | 552 | true => .bool_true, |
| 503 | }, | 553 | }, |
| 504 | .file_inputs = .{ .slice = try s.initLazyPathList(run.file_inputs.items) }, | 554 | .int => |x| switch (x) { |
| 505 | .args = .{ .slice = try s.initArgsList(run.argv.items) }, | 555 | 0 => .int_0, |
| 506 | .cwd = .{ .value = try s.addOptionalLazyPath(run.cwd) }, | 556 | 1 => .int_1, |
| 507 | .preopens = .{ .slice = preopens }, | 557 | else => try wc.addExtra(Configuration.Step.ConfigHeader.Value, .initSigned(x)), |
| 508 | .captured_stdout = .{ .value = if (run.captured_stdout) |cs| .{ | | |
| 509 | .basename = try wc.addString(cs.basename), | | |
| 510 | .generated_file = cs.generated_file, | | |
| 511 | } else null }, | | |
| 512 | .captured_stderr = .{ .value = if (run.captured_stderr) |cs| .{ | | |
| 513 | .basename = try wc.addString(cs.basename), | | |
| 514 | .generated_file = cs.generated_file, | | |
| 515 | } else null }, | | |
| 516 | .environ_map = .{ .value = try s.addEnvironMap(run.environ_map) }, | | |
| 517 | .expect_term_value = .{ .value = if (expect_term) |t| t.value else null }, | | |
| 518 | .stdio_limit = .{ .value = run.stdio_limit.toInt64() }, | | |
| 519 | .producer = .{ .value = if (run.producer) |cs| s.stepIndex(&cs.step) else null }, | | |
| 520 | .expect_stderr_exact = .{ .value = if (expect_stderr_exact) |bytes| bytes else null }, | | |
| 521 | .expect_stdout_exact = .{ .value = if (expect_stdout_exact) |bytes| bytes else null }, | | |
| 522 | .expect_stderr_match = .{ .slice = expect_stderr_match.items }, | | |
| 523 | .expect_stdout_match = .{ .slice = expect_stdout_match.items }, | | |
| 524 | .expect_stderr_snapshot = .{ .value = expect_stderr_snapshot orelse null }, | | |
| 525 | .expect_stdout_snapshot = .{ .value = expect_stdout_snapshot orelse null }, | | |
| 526 | .stdin = .{ .u = switch (run.stdin) { | | |
| 527 | .none => .none, | | |
| 528 | .bytes => |bytes| .{ .bytes = try wc.addBytes(bytes) }, | | |
| 529 | .lazy_path => |lp| .{ .lazy_path = try s.addLazyPath(lp) }, | | |
| 530 | } }, | | |
| 531 | }); | | |
| 532 | }, | | |
| 533 | .check_file => e: { | | |
| 534 | const cf: *Step.CheckFile = @fieldParentPtr("step", step); | | |
| 535 | break :e try wc.addExtraErased(Configuration.Step.CheckFile, .{ | | |
| 536 | .flags = .{ | | |
| 537 | .expected_exact = cf.expected_exact != null, | | |
| 538 | .expected_matches = cf.expected_matches.len != 0, | | |
| 539 | .max_bytes = cf.max_bytes != null, | | |
| 540 | }, | 558 | }, |
| 541 | .file = try s.addLazyPath(cf.file), | 559 | .ident => |x| try wc.addExtra(Configuration.Step.ConfigHeader.Value, .{ |
| 542 | .expected_exact = .{ .value = cf.expected_exact }, | 560 | .flags = .{ |
| 543 | .expected_matches = .{ .slice = cf.expected_matches }, | 561 | .tag = .ident, |
| 544 | .max_bytes = .{ .value = cf.max_bytes }, | 562 | .small = 0, |
| 545 | }); | | |
| 546 | }, | | |
| 547 | .config_header => e: { | | |
| 548 | const ch: *Step.ConfigHeader = @fieldParentPtr("step", step); | | |
| 549 | const lazy_path: ?std.Build.LazyPath = ch.style.getPath(); | | |
| 550 | const pairs = try arena.alloc(Configuration.Step.ConfigHeader.Value.Pair, ch.values.count()); | | |
| 551 | for (pairs, ch.values.keys(), ch.values.values()) |*pair, key, value| pair.* = .{ | | |
| 552 | .key = try wc.addString(key), | | |
| 553 | .index = switch (value) { | | |
| 554 | .undef => .undef, | | |
| 555 | .defined => .defined, | | |
| 556 | .boolean => |x| switch (x) { | | |
| 557 | false => .bool_false, | | |
| 558 | true => .bool_true, | | |
| 559 | }, | 563 | }, |
| 560 | .int => |x| switch (x) { | 564 | .i64 = .{ .value = null }, |
| 561 | 0 => .int_0, | 565 | .u64 = .{ .value = null }, |
| 562 | 1 => .int_1, | 566 | .ident = .{ .value = try wc.addString(x) }, |
| 563 | else => try wc.addExtra(Configuration.Step.ConfigHeader.Value, .initSigned(x)), | 567 | .string = .{ .value = null }, |
| | 568 | }), |
| | 569 | .string => |x| try wc.addExtra(Configuration.Step.ConfigHeader.Value, .{ |
| | 570 | .flags = .{ |
| | 571 | .tag = .string, |
| | 572 | .small = 0, |
| 564 | }, | 573 | }, |
| 565 | .ident => |x| try wc.addExtra(Configuration.Step.ConfigHeader.Value, .{ | 574 | .i64 = .{ .value = null }, |
| 566 | .flags = .{ | 575 | .u64 = .{ .value = null }, |
| 567 | .tag = .ident, | 576 | .ident = .{ .value = null }, |
| 568 | .small = 0, | 577 | .string = .{ .value = try wc.addString(x) }, |
| 569 | }, | 578 | }), |
| 570 | .i64 = .{ .value = null }, | 579 | }, |
| 571 | .u64 = .{ .value = null }, | 580 | }; |
| 572 | .ident = .{ .value = try wc.addString(x) }, | 581 | break :e try wc.addExtraErased(Configuration.Step.ConfigHeader, .{ |
| 573 | .string = .{ .value = null }, | 582 | .flags = .{ |
| 574 | }), | 583 | .template_file = lazy_path != null, |
| 575 | .string => |x| try wc.addExtra(Configuration.Step.ConfigHeader.Value, .{ | 584 | .style = .init(ch.style), |
| 576 | .flags = .{ | 585 | .input_size_limit = ch.input_size_limit != null, |
| 577 | .tag = .string, | 586 | .include_guard = ch.include_guard != .none, |
| 578 | .small = 0, | 587 | }, |
| 579 | }, | 588 | .template_file = .{ .value = try s.addOptionalLazyPath(lazy_path) }, |
| 580 | .i64 = .{ .value = null }, | 589 | .generated_dir = ch.generated_dir, |
| 581 | .u64 = .{ .value = null }, | 590 | .input_size_limit = .{ .value = ch.input_size_limit }, |
| 582 | .ident = .{ .value = null }, | 591 | .include_path = try wc.addString(ch.include_path), |
| 583 | .string = .{ .value = try wc.addString(x) }, | 592 | .include_guard = .{ .value = ch.include_guard.unwrap() }, |
| 584 | }), | 593 | .values = .{ .slice = pairs }, |
| 585 | }, | 594 | }); |
| 586 | }; | 595 | }, |
| 587 | break :e try wc.addExtraErased(Configuration.Step.ConfigHeader, .{ | 596 | .obj_copy => e: { |
| 588 | .flags = .{ | 597 | const oc: *Step.ObjCopy = @fieldParentPtr("step", step); |
| 589 | .template_file = lazy_path != null, | 598 | |
| 590 | .style = .init(ch.style), | 599 | const debug_basename: ?Configuration.String = if (oc.debug_file) |df| |
| 591 | .input_size_limit = ch.input_size_limit != null, | 600 | df.basename.unwrap() |
| 592 | .include_guard = ch.include_guard != .none, | 601 | else |
| 593 | }, | 602 | null; |
| 594 | .template_file = .{ .value = try s.addOptionalLazyPath(lazy_path) }, | 603 | |
| 595 | .generated_dir = ch.generated_dir, | 604 | const debug_file: ?Configuration.GeneratedFileIndex = if (oc.debug_file) |df| |
| 596 | .input_size_limit = .{ .value = ch.input_size_limit }, | 605 | df.output_file |
| 597 | .include_path = try wc.addString(ch.include_path), | 606 | else |
| 598 | .include_guard = .{ .value = ch.include_guard.unwrap() }, | 607 | null; |
| 599 | .values = .{ .slice = pairs }, | 608 | |
| 600 | }); | 609 | const add_sections = try arena.alloc( |
| 601 | }, | 610 | Configuration.Step.ObjCopy.AddSection, |
| 602 | .obj_copy => e: { | 611 | oc.add_sections.items.len, |
| 603 | const oc: *Step.ObjCopy = @fieldParentPtr("step", step); | 612 | ); |
| 604 | | 613 | for (add_sections, oc.add_sections.items) |*dest, src| dest.* = .{ |
| 605 | const debug_basename: ?Configuration.String = if (oc.debug_file) |df| | 614 | .section_name = src.section_name, |
| 606 | df.basename.unwrap() | 615 | .file_path = try s.addLazyPath(src.file_path), |
| 607 | else | 616 | }; |
| 608 | null; | 617 | |
| 609 | | 618 | break :e try wc.addExtraErased(Configuration.Step.ObjCopy, .{ |
| 610 | const debug_file: ?Configuration.GeneratedFileIndex = if (oc.debug_file) |df| | 619 | .flags = .{ |
| 611 | df.output_file | 620 | .basename = oc.basename != .none, |
| 612 | else | 621 | .debug_file = debug_file != null, |
| 613 | null; | 622 | .debug_basename = debug_basename != null, |
| 614 | | 623 | .format = .init(oc.format), |
| 615 | const add_sections = try arena.alloc( | 624 | .strip = oc.strip, |
| 616 | Configuration.Step.ObjCopy.AddSection, | 625 | .compress_debug = oc.compress_debug, |
| 617 | oc.add_sections.items.len, | 626 | .only_section = oc.only_section != .none, |
| 618 | ); | 627 | .pad_to = oc.pad_to != null, |
| 619 | for (add_sections, oc.add_sections.items) |*dest, src| dest.* = .{ | 628 | .add_section = add_sections.len != 0, |
| 620 | .section_name = src.section_name, | 629 | .update_section = oc.update_sections.items.len != 0, |
| 621 | .file_path = try s.addLazyPath(src.file_path), | 630 | }, |
| 622 | }; | 631 | .input_file = try s.addLazyPath(oc.input_file), |
| 623 | | 632 | .output_file = oc.output_file, |
| 624 | break :e try wc.addExtraErased(Configuration.Step.ObjCopy, .{ | 633 | .basename = .{ .value = oc.basename.unwrap() }, |
| 625 | .flags = .{ | 634 | .debug_file = .{ .value = debug_file }, |
| 626 | .basename = oc.basename != .none, | 635 | .debug_basename = .{ .value = debug_basename }, |
| 627 | .debug_file = debug_file != null, | 636 | .only_section = .{ .value = oc.only_section.unwrap() }, |
| 628 | .debug_basename = debug_basename != null, | 637 | .pad_to = .{ .value = oc.pad_to }, |
| 629 | .format = .init(oc.format), | 638 | .add_section = .{ .slice = add_sections }, |
| 630 | .strip = oc.strip, | 639 | .update_section = .{ .slice = oc.update_sections.items }, |
| 631 | .compress_debug = oc.compress_debug, | 640 | }); |
| 632 | .only_section = oc.only_section != .none, | 641 | }, |
| 633 | .pad_to = oc.pad_to != null, | 642 | .options => e: { |
| 634 | .add_section = add_sections.len != 0, | 643 | const so: *Step.Options = @fieldParentPtr("step", step); |
| 635 | .update_section = oc.update_sections.items.len != 0, | 644 | |
| 636 | }, | 645 | const files = try arena.alloc(Configuration.Step.Options.NamedPath, so.files.items.len); |
| 637 | .input_file = try s.addLazyPath(oc.input_file), | 646 | for (files, so.files.items) |*dest, src| dest.* = .{ |
| 638 | .output_file = oc.output_file, | 647 | .name = src.name, |
| 639 | .basename = .{ .value = oc.basename.unwrap() }, | 648 | .path = try s.addLazyPath(src.path), |
| 640 | .debug_file = .{ .value = debug_file }, | 649 | }; |
| 641 | .debug_basename = .{ .value = debug_basename }, | 650 | |
| 642 | .only_section = .{ .value = oc.only_section.unwrap() }, | 651 | const directories = try arena.alloc(Configuration.Step.Options.NamedPath, so.directories.items.len); |
| 643 | .pad_to = .{ .value = oc.pad_to }, | 652 | for (directories, so.directories.items) |*dest, src| dest.* = .{ |
| 644 | .add_section = .{ .slice = add_sections }, | 653 | .name = src.name, |
| 645 | .update_section = .{ .slice = oc.update_sections.items }, | 654 | .path = try s.addLazyPath(src.path), |
| 646 | }); | 655 | }; |
| 647 | }, | 656 | |
| 648 | .options => e: { | 657 | const untracked_paths = try arena.alloc(Configuration.Step.Options.NamedPath, so.untracked_paths.items.len); |
| 649 | const so: *Step.Options = @fieldParentPtr("step", step); | 658 | for (untracked_paths, so.untracked_paths.items) |*dest, src| dest.* = .{ |
| 650 | | 659 | .name = src.name, |
| 651 | const files = try arena.alloc(Configuration.Step.Options.NamedPath, so.files.items.len); | 660 | .path = try s.addLazyPath(src.path), |
| 652 | for (files, so.files.items) |*dest, src| dest.* = .{ | 661 | }; |
| 653 | .name = src.name, | 662 | |
| 654 | .path = try s.addLazyPath(src.path), | 663 | break :e try wc.addExtraErased(Configuration.Step.Options, .{ |
| 655 | }; | 664 | .flags = .{ |
| 656 | | 665 | .files = so.files.items.len != 0, |
| 657 | const directories = try arena.alloc(Configuration.Step.Options.NamedPath, so.directories.items.len); | 666 | .directories = so.directories.items.len != 0, |
| 658 | for (directories, so.directories.items) |*dest, src| dest.* = .{ | 667 | .untracked_paths = so.untracked_paths.items.len != 0, |
| 659 | .name = src.name, | 668 | }, |
| 660 | .path = try s.addLazyPath(src.path), | 669 | .generated_file = so.generated_file, |
| 661 | }; | 670 | .contents = try wc.addBytes(so.contents.items), |
| 662 | | 671 | .files = .{ .slice = files }, |
| 663 | const untracked_paths = try arena.alloc(Configuration.Step.Options.NamedPath, so.untracked_paths.items.len); | 672 | .directories = .{ .slice = directories }, |
| 664 | for (untracked_paths, so.untracked_paths.items) |*dest, src| dest.* = .{ | 673 | .untracked_paths = .{ .slice = untracked_paths }, |
| 665 | .name = src.name, | 674 | }); |
| 666 | .path = try s.addLazyPath(src.path), | 675 | }, |
| 667 | }; | 676 | }; |
| 668 | | 677 | |
| 669 | break :e try wc.addExtraErased(Configuration.Step.Options, .{ | 678 | try wc.steps.ensureTotalCapacity(gpa, s.step_map.entries.capacity); |
| 670 | .flags = .{ | 679 | wc.steps.appendAssumeCapacity(.{ |
| 671 | .files = so.files.items.len != 0, | 680 | .name = try wc.addString(step.name), |
| 672 | .directories = so.directories.items.len != 0, | 681 | .owner = try s.builderToPackage(step.owner), |
| 673 | .untracked_paths = so.untracked_paths.items.len != 0, | 682 | .deps = deps, |
| 674 | }, | 683 | .max_rss = .fromBytes(step.max_rss), |
| 675 | .generated_file = so.generated_file, | 684 | .extended = @fromBackingInt(extended), |
| 676 | .contents = try wc.addBytes(so.contents.items), | | |
| 677 | .files = .{ .slice = files }, | | |
| 678 | .directories = .{ .slice = directories }, | | |
| 679 | .untracked_paths = .{ .slice = untracked_paths }, | | |
| 680 | }); | | |
| 681 | }, | | |
| 682 | })), | | |
| 683 | }); | 685 | }); |
| 684 | } | 686 | } |
| 685 | } | 687 | } |