This commit is contained in:
parent
7ce8fd1007
commit
e26fc95f74
2
.github/workflows/zig-build.yaml
vendored
2
.github/workflows/zig-build.yaml
vendored
|
@ -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
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ zig-out/
|
|||
core
|
||||
src/worker_name.txt
|
||||
*.wasm
|
||||
.zig-cache
|
||||
|
|
|
@ -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 = .{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user