Skip to content

Commit bc7809e

Browse files
authored
Merge pull request #16 from AnErrupTion/zig-0.15.0
Update to Zig 0.15.0
2 parents 30afc2f + 4a98ed5 commit bc7809e

File tree

5 files changed

+31
-19
lines changed

5 files changed

+31
-19
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
name: Build and Test
99
steps:
1010
- uses: actions/checkout@v3
11-
- uses: mlugg/setup-zig@v1
11+
- uses: mlugg/setup-zig@v2
1212
with:
13-
version: 0.14.0
13+
version: 0.15.0
1414
- run: zig build test

build.zig

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ pub fn build(b: *std.Build) void {
88
.root_source_file = b.path("src/ini.zig"),
99
});
1010

11-
const lib = b.addStaticLibrary(.{
11+
const lib = b.addLibrary(.{
1212
.name = "ini",
13-
.root_source_file = b.path("src/lib.zig"),
14-
.target = target,
15-
.optimize = optimize,
13+
.root_module = b.createModule(.{
14+
.root_source_file = b.path("src/lib.zig"),
15+
.target = target,
16+
.optimize = optimize,
17+
}),
1618
});
1719
lib.bundle_compiler_rt = true;
1820
lib.addIncludePath(b.path("src"));
@@ -23,8 +25,10 @@ pub fn build(b: *std.Build) void {
2325
const example_step = b.step("example", "Build examples");
2426
const example_c = b.addExecutable(.{
2527
.name = "example-c",
26-
.optimize = optimize,
27-
.target = target,
28+
.root_module = b.createModule(.{
29+
.optimize = optimize,
30+
.target = target,
31+
}),
2832
});
2933
example_c.addCSourceFile(.{
3034
.file = b.path("example/example.c"),
@@ -41,23 +45,31 @@ pub fn build(b: *std.Build) void {
4145

4246
const example_zig = b.addExecutable(.{
4347
.name = "example-zig",
44-
.root_source_file = b.path("example/example.zig"),
45-
.optimize = optimize,
46-
.target = target,
48+
.root_module = b.createModule(.{
49+
.root_source_file = b.path("example/example.zig"),
50+
.optimize = optimize,
51+
.target = target,
52+
}),
4753
});
4854
example_zig.root_module.addImport("ini", b.modules.get("ini").?);
4955
example_step.dependOn(&b.addInstallArtifact(example_zig, .{}).step);
5056

5157
const test_step = b.step("test", "Run library tests");
5258
const main_tests = b.addTest(.{
53-
.root_source_file = b.path("src/test.zig"),
54-
.optimize = optimize,
59+
.root_module = b.createModule(.{
60+
.root_source_file = b.path("src/test.zig"),
61+
.optimize = optimize,
62+
.target = target,
63+
}),
5564
});
5665
test_step.dependOn(&b.addRunArtifact(main_tests).step);
5766

5867
const binding_tests = b.addTest(.{
59-
.root_source_file = b.path("src/lib-test.zig"),
60-
.optimize = optimize,
68+
.root_module = b.createModule(.{
69+
.root_source_file = b.path("src/lib-test.zig"),
70+
.optimize = optimize,
71+
.target = target,
72+
}),
6173
});
6274
binding_tests.addIncludePath(b.path("src"));
6375
binding_tests.linkLibrary(lib);

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.name = .ini,
33
.fingerprint = 0x7757b668623d2460,
44
.version = "0.1.0",
5-
.minimum_zig_version = "0.14.0",
5+
.minimum_zig_version = "0.15.0",
66
.paths = .{
77
"LICENCE",
88
"README.md",

src/ini.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn Parser(comptime Reader: type) type {
3939
const Self = @This();
4040

4141
allocator: std.mem.Allocator,
42-
line_buffer: std.ArrayList(u8),
42+
line_buffer: std.array_list.Managed(u8),
4343
reader: Reader,
4444
comment_characters: []const u8,
4545

@@ -114,7 +114,7 @@ pub fn Parser(comptime Reader: type) type {
114114
pub fn parse(allocator: std.mem.Allocator, reader: anytype, comment_characters: []const u8) Parser(@TypeOf(reader)) {
115115
return Parser(@TypeOf(reader)){
116116
.allocator = allocator,
117-
.line_buffer = std.ArrayList(u8).init(allocator),
117+
.line_buffer = std.array_list.Managed(u8).init(allocator),
118118
.reader = reader,
119119
.comment_characters = comment_characters,
120120
};

src/lib.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export fn ini_next(parser: *IniParser, record: *Record) IniError {
131131
return .success;
132132
}
133133

134-
const CReader = std.io.Reader(*std.c.FILE, std.fs.File.ReadError, cReaderRead);
134+
const CReader = std.Io.GenericReader(*std.c.FILE, std.fs.File.ReadError, cReaderRead);
135135

136136
fn cReader(c_file: *std.c.FILE) CReader {
137137
return .{ .context = c_file };

0 commit comments

Comments
 (0)