diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 509a50c..d57419d 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: # container: # image: alpine:3.15.0 env: - ZIG_VERSION: 0.11.0 + ZIG_VERSION: 0.12.0 ARCH: x86_64 steps: - name: Check out repository code diff --git a/build.zig b/build.zig index 9cbea3c..15bb4fa 100644 --- a/build.zig +++ b/build.zig @@ -144,7 +144,7 @@ pub fn build(b: *Builder) !void { }, )); cg_cmd.addArg("--output"); - cg_cmd.addDirectoryArg(std.Build.LazyPath.relative("src/models")); + cg_cmd.addDirectoryArg(b.path("src/models")); if (b.verbose) cg_cmd.addArg("--verbose"); // cg_cmd.step.dependOn(&fetch_step.step); diff --git a/codegen/src/Hasher.zig b/codegen/src/Hasher.zig index 95ebf1f..cf8ca02 100644 --- a/codegen/src/Hasher.zig +++ b/codegen/src/Hasher.zig @@ -77,13 +77,13 @@ pub fn hex64(x: u64) [16]u8 { return result; } -pub const walkerFn = *const fn (std.fs.Dir.Walker.WalkerEntry) bool; +pub const walkerFn = *const fn (std.fs.Dir.Walker.Entry) bool; -fn included(entry: std.fs.Dir.Walker.WalkerEntry) bool { +fn included(entry: std.fs.Dir.Walker.Entry) bool { _ = entry; return true; } -fn excluded(entry: std.fs.Dir.Walker.WalkerEntry) bool { +fn excluded(entry: std.fs.Dir.Walker.Entry) bool { _ = entry; return false; } @@ -206,6 +206,6 @@ fn isExecutable(file: std.fs.File) !bool { return false; } else { const stat = try file.stat(); - return (stat.mode & std.os.S.IXUSR) != 0; + return (stat.mode & std.posix.S.IXUSR) != 0; } } diff --git a/codegen/src/main.zig b/codegen/src/main.zig index c7da8ef..75a0852 100644 --- a/codegen/src/main.zig +++ b/codegen/src/main.zig @@ -134,12 +134,12 @@ var model_digest: ?[Hasher.hex_multihash_len]u8 = null; fn calculateDigests(models_dir: std.fs.Dir, output_dir: std.fs.Dir, thread_pool: *std.Thread.Pool) !OutputManifest { const model_hash = if (model_digest) |m| m[0..Hasher.digest_len].* else try Hasher.computeDirectoryHash(thread_pool, models_dir, @constCast(&Hasher.ComputeDirectoryOptions{ .isIncluded = struct { - pub fn include(entry: std.fs.Dir.Walker.WalkerEntry) bool { + pub fn include(entry: std.fs.Dir.Walker.Entry) bool { return std.mem.endsWith(u8, entry.basename, ".json"); } }.include, .isExcluded = struct { - pub fn exclude(entry: std.fs.Dir.Walker.WalkerEntry) bool { + pub fn exclude(entry: std.fs.Dir.Walker.Entry) bool { _ = entry; return false; } @@ -150,12 +150,12 @@ fn calculateDigests(models_dir: std.fs.Dir, output_dir: std.fs.Dir, thread_pool: const output_hash = try Hasher.computeDirectoryHash(thread_pool, try output_dir.openDir(".", .{ .iterate = true }), @constCast(&Hasher.ComputeDirectoryOptions{ .isIncluded = struct { - pub fn include(entry: std.fs.Dir.Walker.WalkerEntry) bool { + pub fn include(entry: std.fs.Dir.Walker.Entry) bool { return std.mem.endsWith(u8, entry.basename, ".zig"); } }.include, .isExcluded = struct { - pub fn exclude(entry: std.fs.Dir.Walker.WalkerEntry) bool { + pub fn exclude(entry: std.fs.Dir.Walker.Entry) bool { _ = entry; return false; } diff --git a/src/aws.zig b/src/aws.zig index 59384fd..946641e 100644 --- a/src/aws.zig +++ b/src/aws.zig @@ -827,7 +827,7 @@ fn ServerResponse(comptime action: anytype) type { }; const Result = @Type(.{ .Struct = .{ - .layout = .Auto, + .layout = .auto, .fields = &[_]std.builtin.Type.StructField{ .{ .name = action.action_name ++ "Result", @@ -850,7 +850,7 @@ fn ServerResponse(comptime action: anytype) type { }); return @Type(.{ .Struct = .{ - .layout = .Auto, + .layout = .auto, .fields = &[_]std.builtin.Type.StructField{ .{ .name = action.action_name ++ "Response", diff --git a/src/aws_credentials.zig b/src/aws_credentials.zig index 8b5f0a4..d22dc4d 100644 --- a/src/aws_credentials.zig +++ b/src/aws_credentials.zig @@ -574,7 +574,7 @@ fn getHomeDir(allocator: std.mem.Allocator) ![]const u8 { }; }, .macos, .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => { - const home_dir = std.os.getenv("HOME") orelse { + const home_dir = std.posix.getenv("HOME") orelse { // TODO look in /etc/passwd return error.HomeDirUnavailable; }; diff --git a/src/json.zig b/src/json.zig index 598f3d3..2633cb3 100644 --- a/src/json.zig +++ b/src/json.zig @@ -1361,7 +1361,7 @@ test "Value.jsonStringify" { var buffer: [10]u8 = undefined; var fbs = std.io.fixedBufferStream(&buffer); try (Value{ .Float = 42 }).jsonStringify(.{}, fbs.writer()); - try testing.expectEqualSlices(u8, fbs.getWritten(), "4.2e+01"); + try testing.expectEqualSlices(u8, fbs.getWritten(), "4.2e1"); } { var buffer: [10]u8 = undefined; @@ -2808,7 +2808,7 @@ pub fn stringify( const T = @TypeOf(value); switch (@typeInfo(T)) { .Float, .ComptimeFloat => { - return std.fmt.formatFloatScientific(value, std.fmt.FormatOptions{}, out_stream); + return std.fmt.format(out_stream, "{e}", .{value}); }, .Int, .ComptimeInt => { return std.fmt.formatIntValue(value, "", std.fmt.FormatOptions{}, out_stream); @@ -3057,11 +3057,11 @@ test "stringify basic types" { try teststringify("null", @as(?u8, null), StringifyOptions{}); try teststringify("null", @as(?*u32, null), StringifyOptions{}); try teststringify("42", 42, StringifyOptions{}); - try teststringify("4.2e+01", 42.0, StringifyOptions{}); + try teststringify("4.2e1", 42.0, StringifyOptions{}); try teststringify("42", @as(u8, 42), StringifyOptions{}); try teststringify("42", @as(u128, 42), StringifyOptions{}); - try teststringify("4.2e+01", @as(f32, 42), StringifyOptions{}); - try teststringify("4.2e+01", @as(f64, 42), StringifyOptions{}); + try teststringify("4.2e1", @as(f32, 42), StringifyOptions{}); + try teststringify("4.2e1", @as(f64, 42), StringifyOptions{}); try teststringify("\"ItBroke\"", @as(anyerror, error.ItBroke), StringifyOptions{}); } diff --git a/src/servicemodel.zig b/src/servicemodel.zig index a3ff8f6..0f26886 100644 --- a/src/servicemodel.zig +++ b/src/servicemodel.zig @@ -21,7 +21,7 @@ pub fn Services(comptime service_imports: anytype) type { // finally, generate the type return @Type(.{ .Struct = .{ - .layout = .Auto, // will be .auto in the future + .layout = .auto, .fields = &fields, .decls = &[_]std.builtin.Type.Declaration{}, .is_tuple = false,