Skip to content

Commit

Permalink
Update to Zig master
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyhall committed Jun 19, 2024
1 parent e192dcc commit 9a16dd5
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 21 deletions.
8 changes: 4 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ pub fn build(b: *std.Build) !void {

const lib = b.addStaticLibrary(.{
.name = "tomlz",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
b.installArtifact(lib);

_ = b.addModule("tomlz", .{ .root_source_file = .{ .path = "src/main.zig" } });
_ = b.addModule("tomlz", .{ .root_source_file = b.path("src/main.zig") });

const main_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
Expand All @@ -27,7 +27,7 @@ pub fn build(b: *std.Build) !void {

const fuzz_exe = b.addExecutable(.{
.name = "fuzz",
.root_source_file = .{ .path = "src/fuzz.zig" },
.root_source_file = b.path("src/fuzz.zig"),
.target = target,
});
fuzz_exe.linkLibC();
Expand Down
183 changes: 173 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
zls = {
url = "github:zigtools/zls";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
Expand All @@ -14,24 +18,27 @@
};
};

outputs = {self, nixpkgs, flake-utils, flake-compat, zig}:
outputs = {self, nixpkgs, flake-utils, zls, flake-compat, zig}:
let
overlays = [
(final: prev: {
zigpkgs = zig.packages.${prev.system};
})
(final: prev: {
zlspkgs = zls.packages.${prev.system};
})
];
systems = builtins.attrNames zig.packages;
in
flake-utils.lib.eachSystem systems (system:
let
pkgs = import nixpkgs { inherit overlays system; };
in
rec {
{
devShell = pkgs.mkShell {
buildInputs = (with pkgs; [
zigpkgs."0.12.0"
zls
zigpkgs.master-2024-06-18
zlspkgs.default
bashInteractive
gdb
lldb
Expand Down
6 changes: 3 additions & 3 deletions src/integration_tests.zig
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ fn testValid(dir: *const std.fs.Dir, path: []const u8, basename: []const u8) !bo
// standard tests

test "invalid" {
var dir = try std.fs.cwd().makeOpenPath("tests/invalid", .{});
var dir = try std.fs.cwd().makeOpenPath("tests/invalid", .{.iterate = true});
defer dir.close();

var fail = false;
Expand All @@ -245,7 +245,7 @@ test "invalid" {
}

test "valid" {
var dir = try std.fs.cwd().makeOpenPath("tests/valid", .{});
var dir = try std.fs.cwd().makeOpenPath("tests/valid", .{.iterate = true});
defer dir.close();

var fail = false;
Expand All @@ -265,7 +265,7 @@ test "valid" {
// fuzz error case tests

test "fuzz" {
var dir = try std.fs.cwd().makeOpenPath("tests/fuzzing", .{});
var dir = try std.fs.cwd().makeOpenPath("tests/fuzzing", .{.iterate = true});
defer dir.close();

var walker = try dir.walk(testing.allocator);
Expand Down

0 comments on commit 9a16dd5

Please sign in to comment.