diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3f41ac5..5cdc051 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,7 +8,7 @@ jobs: name: Build and Test steps: - uses: actions/checkout@v3 - - uses: mlugg/setup-zig@v1 + - uses: mlugg/setup-zig@v2 with: - version: 0.14.0 + version: 0.15.0 - run: zig build test diff --git a/build.zig b/build.zig index 8f58a73..1120586 100644 --- a/build.zig +++ b/build.zig @@ -8,11 +8,13 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("src/ini.zig"), }); - const lib = b.addStaticLibrary(.{ + const lib = b.addLibrary(.{ .name = "ini", - .root_source_file = b.path("src/lib.zig"), - .target = target, - .optimize = optimize, + .root_module = b.createModule(.{ + .root_source_file = b.path("src/lib.zig"), + .target = target, + .optimize = optimize, + }), }); lib.bundle_compiler_rt = true; lib.addIncludePath(b.path("src")); @@ -23,8 +25,10 @@ pub fn build(b: *std.Build) void { const example_step = b.step("example", "Build examples"); const example_c = b.addExecutable(.{ .name = "example-c", - .optimize = optimize, - .target = target, + .root_module = b.createModule(.{ + .optimize = optimize, + .target = target, + }), }); example_c.addCSourceFile(.{ .file = b.path("example/example.c"), @@ -41,23 +45,31 @@ pub fn build(b: *std.Build) void { const example_zig = b.addExecutable(.{ .name = "example-zig", - .root_source_file = b.path("example/example.zig"), - .optimize = optimize, - .target = target, + .root_module = b.createModule(.{ + .root_source_file = b.path("example/example.zig"), + .optimize = optimize, + .target = target, + }), }); example_zig.root_module.addImport("ini", b.modules.get("ini").?); example_step.dependOn(&b.addInstallArtifact(example_zig, .{}).step); const test_step = b.step("test", "Run library tests"); const main_tests = b.addTest(.{ - .root_source_file = b.path("src/test.zig"), - .optimize = optimize, + .root_module = b.createModule(.{ + .root_source_file = b.path("src/test.zig"), + .optimize = optimize, + .target = target, + }), }); test_step.dependOn(&b.addRunArtifact(main_tests).step); const binding_tests = b.addTest(.{ - .root_source_file = b.path("src/lib-test.zig"), - .optimize = optimize, + .root_module = b.createModule(.{ + .root_source_file = b.path("src/lib-test.zig"), + .optimize = optimize, + .target = target, + }), }); binding_tests.addIncludePath(b.path("src")); binding_tests.linkLibrary(lib); diff --git a/build.zig.zon b/build.zig.zon index 0530b26..a66071a 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -2,7 +2,7 @@ .name = .ini, .fingerprint = 0x7757b668623d2460, .version = "0.1.0", - .minimum_zig_version = "0.14.0", + .minimum_zig_version = "0.15.0", .paths = .{ "LICENCE", "README.md", diff --git a/src/ini.zig b/src/ini.zig index f9add4b..056bc55 100644 --- a/src/ini.zig +++ b/src/ini.zig @@ -39,7 +39,7 @@ pub fn Parser(comptime Reader: type) type { const Self = @This(); allocator: std.mem.Allocator, - line_buffer: std.ArrayList(u8), + line_buffer: std.array_list.Managed(u8), reader: Reader, comment_characters: []const u8, @@ -114,7 +114,7 @@ pub fn Parser(comptime Reader: type) type { pub fn parse(allocator: std.mem.Allocator, reader: anytype, comment_characters: []const u8) Parser(@TypeOf(reader)) { return Parser(@TypeOf(reader)){ .allocator = allocator, - .line_buffer = std.ArrayList(u8).init(allocator), + .line_buffer = std.array_list.Managed(u8).init(allocator), .reader = reader, .comment_characters = comment_characters, }; diff --git a/src/lib.zig b/src/lib.zig index 2b766da..926578f 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -131,7 +131,7 @@ export fn ini_next(parser: *IniParser, record: *Record) IniError { return .success; } -const CReader = std.io.Reader(*std.c.FILE, std.fs.File.ReadError, cReaderRead); +const CReader = std.Io.GenericReader(*std.c.FILE, std.fs.File.ReadError, cReaderRead); fn cReader(c_file: *std.c.FILE) CReader { return .{ .context = c_file };