summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md34
1 files changed, 24 insertions, 10 deletions
diff --git a/README.md b/README.md
index 4aa4887..aa9448d 100644
--- a/README.md
+++ b/README.md
@@ -59,17 +59,31 @@ zig fetch --save=cloud9 git+https://git.sr.ht/~gbrls/cloud9#<commit>
The toolchain has no `git+ssh` support, so the manifest carries the read-only
HTTPS URL. Push to `[email protected]:~gbrls/cloud9`. For work on both packages at
-once, substitute `.cloud9 = .{ .path = "../cloud9" }` while editing, then
-re-pin. Either way, import the module the same way:
+once, build against the checkout without touching the manifest:
+`zig build --fork=../cloud9`.
+
+The package exports two modules, `cloud9` and `9proc`, with no target or
+optimize of their own: they compile for whatever imports them, so the
+dependency takes no options. The whole `build.zig` of a program on cloud9:
```zig
-const cloud9 = b.dependency("cloud9", .{
- .target = target,
- .optimize = optimize,
-}).module("cloud9");
-app.root_module.addImport("cloud9", cloud9);
+const std = @import("std");
+
+pub fn build(b: *std.Build) void {
+ const exe = b.addExecutable(.{ .name = "srv", .root_module = b.createModule(.{
+ .root_source_file = b.path("src/main.zig"),
+ .target = b.standardTargetOptions(.{}),
+ .optimize = b.standardOptimizeOption(.{}),
+ .imports = &.{.{ .name = "cloud9", .module = b.dependency("cloud9", .{}).module("cloud9") }},
+ }) });
+ b.installArtifact(exe);
+}
```
+Nothing else of cloud9's build runs in yours: its tests and programs are
+configured only when it is the root. [`test/consumer`](test/consumer/build.zig)
+is such a package, and cloud9's `zig build test` builds and runs it.
+
Start a client with `Client.init(.{ .in = input_buffer, .out = output_buffer })`.
Submit `.version` first. Drain `output()` through your transport and report the
number sent with `wrote()`. Feed received bytes using `push()` and collect tagged
@@ -151,9 +165,9 @@ enabled program's unit and integration steps. A dependent package gets both
modules from the one dependency:
```zig
-const cloud9_dep = b.dependency("cloud9", .{ .target = target, .optimize = optimize });
-app.root_module.addImport("cloud9", cloud9_dep.module("cloud9"));
-app.root_module.addImport("9proc", cloud9_dep.module("9proc"));
+const cloud9 = b.dependency("cloud9", .{});
+app.root_module.addImport("cloud9", cloud9.module("cloud9"));
+app.root_module.addImport("9proc", cloud9.module("9proc"));
```
See [design and ownership contracts](docs/design.md),