From ffdd31d7b0acf7f4a7baf81f0fa7e5a3a45c357d Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Mon, 25 Aug 2025 10:39:29 -0700 Subject: [PATCH] upgrade example to 0.15.1 --- example/build.zig | 19 ++++++++++++------- example/build.zig.zon | 4 ++-- example/src/main.zig | 8 ++++---- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/example/build.zig b/example/build.zig index 64c028f..24d1e03 100644 --- a/example/build.zig +++ b/example/build.zig @@ -15,15 +15,17 @@ pub fn build(b: *std.Build) void { // set a preferred release mode, allowing the user to decide how to optimize. const optimize = b.standardOptimizeOption(.{}); - const exe = b.addExecutable(.{ - .name = "tmp", - // In this case the main source file is merely a path, however, in more - // complicated build scripts, this could be a generated file. + const mod_exe = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); + const exe = b.addExecutable(.{ + .name = "tmp", + .root_module = mod_exe, + }); + const aws_dep = b.dependency("aws", .{ // These are the two arguments to the dependency. It expects a target and optimization level. .target = target, @@ -59,13 +61,16 @@ pub fn build(b: *std.Build) void { const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); - // Creates a step for unit testing. This only builds the test executable - // but does not run it. - const unit_tests = b.addTest(.{ + const mod_unit_tests = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); + // Creates a step for unit testing. This only builds the test executable + // but does not run it. + const unit_tests = b.addTest(.{ + .root_module = mod_unit_tests, + }); const run_unit_tests = b.addRunArtifact(unit_tests); diff --git a/example/build.zig.zon b/example/build.zig.zon index a4053f6..72fa7aa 100644 --- a/example/build.zig.zon +++ b/example/build.zig.zon @@ -6,8 +6,8 @@ .dependencies = .{ .aws = .{ - .url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/7a6086447c1249b0e5b5b5f3873d2f7932bea56d/7a6086447c1249b0e5b5b5f3873d2f7932bea56d-with-models.tar.gz", - .hash = "aws-0.0.1-SbsFcGN_CQCBjurpc2GEMw4c_qAkGu6KpuVnLBLY4L4q", + .url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/e29829f2a0144a974a00d7b2372e3a03a015d98d/e29829f2a0144a974a00d7b2372e3a03a015d98d-with-models.tar.gz", + .hash = "aws-0.0.1-SbsFcNntCQDBi1FVdiZaWpqR7kF3XGlRQXB4S6gpWALQ", }, }, } diff --git a/example/src/main.zig b/example/src/main.zig index 699a33e..3c3d4ee 100644 --- a/example/src/main.zig +++ b/example/src/main.zig @@ -15,10 +15,10 @@ pub fn main() anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - const stdout_raw = std.io.getStdOut().writer(); - var bw = std.io.bufferedWriter(stdout_raw); - defer bw.flush() catch unreachable; - const stdout = bw.writer(); + var stdout_buffer: [1024]u8 = undefined; + var stdout_raw = std.fs.File.stdout().writer(&stdout_buffer); + const stdout = &stdout_raw.interface; + defer stdout.flush() catch unreachable; // To use a proxy, uncomment the following with your own configuration // const proxy = std.http.Proxy{