Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ pub fn build(b: *std.Build) void {
// ── mcp-zig dependency ──
const mcp_dep = b.dependency("mcp_zig", .{});
exe.root_module.addImport("mcp", mcp_dep.module("mcp"));

// ── nanoregex dependency ──
const nanoregex_dep = b.dependency("nanoregex", .{});
exe.root_module.addImport("nanoregex", nanoregex_dep.module("nanoregex"));

b.installArtifact(exe);


// ── macOS codesign (ad-hoc by default; configurable for release builds) ──
if (target.result.os.tag == .macos and builtin.os.tag == .macos) {
const codesign = b.addSystemCommand(&.{ "codesign", "-f", "-s", codesign_identity });
Expand All @@ -58,6 +64,7 @@ pub fn build(b: *std.Build) void {
}),
});
tests.root_module.addImport("mcp", mcp_dep.module("mcp"));
tests.root_module.addImport("nanoregex", nanoregex_dep.module("nanoregex"));
if (test_filter) |f| {
const filters = b.allocator.alloc([]const u8, 1) catch @panic("oom");
filters[0] = f;
Expand All @@ -68,6 +75,7 @@ pub fn build(b: *std.Build) void {
const tests_run = b.addRunArtifact(tests);
test_step.dependOn(&tests_run.step);


// ── Library tests (verify the module root compiles) ──
const lib_tests = b.addTest(.{
.root_module = b.createModule(.{
Expand All @@ -88,8 +96,10 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}),
});
adversarial_tests.root_module.addImport("nanoregex", nanoregex_dep.module("nanoregex"));
test_step.dependOn(&b.addRunArtifact(adversarial_tests).step);


// ── Benchmarks ──
const bench = b.addExecutable(.{
.name = "bench",
Expand All @@ -102,6 +112,7 @@ pub fn build(b: *std.Build) void {
});
const bench_run = b.addRunArtifact(bench);
bench.root_module.addImport("mcp", mcp_dep.module("mcp"));
bench.root_module.addImport("nanoregex", nanoregex_dep.module("nanoregex"));
if (b.args) |args| bench_run.addArgs(args);
const bench_step = b.step("bench", "Run benchmarks");
bench_step.dependOn(&bench_run.step);
Expand All @@ -117,6 +128,7 @@ pub fn build(b: *std.Build) void {
}),
});
benchmark.root_module.addImport("mcp", mcp_dep.module("mcp"));
benchmark.root_module.addImport("nanoregex", nanoregex_dep.module("nanoregex"));
const benchmark_run = b.addRunArtifact(benchmark);
if (b.args) |args| benchmark_run.addArgs(args);
const benchmark_step = b.step("benchmark", "Run repo benchmark (use -- --root /path/to/repo)");
Expand All @@ -137,6 +149,7 @@ pub fn build(b: *std.Build) void {
.optimize = .ReleaseSmall,
}),
});
wasm.root_module.addImport("nanoregex", nanoregex_dep.module("nanoregex"));
wasm.rdynamic = true;
wasm.entry = .disabled;

Expand Down
4 changes: 4 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
.url = "https://github.com/justrach/mcp-zig/archive/refs/heads/feature/7-zig-0-16-0-migration.tar.gz",
.hash = "mcp_zig-0.2.0-_PilzNJkAQADzH2t3vqpd_nl_W0ta-gDaumXKttuPyBy",
},
.nanoregex = .{
.url = "https://github.com/justrach/nanoregex/archive/refs/heads/main.tar.gz",
.hash = "nanoregex-0.0.1-EdkhcXoqAgC6HvjxEqNIedT0YWMRfouWk8dh4G5ZC2L9",
},
},
.paths = .{
"src",
Expand Down
Loading
Loading