// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie // SPDX-License-Identifier: MIT //! zig-http and zig-dns-client together, which zig-http's own build cannot //! have: zig-dns-client speaks DNS over HTTPS with zig-http, so a dependency //! the other way is a circle. This is a project of its own, with a //! `build.zig.zon` of its own, that depends on both -- zig-http by path, as the //! checkout it sits in -- so that proving RFC 9460 end to end costs zig-http's //! build, and every project depending on zig-http, nothing at all. //! //! `zig build test` runs `src/e2e.zig`. The `https_records` module is the glue //! a program using both libraries needs, and is the example of it. const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const http_dep = b.dependency("http", .{ .target = target, .optimize = optimize }); const dns_client_dep = b.dependency("dns_client", .{ .target = target, .optimize = optimize }); const dns_dep = b.dependency("dns", .{ .target = target, .optimize = optimize }); const glue = b.addModule("https_records", .{ .root_source_file = b.path("src/glue.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "http_io", .module = http_dep.module("http_io") }, .{ .name = "dns_client", .module = dns_client_dep.module("dns_client") }, }, }); const e2e = b.createModule(.{ .root_source_file = b.path("src/e2e.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "http", .module = http_dep.module("http") }, .{ .name = "http_io", .module = http_dep.module("http_io") }, .{ .name = "dns_client", .module = dns_client_dep.module("dns_client") }, .{ .name = "dns", .module = dns_dep.module("dns") }, .{ .name = "https_records", .module = glue }, }, }); const test_step = b.step("test", "Run the end-to-end test of HTTPS records"); test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = e2e })).step); test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = glue })).step); }