From 44e4ec57de3b3e2fdfa6dfef91a3ca72b8cb2d94 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 20 Sep 2024 22:22:24 -0400 Subject: feat: update to zig 0.13.0 (#24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update flake.lock Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/9bb1e7571aadf31ddb4af77fc64b2d59580f9a39' (2024-09-05) → 'github:NixOS/nixpkgs/268bb5090a3c6ac5e1615b38542a868b52ef8088' (2024-09-19) • Updated input 'zig-overlay': 'github:mitchellh/zig-overlay/9e2cc0e99621be1b765dc95a8ec80740a685b660' (2024-09-06) → 'github:mitchellh/zig-overlay/2419eb9f968f451e2c342a69ec44112de5aa36b9' (2024-09-21) * style: use nixfmt * style: format with nixfmt * refactor: use flake-utils * fix: only use `zig` in dev shell Pulling in `zig.hook` sets variables like `ZIG_GLOBAL_CACHE_DIR` that don't work too nicely outside of a Nix build process -- as in, Zig can't access files and fails * feat: update to zig 0.13.0 * chore: remove library output This isn't needed for this example --- build.zig | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 4316aaa..78147d3 100644 --- a/build.zig +++ b/build.zig @@ -15,23 +15,9 @@ 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 lib = b.addStaticLibrary(.{ - .name = "ziggy-with-it", - // In this case the main source file is merely a path, however, in more - // complicated build scripts, this could be a generated file. - .root_source_file = .{ .path = "src/root.zig" }, - .target = target, - .optimize = optimize, - }); - - // This declares intent for the library to be installed into the standard - // location when the user invokes the "install" step (the default step when - // running `zig build`). - b.installArtifact(lib); - const exe = b.addExecutable(.{ .name = "ziggy-with-it", - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); @@ -64,18 +50,8 @@ 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 lib_unit_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/root.zig" }, - .target = target, - .optimize = optimize, - }); - - const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); - const exe_unit_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); @@ -86,7 +62,6 @@ pub fn build(b: *std.Build) void { // the `zig build --help` menu, providing a way for the user to request // running the unit tests. const test_step = b.step("test", "Run unit tests"); - test_step.dependOn(&run_lib_unit_tests.step); test_step.dependOn(&run_exe_unit_tests.step); const dep = b.dependency("known-folders", .{}); -- cgit v1.2.3