authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-01 16:11:57 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-01 16:11:57 -07:00
logcd56b80b5f517912286c6e80767f72d950e0de3e
tree33eab0b752662cc9512859b22bcd56b1f43581a0
parent16cef5e32b3f8bbcf1064c599615290a720b6547
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

update to zig 0.15.2


3 files changed, 18 insertions(+), 12 deletions(-)

build.zig+11-7
...@@ -3,14 +3,16 @@ const deps = @import("./deps.zig");...@@ -3,14 +3,16 @@ const deps = @import("./deps.zig");
33
4pub fn build(b: *std.Build) void {4pub fn build(b: *std.Build) void {
5 const target = b.standardTargetOptions(.{});5 const target = b.standardTargetOptions(.{});
6 const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug;6 const mode = b.option(std.builtin.OptimizeMode, "mode", "") orelse .Debug;
7 const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false;7 const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false;
88
9 const exe2 = b.addExecutable(.{9 const exe2 = b.addExecutable(.{
10 .name = "generate",10 .name = "generate",
11 .root_source_file = b.path("generate.zig"),11 .root_module = b.createModule(.{
12 .target = target,12 .root_source_file = b.path("generate.zig"),
13 .optimize = mode,13 .target = target,
14 .optimize = mode,
15 }),
14 });16 });
15 deps.addAllTo(exe2);17 deps.addAllTo(exe2);
16 exe2.use_llvm = !disable_llvm;18 exe2.use_llvm = !disable_llvm;
...@@ -27,9 +29,11 @@ pub fn build(b: *std.Build) void {...@@ -27,9 +29,11 @@ pub fn build(b: *std.Build) void {
27 run_step2.dependOn(&run_cmd2.step);29 run_step2.dependOn(&run_cmd2.step);
2830
29 const tests = b.addTest(.{31 const tests = b.addTest(.{
30 .root_source_file = b.path("test.zig"),32 .root_module = b.createModule(.{
31 .target = target,33 .root_source_file = b.path("test.zig"),
32 .optimize = mode,34 .target = target,
35 .optimize = mode,
36 }),
33 });37 });
34 deps.addAllTo(tests);38 deps.addAllTo(tests);
35 tests.use_llvm = !disable_llvm;39 tests.use_llvm = !disable_llvm;
generate.zig+6-5
...@@ -2,13 +2,14 @@...@@ -2,13 +2,14 @@
22
3const std = @import("std");3const std = @import("std");
4const json = @import("json");4const json = @import("json");
5const nfs = @import("nfs");
56
6pub fn main() !void {7pub fn main() !void {
7 var gpa = std.heap.GeneralPurposeAllocator(.{}){};8 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
8 const alloc = gpa.allocator();9 const alloc = gpa.allocator();
910
10 const f = try std.fs.cwd().createFile("src/lib.zig", .{});11 const f = try nfs.cwd().createFile("src/lib.zig", .{});
11 const w = f.writer();12 const w = f;
1213
13 {14 {
14 std.log.info("spdx", .{});15 std.log.info("spdx", .{});
...@@ -73,16 +74,16 @@ pub fn simple_fetch(alloc: std.mem.Allocator, url: []const u8) !json.Document {...@@ -73,16 +74,16 @@ pub fn simple_fetch(alloc: std.mem.Allocator, url: []const u8) !json.Document {
73 var client = std.http.Client{ .allocator = alloc };74 var client = std.http.Client{ .allocator = alloc };
74 defer client.deinit();75 defer client.deinit();
7576
76 var list = std.ArrayList(u8).init(alloc);77 var list = std.Io.Writer.Allocating.init(alloc);
77 defer list.deinit();78 defer list.deinit();
7879
79 const fetch = try client.fetch(.{80 const fetch = try client.fetch(.{
80 .location = .{ .url = url },81 .location = .{ .url = url },
81 .response_storage = .{ .dynamic = &list },82 .response_writer = &list.writer,
82 });83 });
83 const opts = json.Parser.Options{ .maximum_depth = 100, .support_trailing_commas = true };84 const opts = json.Parser.Options{ .maximum_depth = 100, .support_trailing_commas = true };
84 if (fetch.status != .ok) return try json.parseFromSlice(alloc, url, "{}", opts);85 if (fetch.status != .ok) return try json.parseFromSlice(alloc, url, "{}", opts);
85 return try json.parseFromSlice(alloc, url, list.items, opts);86 return try json.parseFromSlice(alloc, url, list.written(), opts);
86}87}
8788
88fn spdxlicenseLessThan(context: void, lhs: json.ValueIndex, rhs: json.ValueIndex) bool {89fn spdxlicenseLessThan(context: void, lhs: json.ValueIndex, rhs: json.ValueIndex) bool {
zig.mod+1
...@@ -4,3 +4,4 @@ main: src/lib.zig...@@ -4,3 +4,4 @@ main: src/lib.zig
4license: MIT4license: MIT
5root_dependencies:5root_dependencies:
6 - src: git https://github.com/nektro/zig-json6 - src: git https://github.com/nektro/zig-json
7 - src: git https://github.com/nektro/zig-nfs