upgrade to zig 0.13.0
All checks were successful
Generic zig build / build (push) Successful in 58s

This commit is contained in:
Emil Lerch 2024-06-08 10:44:17 -07:00
parent 7ce8fd1007
commit e26fc95f74
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
4 changed files with 8 additions and 7 deletions

View File

@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: elerch/setup-zig@v3 - uses: elerch/setup-zig@v3
with: with:
version: 0.12.0 version: 0.13.0
- uses: elerch/zig-action-cache@v1.1.6 - uses: elerch/zig-action-cache@v1.1.6
- name: Build project - name: Build project
run: zig build --summary all run: zig build --summary all

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ zig-out/
core core
src/worker_name.txt src/worker_name.txt
*.wasm *.wasm
.zig-cache

View File

@ -20,7 +20,7 @@ pub fn build(b: *std.Build) void {
.name = "zigwasi", .name = "zigwasi",
// In this case the main source file is merely a path, however, in more // In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file. // 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, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
@ -47,7 +47,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args); 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, // This creates a build step. It will be visible in the `zig build --help` menu,
// and can be selected like this: `zig build run` // 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 // Creates a step for unit testing. This only builds the test executable
// but does not run it. // but does not run it.
const unit_tests = b.addTest(.{ const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" }, .root_source_file = b.path("src/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
@ -83,7 +83,7 @@ pub fn configureBuild(b: *std.Build, cs: *std.Build.Step.Compile, function_name:
const deploy_cmd = CloudflareDeployStep.create( const deploy_cmd = CloudflareDeployStep.create(
b, b,
function_name, function_name,
.{ .path = "index.js" }, b.path("index.js"),
.{ .{
.primary_file_data = script, .primary_file_data = script,
.wasm_name = .{ .wasm_name = .{

View File

@ -51,7 +51,7 @@ pub fn create(
return self; 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; _ = prog_node;
const b = step.owner; const b = step.owner;
const self = @as(*CloudflareDeployStep, @fieldParentPtr("step", step)); 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(); defer client.deinit();
const script = self.options.primary_file_data orelse 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); defer if (self.options.primary_file_data == null) b.allocator.free(script);
var final_script = script; var final_script = script;