I’m not sure what you mean by “single file scripts”.
So far, I don’t mind having to maintain both build.zig
and build.zig.zon
. But I’d like to avoid updating 3 different places for each imported module, before being able to do @import("mymodule")
:
- First in
build.zig.zon
:.ws = .{ .url = "git+https://github.com/karlseguin/websocket.zig.git#c0a6c4963dcd963cdb110b465077b3a04bd321e6", .hash = "1220376acac4a7fa2c1772d0bd2a1d030513fb3599322552f11c5bd743de58d0e486", },
- Then in
zig.build
:const ws = b.dependency("ws", .{});
- Finally, still in
zig.build
:exe.root_module.addImport("ws", ws.module("websocket"));
To be honest, I haven’t really thought about the problem, and the solution. Coming from Go or Rust, it just feels repetitive. Is there a reason for the current design, or is there a possibility to eliminate the repetition for the more common use case?
The code above illustrating the “problem” is from bork/build.zig at master · kristoff-it/bork · GitHub.