authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-08-18 20:58:46+02:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-08-18 20:58:46+02:00
logfff5e675bb0493914acb4a6e929fb090867cc9c3
treead1579a8a82229ede8a3dc7986251bb2321e7127
parent7051f8e73b875aca52cc2e56a8f296d847f8dfa8
parent08ddfb17a9e48576581de2c8acb1f231731f8f57

Merge pull request 'Maker: Fix a few bugs with build.zig.zon generated via fetch' (#36553) from squeek502/zig:fetch-gen-build-zig-zon into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36553

1 files changed, 7 insertions(+), 6 deletions(-)

lib/compiler/Maker.zig+7-6
......@@ -2017,7 +2017,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void {
20172017 return process.cleanExit(io);
20182018 },
20192019 .minimal => {
2020 Templates.writeSimpleFile(io, Package.Manifest.basename,
2020 Templates.writeSimpleFile(io, Io.Dir.cwd(), Package.Manifest.basename,
20212021 \\.{{
20222022 \\ .name = .{s},
20232023 \\ .version = "0.0.1",
......@@ -2034,7 +2034,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void {
20342034 else => fatal("failed to create {q}: {t}", .{ Package.Manifest.basename, err }),
20352035 error.PathAlreadyExists => fatal("refusing to overwrite {q}", .{Package.Manifest.basename}),
20362036 };
2037 Templates.writeSimpleFile(io, default_build_zig_basename,
2037 Templates.writeSimpleFile(io, Io.Dir.cwd(), default_build_zig_basename,
20382038 \\const std = @import("std");
20392039 \\
20402040 \\pub fn build(b: *std.Build) void {{
......@@ -3840,10 +3840,11 @@ fn loadManifest(
38403840 0,
38413841 ) catch |err| switch (err) {
38423842 error.FileNotFound => {
3843 Templates.writeSimpleFile(io, Package.Manifest.basename,
3843 Templates.writeSimpleFile(io, options.dir, Package.Manifest.basename,
38443844 \\.{{
38453845 \\ .name = .{s},
3846 \\ .version = "{s}",
3846 \\ .version = "0.0.1",
3847 \\ .minimum_zig_version = "{s}",
38473848 \\ .paths = .{{""}},
38483849 \\ .fingerprint = 0x{x},
38493850 \\}}
......@@ -4001,8 +4002,8 @@ const Templates = struct {
40014002 };
40024003 }
40034004
4004 fn writeSimpleFile(io: Io, file_name: []const u8, comptime format: []const u8, args: anytype) !void {
4005 const f = try Io.Dir.cwd().createFile(io, file_name, .{ .exclusive = true });
4005 fn writeSimpleFile(io: Io, dir: Io.Dir, file_name: []const u8, comptime format: []const u8, args: anytype) !void {
4006 const f = try dir.createFile(io, file_name, .{ .exclusive = true });
40064007 defer f.close(io);
40074008 var buf: [4096]u8 = undefined;
40084009 var fw = f.writer(io, &buf);