Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit 8df99c9

Browse files
authored
[zig] Update zap to 0.11 (#10805)
* [zig] Update zap to 0.11 * [zig] Zap 0.11 dockerfile fix * [zig] Added maintainers to zap
1 parent 6036706 commit 8df99c9

9 files changed

Lines changed: 138 additions & 293 deletions

File tree

frameworks/Zig/zap/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
zig-cache/**/*',
2-
zig-out: 'zig-out/**/*',
1+
.zig-cache/
2+
zig-out/

frameworks/Zig/zap/benchmark_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"framework": "zap",
3+
"maintainers": ["dragosv"],
34
"tests": [{
45
"default": {
56
"json_url": "/json",

frameworks/Zig/zap/build.zig

Lines changed: 16 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,41 @@
11
const std = @import("std");
2-
const ModuleMap = std.StringArrayHashMap(*std.Build.Module);
3-
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
4-
const allocator = gpa.allocator();
52

6-
// Although this function looks imperative, note that its job is to
7-
// declaratively construct a build graph that will be executed by an external
8-
// runner.
9-
pub fn build(b: *std.Build) !void {
10-
// Standard target options allows the person running `zig build` to choose
11-
// what target to build for. Here we do not override the defaults, which
12-
// means any target is allowed, and the default is native. Other options
13-
// for restricting supported target set are available.
3+
pub fn build(b: *std.Build) void {
144
const target = b.standardTargetOptions(.{});
15-
16-
// Standard optimization options allow the person running `zig build` to select
17-
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do nots
18-
// set a preferred release mode, allowing the user to decide how to optimize.
195
const optimize = b.standardOptimizeOption(.{});
206

21-
const dep_opts = .{ .target = target, .optimize = optimize };
22-
23-
const exe = b.addExecutable(.{
24-
.name = "zap",
25-
// In this case the main source file is merely a path, however, in more
26-
// complicated build scripts, this could be a generated file.
27-
.root_source_file = b.path("src/main.zig"),
7+
const zap = b.dependency("zap", .{
288
.target = target,
299
.optimize = optimize,
10+
.openssl = false,
3011
});
3112

32-
const zap = b.dependency("zap", .{
13+
const pg = b.dependency("pg", .{
3314
.target = target,
3415
.optimize = optimize,
35-
.openssl = false, // set to true to enable TLS support
3616
});
3717

38-
var modules = ModuleMap.init(allocator);
39-
defer modules.deinit();
40-
41-
const zap_module = b.dependency("zap", dep_opts).module("zap");
42-
const pg_module = b.dependency("pg", dep_opts).module("pg");
43-
44-
try modules.put("zap", zap_module);
45-
try modules.put("pg", pg_module);
46-
47-
// // Expose this as a module that others can import
48-
exe.root_module.addImport("zap", zap_module);
49-
exe.root_module.addImport("pg", pg_module);
50-
51-
exe.linkLibrary(zap.artifact("facil.io"));
18+
const exe = b.addExecutable(.{
19+
.name = "zap",
20+
.root_module = b.createModule(.{
21+
.root_source_file = b.path("src/main.zig"),
22+
.target = target,
23+
.optimize = optimize,
24+
.imports = &.{
25+
.{ .name = "zap", .module = zap.module("zap") },
26+
.{ .name = "pg", .module = pg.module("pg") },
27+
},
28+
}),
29+
});
5230

53-
// This declares intent for the executable to be installed into the
54-
// standard location when the user invokes the "install" step (the default
55-
// step when running `zig build`).
5631
b.installArtifact(exe);
5732

58-
// This *creates* a Run step in the build graph, to be executed when another
59-
// step is evaluated that depends on it. The next line below will establish
60-
// such a dependency.
6133
const run_cmd = b.addRunArtifact(exe);
62-
63-
// By making the run step depend on the install step, it will be run from the
64-
// installation directory rather than directly from within the cache directory.
65-
// This is not necessary, however, if the application depends on other installed
66-
// files, this ensures they will be present and in the expected location.
6734
run_cmd.step.dependOn(b.getInstallStep());
68-
69-
// This allows the user to pass arguments to the application in the build
70-
// command itself, like this: `zig build run -- arg1 arg2 etc`
7135
if (b.args) |args| {
7236
run_cmd.addArgs(args);
7337
}
7438

75-
// This creates a build step. It will be visible in the `zig build --help` menu,
76-
// and can be selected like this: `zig build run`
77-
// This will evaluate the `run` step rather than the default, which is "install".
7839
const run_step = b.step("run", "Run the app");
7940
run_step.dependOn(&run_cmd.step);
8041
}

frameworks/Zig/zap/build.zig.zon

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
.{ .name = "Zap testing", .version = "0.1.1", .paths = .{
2-
"build.zig",
3-
"build.zig.zon",
4-
"src",
5-
}, .dependencies = .{
6-
.zap = .{
7-
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.8.0.tar.gz",
8-
.hash = "12209936c3333b53b53edcf453b1670babb9ae8c2197b1ca627c01e72670e20c1a21",
1+
.{
2+
.name = .zap_testing,
3+
.version = "0.2.1",
4+
.fingerprint = 0x40157312a106e70e,
5+
.paths = .{
6+
"build.zig",
7+
"build.zig.zon",
8+
"src",
99
},
10-
.pg = .{ .url = "https://github.com/karlseguin/pg.zig/archive/239a4468163a49d8c0d03285632eabe96003e9e2.tar.gz",
11-
.hash = "1220a1d7e51e2fa45e547c76a9e099c09d06e14b0b9bfc6baa89367f56f1ded399a0" },
12-
} }
10+
.dependencies = .{
11+
.zap = .{
12+
.url = "git+https://github.com/zigzap/zap?ref=v0.11.0#66c5dc42c781bbb8a9100afda3c7e69ee96eddf3",
13+
.hash = "zap-0.10.6-GoeB8xCEJABLgoiZjWZMMT5TsoZ5OO2EZe6j24RTUYEH",
14+
},
15+
.pg = .{
16+
.url = "git+https://github.com/karlseguin/pg.zig?ref=master#e58b318b7867ef065b3135983f829219c5eef891",
17+
.hash = "pg-0.0.0-Wp_7gXFoBgD0fQ72WICKa-bxLga03AXXQ3BbIsjjohQ3",
18+
},
19+
},
20+
}

0 commit comments

Comments
 (0)