diff --git a/.github/workflows/zig-build.yaml b/.github/workflows/zig-build.yaml index f3876b3..3ead6ab 100644 --- a/.github/workflows/zig-build.yaml +++ b/.github/workflows/zig-build.yaml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4 - uses: elerch/setup-zig@v3 with: - version: 0.12.0 + version: 0.13.0 - uses: elerch/zig-action-cache@v1.1.6 - name: Build project run: zig build --summary all diff --git a/.gitignore b/.gitignore index 1b80de7..9e7c4c9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ zig-out/ core src/worker_name.txt *.wasm +.zig-cache diff --git a/build.zig b/build.zig index 6e3f3ca..439cb8d 100644 --- a/build.zig +++ b/build.zig @@ -20,7 +20,7 @@ pub fn build(b: *std.Build) void { .name = "zigwasi", // 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/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); @@ -47,7 +47,7 @@ pub fn build(b: *std.Build) void { run_cmd.addArgs(args); } - const deploy_cmd = CloudflareDeployStep.create(b, "zigwasi", .{ .path = "index.js" }, .{ .compile_target = exe }); + const deploy_cmd = CloudflareDeployStep.create(b, "zigwasi", b.path("index.js"), .{ .compile_target = exe }); // This creates a build step. It will be visible in the `zig build --help` menu, // and can be selected like this: `zig build run` @@ -63,7 +63,7 @@ pub fn build(b: *std.Build) void { // Creates a step for unit testing. This only builds the test executable // but does not run it. const unit_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); @@ -83,7 +83,7 @@ pub fn configureBuild(b: *std.Build, cs: *std.Build.Step.Compile, function_name: const deploy_cmd = CloudflareDeployStep.create( b, function_name, - .{ .path = "index.js" }, + b.path("index.js"), .{ .primary_file_data = script, .wasm_name = .{ diff --git a/src/CloudflareDeployStep.zig b/src/CloudflareDeployStep.zig index dbed8be..61cec83 100644 --- a/src/CloudflareDeployStep.zig +++ b/src/CloudflareDeployStep.zig @@ -51,7 +51,7 @@ pub fn create( return self; } -fn make(step: *std.Build.Step, prog_node: *std.Progress.Node) !void { +fn make(step: *std.Build.Step, prog_node: std.Progress.Node) !void { _ = prog_node; const b = step.owner; const self = @as(*CloudflareDeployStep, @fieldParentPtr("step", step)); @@ -66,7 +66,7 @@ fn make(step: *std.Build.Step, prog_node: *std.Progress.Node) !void { defer client.deinit(); const script = self.options.primary_file_data orelse - try std.fs.cwd().readFileAlloc(b.allocator, self.primary_javascript_path.path, std.math.maxInt(usize)); + try std.fs.cwd().readFileAlloc(b.allocator, self.primary_javascript_path.src_path.sub_path, std.math.maxInt(usize)); defer if (self.options.primary_file_data == null) b.allocator.free(script); var final_script = script;