ziglang/zig
Development workflow
The build entry point is build.zig
Everything starts at build.zig. The build(b: *std.Build) function:
- Defines the compiler executable (driven by
src/main.zig). - Generates
lib/docs/(autodoc) anddoc/langref.html. - Constructs every
test-*step (thetestsimport maps totest/tests.zig). - Exposes the user-facing options:
-Donly-c,-Dno-bin,-Dskip-install-lib-files,-Dno-langref,-Dstd-docs,-Dflat,-Dsingle-threaded,-Duse-zig-libcxx,-Denable-superhtml.
build.zig.zon declares two local-path dependencies, both pointing into the test tree (test/standalone and test/link), so the build graph treats those test suites as packages.
Iteration loop
# Build the compiler in Debug.
zig build
# Build with the C backend (portable, slow). Used for bootstrapping.
zig build -Donly-c
# Skip copying lib/ files; speeds up edits in src/ when you don't need them.
zig build -Dskip-install-lib-files
# Build only the language reference / autodoc.
zig build langref
zig build std-docsThe output binary lands in zig-out/bin/zig (or whatever --prefix targets). Run that directly for any quick test:
./zig-out/bin/zig build-exe path/to/test.zig
./zig-out/bin/zig test path/to/test.zig
./zig-out/bin/zig fmt path/to/test.zigBranching and review
There is no CONTRIBUTING.md or CODEOWNERS checked in. The conventions visible in git log are:
- Linear, fast-forward history for the master branch (no merge commits).
- Commit messages tend to be short and imperative ("Sema: fix X", "x86_64: handle Y").
- Reviews happen on the upstream forge (currently Codeberg per the README pointer).
CI parity
Before sending a change, run the same script CI would:
sh ci/x86_64-linux-debug.shEach script is small and self-contained; reading ci/<target>-<mode>.sh shows exactly what flags are passed and which test step is gated on that platform. PowerShell equivalents (ci/*.ps1) exist for Windows targets.
Issue templates
.forgejo/ISSUE_TEMPLATE/ carries the templates used on the forge for new bug reports and proposals.
Avoiding common rebuilds
- Use
-Dno-binif you only want to validate that the source compiles without producing a binary. - Use
-Dskip-install-lib-fileswhile iterating to avoid copyinglib/every build. - Use
-Dno-langrefif you don't need to regeneratedoc/langref.html.
Watch mode
zig build --watch (driven by lib/std/Build/Watch.zig and lib/std/Build/Fuzz.zig) re-runs only the affected steps when files change. This is the day-to-day workflow for language and stdlib edits because it dovetails with the compiler's incremental analysis (src/IncrementalDebugServer.zig, tools/incr-check.zig).
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.