| ... | @@ -23,6 +23,7 @@ const Color = std.zig.Color; | ... | @@ -23,6 +23,7 @@ const Color = std.zig.Color; |
| 23 | const Client = std.zig.Client; | 23 | const Client = std.zig.Client; |
| 24 | const Server = std.zig.Server; | 24 | const Server = std.zig.Server; |
| 25 | const EnvVar = std.zig.EnvVar; | 25 | const EnvVar = std.zig.EnvVar; |
| | 26 | const ErrorBundle = std.zig.ErrorBundle; |
| 26 | const default_local_zig_cache_basename = std.zig.default_local_zig_cache_basename; | 27 | const default_local_zig_cache_basename = std.zig.default_local_zig_cache_basename; |
| 27 | const stringToEnum = std.meta.stringToEnum; | 28 | const stringToEnum = std.meta.stringToEnum; |
| 28 | | 29 | |
| ... | @@ -35,6 +36,7 @@ const ScannedConfig = @import("Maker/ScannedConfig.zig"); | ... | @@ -35,6 +36,7 @@ const ScannedConfig = @import("Maker/ScannedConfig.zig"); |
| 35 | const PkgConfig = @import("Maker/PkgConfig.zig"); | 36 | const PkgConfig = @import("Maker/PkgConfig.zig"); |
| 36 | const Fetch = @import("Maker/Fetch.zig"); | 37 | const Fetch = @import("Maker/Fetch.zig"); |
| 37 | const Package = @import("Maker/Package.zig"); | 38 | const Package = @import("Maker/Package.zig"); |
| | 39 | const Manifest = Package.Manifest; |
| 38 | | 40 | |
| 39 | pub const std_options: std.Options = .{ | 41 | pub const std_options: std.Options = .{ |
| 40 | .side_channels_mitigations = .none, | 42 | .side_channels_mitigations = .none, |
| ... | @@ -601,10 +603,16 @@ pub fn main(init: process.Init.Minimal) !void { | ... | @@ -601,10 +603,16 @@ pub fn main(init: process.Init.Minimal) !void { |
| 601 | const cwd_path = std.zig.getResolvedCwd(io, arena) catch |err| | 603 | const cwd_path = std.zig.getResolvedCwd(io, arena) catch |err| |
| 602 | fatal("resolving current directory path failed: {t}", .{err}); | 604 | fatal("resolving current directory path failed: {t}", .{err}); |
| 603 | | 605 | |
| 604 | var build_root = try findBuildRoot(arena, io, .{ | 606 | var build_root = findBuildRoot(arena, io, .{ |
| 605 | .cwd_path = cwd_path, | 607 | .cwd_path = cwd_path, |
| 606 | .build_file = build_file, | 608 | .build_file = build_file, |
| 607 | }); | 609 | }) catch |err| switch (err) { |
| | 610 | error.BuildZigNotFound => { |
| | 611 | if (help_menu) printUsageWithoutConfiguration(&graph, "build.zig not found"); |
| | 612 | process.exit(1); |
| | 613 | }, |
| | 614 | else => |e| return e, |
| | 615 | }; |
| 608 | defer build_root.deinit(io); | 616 | defer build_root.deinit(io); |
| 609 | | 617 | |
| 610 | graph.build_root_directory = build_root.directory; | 618 | graph.build_root_directory = build_root.directory; |
| ... | @@ -740,7 +748,7 @@ pub fn main(init: process.Init.Minimal) !void { | ... | @@ -740,7 +748,7 @@ pub fn main(init: process.Init.Minimal) !void { |
| 740 | var configure_source_files: Cache.Manifest.SelfContainedFiles = .empty; | 748 | var configure_source_files: Cache.Manifest.SelfContainedFiles = .empty; |
| 741 | defer configure_source_files.deinit(gpa); | 749 | defer configure_source_files.deinit(gpa); |
| 742 | | 750 | |
| 743 | var configure_error_bundle: std.zig.ErrorBundle = .empty; | 751 | var configure_error_bundle: ErrorBundle = .empty; |
| 744 | defer configure_error_bundle.deinit(gpa); | 752 | defer configure_error_bundle.deinit(gpa); |
| 745 | | 753 | |
| 746 | // If this fails, we can still start the server and wait for user | 754 | // If this fails, we can still start the server and wait for user |
| ... | @@ -1042,7 +1050,10 @@ pub fn main(init: process.Init.Minimal) !void { | ... | @@ -1042,7 +1050,10 @@ pub fn main(init: process.Init.Minimal) !void { |
| 1042 | } else |err| { | 1050 | } else |err| { |
| 1043 | const can_fs_watch = switch (err) { | 1051 | const can_fs_watch = switch (err) { |
| 1044 | error.AlreadyReported => false, | 1052 | error.AlreadyReported => false, |
| 1045 | error.FailedButCacheIntact => true, | 1053 | error.FailedButCacheIntact => c: { |
| | 1054 | if (help_menu) printUsageWithoutConfiguration(&graph, "build.zig compilation failure"); |
| | 1055 | break :c true; |
| | 1056 | }, |
| 1046 | else => |e| w: { | 1057 | else => |e| w: { |
| 1047 | log.err("configuration failed: {t}", .{e}); | 1058 | log.err("configuration failed: {t}", .{e}); |
| 1048 | break :w false; | 1059 | break :w false; |
| ... | @@ -1064,6 +1075,17 @@ pub fn main(init: process.Init.Minimal) !void { | ... | @@ -1064,6 +1075,17 @@ pub fn main(init: process.Init.Minimal) !void { |
| 1064 | } | 1075 | } |
| 1065 | } | 1076 | } |
| 1066 | | 1077 | |
| | 1078 | fn printUsageWithoutConfiguration(graph: *Graph, reason: []const u8) noreturn { |
| | 1079 | const io = graph.io; |
| | 1080 | _ = io.lockStderr(&.{}, graph.stderr_mode) catch {}; |
| | 1081 | const writer = initStdoutWriter(io); |
| | 1082 | ScannedConfig.printUsageWithoutConfiguration(graph.zig_exe, writer, reason) catch |err| switch (err) { |
| | 1083 | error.WriteFailed => fatal("failed writing to stdout: {t}", .{stdout_writer_allocation.err.?}), |
| | 1084 | }; |
| | 1085 | stdout_writer_allocation.flush() catch |err| fatal("failed writing to stdout: {t}", .{err}); |
| | 1086 | return process.exit(0); |
| | 1087 | } |
| | 1088 | |
| 1067 | /// Temporarily adds the reconfigure pseudostep to step_stack, calls | 1089 | /// Temporarily adds the reconfigure pseudostep to step_stack, calls |
| 1068 | /// `Watch.update`, and then pops it again. | 1090 | /// `Watch.update`, and then pops it again. |
| 1069 | fn updateWatch(maker: *Maker, watch: *Watch) !void { | 1091 | fn updateWatch(maker: *Maker, watch: *Watch) !void { |
| ... | @@ -1091,7 +1113,7 @@ const ConfigureOptions = struct { | ... | @@ -1091,7 +1113,7 @@ const ConfigureOptions = struct { |
| 1091 | print_configuration: PrintConfiguration, | 1113 | print_configuration: PrintConfiguration, |
| 1092 | forks: []Fork, | 1114 | forks: []Fork, |
| 1093 | src_files: *Cache.Manifest.SelfContainedFiles, | 1115 | src_files: *Cache.Manifest.SelfContainedFiles, |
| 1094 | error_bundle: ?*std.zig.ErrorBundle = null, | 1116 | error_bundle: ?*ErrorBundle = null, |
| 1095 | }; | 1117 | }; |
| 1096 | | 1118 | |
| 1097 | fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { | 1119 | fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { |
| ... | @@ -1402,7 +1424,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { | ... | @@ -1402,7 +1424,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { |
| 1402 | for (fetches) |f| { | 1424 | for (fetches) |f| { |
| 1403 | if (!f.have_manifest) continue; | 1425 | if (!f.have_manifest) continue; |
| 1404 | if (config_man) |man| { | 1426 | if (config_man) |man| { |
| 1405 | const manifest_path = try f.package_root.join(arena, Package.Manifest.basename); | 1427 | const manifest_path = try f.package_root.join(arena, Manifest.basename); |
| 1406 | _ = try man.addInputPath(manifest_path, .{}); | 1428 | _ = try man.addInputPath(manifest_path, .{}); |
| 1407 | } | 1429 | } |
| 1408 | const mod = f.cli_module orelse continue; | 1430 | const mod = f.cli_module orelse continue; |
| ... | @@ -1932,8 +1954,8 @@ fn cmdFetch(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { | ... | @@ -1932,8 +1954,8 @@ fn cmdFetch(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { |
| 1932 | try ast.render(gpa, &aw.writer, fixups); | 1954 | try ast.render(gpa, &aw.writer, fixups); |
| 1933 | const rendered = aw.written(); | 1955 | const rendered = aw.written(); |
| 1934 | | 1956 | |
| 1935 | build_root.directory.handle.writeFile(io, .{ .sub_path = Package.Manifest.basename, .data = rendered }) catch |err| { | 1957 | build_root.directory.handle.writeFile(io, .{ .sub_path = Manifest.basename, .data = rendered }) catch |err| { |
| 1936 | fatal("unable to write {s} file: {t}", .{ Package.Manifest.basename, err }); | 1958 | fatal("unable to write {s} file: {t}", .{ Manifest.basename, err }); |
| 1937 | }; | 1959 | }; |
| 1938 | | 1960 | |
| 1939 | return process.cleanExit(io); | 1961 | return process.cleanExit(io); |
| ... | @@ -2135,7 +2157,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { | ... | @@ -2135,7 +2157,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { |
| 2135 | const s = Dir.path.sep_str; | 2157 | const s = Dir.path.sep_str; |
| 2136 | const template_paths = [_][]const u8{ | 2158 | const template_paths = [_][]const u8{ |
| 2137 | default_build_zig_basename, | 2159 | default_build_zig_basename, |
| 2138 | Package.Manifest.basename, | 2160 | Manifest.basename, |
| 2139 | "src" ++ s ++ "main.zig", | 2161 | "src" ++ s ++ "main.zig", |
| 2140 | "src" ++ s ++ "root.zig", | 2162 | "src" ++ s ++ "root.zig", |
| 2141 | }; | 2163 | }; |
| ... | @@ -2159,7 +2181,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { | ... | @@ -2159,7 +2181,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { |
| 2159 | return process.cleanExit(io); | 2181 | return process.cleanExit(io); |
| 2160 | }, | 2182 | }, |
| 2161 | .minimal => { | 2183 | .minimal => { |
| 2162 | Templates.writeSimpleFile(io, Io.Dir.cwd(), Package.Manifest.basename, | 2184 | Templates.writeSimpleFile(io, Io.Dir.cwd(), Manifest.basename, |
| 2163 | \\.{{ | 2185 | \\.{{ |
| 2164 | \\ .name = .{s}, | 2186 | \\ .name = .{s}, |
| 2165 | \\ .version = "0.0.1", | 2187 | \\ .version = "0.0.1", |
| ... | @@ -2173,8 +2195,8 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { | ... | @@ -2173,8 +2195,8 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { |
| 2173 | builtin.zig_version_string, | 2195 | builtin.zig_version_string, |
| 2174 | fingerprint.int(), | 2196 | fingerprint.int(), |
| 2175 | }) catch |err| switch (err) { | 2197 | }) catch |err| switch (err) { |
| 2176 | else => fatal("failed to create {q}: {t}", .{ Package.Manifest.basename, err }), | 2198 | else => fatal("failed to create {q}: {t}", .{ Manifest.basename, err }), |
| 2177 | error.PathAlreadyExists => fatal("refusing to overwrite {q}", .{Package.Manifest.basename}), | 2199 | error.PathAlreadyExists => fatal("refusing to overwrite {q}", .{Manifest.basename}), |
| 2178 | }; | 2200 | }; |
| 2179 | Templates.writeSimpleFile(io, Io.Dir.cwd(), default_build_zig_basename, | 2201 | Templates.writeSimpleFile(io, Io.Dir.cwd(), default_build_zig_basename, |
| 2180 | \\const std = @import("std"); | 2202 | \\const std = @import("std"); |
| ... | @@ -2189,12 +2211,12 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { | ... | @@ -2189,12 +2211,12 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { |
| 2189 | // their `build.zig.zon` *after* writing their `build.zig`. So this one isn't fatal. | 2211 | // their `build.zig.zon` *after* writing their `build.zig`. So this one isn't fatal. |
| 2190 | error.PathAlreadyExists => { | 2212 | error.PathAlreadyExists => { |
| 2191 | log.info("successfully populated {q}, preserving existing {q}", .{ | 2213 | log.info("successfully populated {q}, preserving existing {q}", .{ |
| 2192 | Package.Manifest.basename, default_build_zig_basename, | 2214 | Manifest.basename, default_build_zig_basename, |
| 2193 | }); | 2215 | }); |
| 2194 | return process.cleanExit(io); | 2216 | return process.cleanExit(io); |
| 2195 | }, | 2217 | }, |
| 2196 | }; | 2218 | }; |
| 2197 | log.info("successfully populated {q} and {q}", .{ Package.Manifest.basename, default_build_zig_basename }); | 2219 | log.info("successfully populated {q} and {q}", .{ Manifest.basename, default_build_zig_basename }); |
| 2198 | return process.cleanExit(io); | 2220 | return process.cleanExit(io); |
| 2199 | }, | 2221 | }, |
| 2200 | } | 2222 | } |
| ... | @@ -3277,7 +3299,7 @@ pub fn invalidateResult(maker: *Maker, step: *Step) error{MustReconfigure}!bool | ... | @@ -3277,7 +3299,7 @@ pub fn invalidateResult(maker: *Maker, step: *Step) error{MustReconfigure}!bool |
| 3277 | pub fn printErrorMessages( | 3299 | pub fn printErrorMessages( |
| 3278 | maker: *Maker, | 3300 | maker: *Maker, |
| 3279 | failing_step_index: Configuration.Step.Index, | 3301 | failing_step_index: Configuration.Step.Index, |
| 3280 | options: std.zig.ErrorBundle.RenderOptions, | 3302 | options: ErrorBundle.RenderOptions, |
| 3281 | stderr: Io.Terminal, | 3303 | stderr: Io.Terminal, |
| 3282 | error_style: ErrorStyle, | 3304 | error_style: ErrorStyle, |
| 3283 | multiline_errors: MultilineErrors, | 3305 | multiline_errors: MultilineErrors, |
| ... | @@ -4037,7 +4059,9 @@ const FindBuildRootOptions = struct { | ... | @@ -4037,7 +4059,9 @@ const FindBuildRootOptions = struct { |
| 4037 | cwd_path: []const u8, | 4059 | cwd_path: []const u8, |
| 4038 | }; | 4060 | }; |
| 4039 | | 4061 | |
| 4040 | fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !BuildRoot { | 4062 | const FindBuildRootError = error{ OutOfMemory, BuildZigNotFound }; |
| | 4063 | |
| | 4064 | fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) FindBuildRootError!BuildRoot { |
| 4041 | const build_zig_basename = if (options.build_file) |bf| | 4065 | const build_zig_basename = if (options.build_file) |bf| |
| 4042 | Dir.path.basename(bf) | 4066 | Dir.path.basename(bf) |
| 4043 | else | 4067 | else |
| ... | @@ -4088,11 +4112,12 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build | ... | @@ -4088,11 +4112,12 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build |
| 4088 | dirname = Dir.path.dirname(dirname orelse options.cwd_path) orelse { | 4112 | dirname = Dir.path.dirname(dirname orelse options.cwd_path) orelse { |
| 4089 | log.info("initialize {s} template file with \"zig init\"", .{std.zig.build_zig_basename}); | 4113 | log.info("initialize {s} template file with \"zig init\"", .{std.zig.build_zig_basename}); |
| 4090 | log.info("see \"zig --help\" for more options", .{}); | 4114 | log.info("see \"zig --help\" for more options", .{}); |
| 4091 | fatal("no build.zig file found, in the current directory or any parent directories", .{}); | 4115 | log.err("no build.zig file found, in the current directory or any parent directories", .{}); |
| | 4116 | return error.BuildZigNotFound; |
| 4092 | }; | 4117 | }; |
| 4093 | continue; | 4118 | continue; |
| 4094 | }, | 4119 | }, |
| 4095 | else => |e| return e, | 4120 | else => |e| fatal("accessing {q} while searching for build.zig file failed: {t}", .{ joined_path, e }), |
| 4096 | } | 4121 | } |
| 4097 | } | 4122 | } |
| 4098 | } | 4123 | } |
| ... | @@ -4100,8 +4125,8 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build | ... | @@ -4100,8 +4125,8 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build |
| 4100 | const Fork = struct { | 4125 | const Fork = struct { |
| 4101 | path: Path, | 4126 | path: Path, |
| 4102 | manifest_ast: std.zig.Ast, | 4127 | manifest_ast: std.zig.Ast, |
| 4103 | manifest: Package.Manifest, | 4128 | manifest: Manifest, |
| 4104 | error_bundle: std.zig.ErrorBundle.Wip, | 4129 | error_bundle: ErrorBundle.Wip, |
| 4105 | failed: bool, | 4130 | failed: bool, |
| 4106 | arena_allocator: std.heap.ArenaAllocator, | 4131 | arena_allocator: std.heap.ArenaAllocator, |
| 4107 | | 4132 | |
| ... | @@ -4134,12 +4159,12 @@ const Fork = struct { | ... | @@ -4134,12 +4159,12 @@ const Fork = struct { |
| 4134 | fork.arena_allocator = .init(gpa); | 4159 | fork.arena_allocator = .init(gpa); |
| 4135 | const arena = fork.arena_allocator.allocator(); | 4160 | const arena = fork.arena_allocator.allocator(); |
| 4136 | | 4161 | |
| 4137 | var error_bundle: std.zig.ErrorBundle.Wip = try .init(gpa); | 4162 | var error_bundle: ErrorBundle.Wip = try .init(gpa); |
| 4138 | defer error_bundle.deinit(); | 4163 | defer error_bundle.deinit(); |
| 4139 | | 4164 | |
| 4140 | const manifest_path = try fork.path.join(arena, Package.Manifest.basename); | 4165 | const manifest_path = try fork.path.join(arena, Manifest.basename); |
| 4141 | | 4166 | |
| 4142 | Package.Manifest.load( | 4167 | Manifest.load( |
| 4143 | io, | 4168 | io, |
| 4144 | arena, | 4169 | arena, |
| 4145 | manifest_path, | 4170 | manifest_path, |
| ... | @@ -4189,20 +4214,20 @@ fn loadManifest( | ... | @@ -4189,20 +4214,20 @@ fn loadManifest( |
| 4189 | arena: Allocator, | 4214 | arena: Allocator, |
| 4190 | io: Io, | 4215 | io: Io, |
| 4191 | options: LoadManifestOptions, | 4216 | options: LoadManifestOptions, |
| 4192 | ) !struct { Package.Manifest, std.zig.Ast } { | 4217 | ) !struct { Manifest, std.zig.Ast } { |
| 4193 | const rng: std.Random.IoSource = .{ .io = io }; | 4218 | const rng: std.Random.IoSource = .{ .io = io }; |
| 4194 | | 4219 | |
| 4195 | const manifest_bytes = while (true) { | 4220 | const manifest_bytes = while (true) { |
| 4196 | break options.dir.readFileAllocOptions( | 4221 | break options.dir.readFileAllocOptions( |
| 4197 | io, | 4222 | io, |
| 4198 | Package.Manifest.basename, | 4223 | Manifest.basename, |
| 4199 | arena, | 4224 | arena, |
| 4200 | .limited(Package.Manifest.max_bytes), | 4225 | .limited(Manifest.max_bytes), |
| 4201 | .@"1", | 4226 | .@"1", |
| 4202 | 0, | 4227 | 0, |
| 4203 | ) catch |err| switch (err) { | 4228 | ) catch |err| switch (err) { |
| 4204 | error.FileNotFound => { | 4229 | error.FileNotFound => { |
| 4205 | Templates.writeSimpleFile(io, options.dir, Package.Manifest.basename, | 4230 | Templates.writeSimpleFile(io, options.dir, Manifest.basename, |
| 4206 | \\.{{ | 4231 | \\.{{ |
| 4207 | \\ .name = .{s}, | 4232 | \\ .name = .{s}, |
| 4208 | \\ .version = "0.0.1", | 4233 | \\ .version = "0.0.1", |
| ... | @@ -4216,29 +4241,29 @@ fn loadManifest( | ... | @@ -4216,29 +4241,29 @@ fn loadManifest( |
| 4216 | builtin.zig_version_string, | 4241 | builtin.zig_version_string, |
| 4217 | Package.Fingerprint.generate(rng.interface(), options.root_name).int(), | 4242 | Package.Fingerprint.generate(rng.interface(), options.root_name).int(), |
| 4218 | }) catch |e| { | 4243 | }) catch |e| { |
| 4219 | fatal("unable to write {s}: {t}", .{ Package.Manifest.basename, e }); | 4244 | fatal("unable to write {s}: {t}", .{ Manifest.basename, e }); |
| 4220 | }; | 4245 | }; |
| 4221 | continue; | 4246 | continue; |
| 4222 | }, | 4247 | }, |
| 4223 | else => |e| fatal("unable to load {s}: {t}", .{ Package.Manifest.basename, e }), | 4248 | else => |e| fatal("unable to load {s}: {t}", .{ Manifest.basename, e }), |
| 4224 | }; | 4249 | }; |
| 4225 | }; | 4250 | }; |
| 4226 | var ast = try std.zig.Ast.parse(gpa, manifest_bytes, .{ .mode = .zon }); | 4251 | var ast = try std.zig.Ast.parse(gpa, manifest_bytes, .{ .mode = .zon }); |
| 4227 | errdefer ast.deinit(gpa); | 4252 | errdefer ast.deinit(gpa); |
| 4228 | | 4253 | |
| 4229 | if (ast.errors.len > 0) { | 4254 | if (ast.errors.len > 0) { |
| 4230 | try std.zig.printAstErrorsToStderr(gpa, io, ast, Package.Manifest.basename, options.color); | 4255 | try std.zig.printAstErrorsToStderr(gpa, io, ast, Manifest.basename, options.color); |
| 4231 | process.exit(2); | 4256 | process.exit(2); |
| 4232 | } | 4257 | } |
| 4233 | | 4258 | |
| 4234 | var manifest = try Package.Manifest.parse(gpa, &ast, rng.interface(), .{}); | 4259 | var manifest = try Manifest.parse(gpa, &ast, rng.interface(), .{}); |
| 4235 | errdefer manifest.deinit(gpa); | 4260 | errdefer manifest.deinit(gpa); |
| 4236 | | 4261 | |
| 4237 | if (manifest.errors.len > 0) { | 4262 | if (manifest.errors.len > 0) { |
| 4238 | var wip_errors: std.zig.ErrorBundle.Wip = try .init(gpa); | 4263 | var wip_errors: ErrorBundle.Wip = try .init(gpa); |
| 4239 | defer wip_errors.deinit(); | 4264 | defer wip_errors.deinit(); |
| 4240 | | 4265 | |
| 4241 | const src_path = try wip_errors.addString(Package.Manifest.basename); | 4266 | const src_path = try wip_errors.addString(Manifest.basename); |
| 4242 | try manifest.copyErrorsIntoBundle(ast, src_path, &wip_errors); | 4267 | try manifest.copyErrorsIntoBundle(ast, src_path, &wip_errors); |
| 4243 | | 4268 | |
| 4244 | var error_bundle = try wip_errors.toOwnedBundle(""); | 4269 | var error_bundle = try wip_errors.toOwnedBundle(""); |
| ... | @@ -4262,8 +4287,8 @@ fn sanitizeExampleName(arena: Allocator, bytes: []const u8) error{OutOfMemory}![ | ... | @@ -4262,8 +4287,8 @@ fn sanitizeExampleName(arena: Allocator, bytes: []const u8) error{OutOfMemory}![ |
| 4262 | else => continue, | 4287 | else => continue, |
| 4263 | }; | 4288 | }; |
| 4264 | if (!std.zig.isValidId(result.items)) return "foo"; | 4289 | if (!std.zig.isValidId(result.items)) return "foo"; |
| 4265 | if (result.items.len > Package.Manifest.max_name_len) | 4290 | if (result.items.len > Manifest.max_name_len) |
| 4266 | result.shrinkRetainingCapacity(Package.Manifest.max_name_len); | 4291 | result.shrinkRetainingCapacity(Manifest.max_name_len); |
| 4267 | | 4292 | |
| 4268 | return result.toOwnedSlice(arena); | 4293 | return result.toOwnedSlice(arena); |
| 4269 | } | 4294 | } |