| ... | ... | @@ -223,3 +223,43 @@ use stage 1. |
| 223 | 223 | ``` |
| 224 | 224 | ./stage2/bin/zig build --build-file ../build.zig install -Drelease-fast |
| 225 | 225 | ``` |
| 226 | |
| 227 | ## Developing Zig |
| 228 | |
| 229 | ### Standard Library |
| 230 | |
| 231 | First, build the Stage 1 compiler as described in [the Building section](#building). |
| 232 | |
| 233 | Then, make your changes to the standard library files in `std`. After every change, |
| 234 | (from the build directory you used to build the compiler) run either `make install` |
| 235 | (on POSIX) or `msbuild -p:Configuration=Release INSTALL.vcxproj` (on Windows) as |
| 236 | well as the relevant tests using `bin/zig test <file>`. |
| 237 | |
| 238 | Once your changes are finished, run all the zig tests (while skipping the longer |
| 239 | test process for all possible platforms) by running the following (also from the |
| 240 | build directory you used to build the compiler): |
| 241 | |
| 242 | ``` |
| 243 | bin/zig build --build-file ../build.zig test -Dskip-release |
| 244 | ``` |
| 245 | |
| 246 | For example, when making changes to `std/heap.zig` on POSIX: |
| 247 | |
| 248 | ```sh |
| 249 | # build and install compiler in 'build' directory |
| 250 | mkdir build |
| 251 | cd build |
| 252 | ... |
| 253 | # make changes to std/heap.zig |
| 254 | nano ../std/heap.zig |
| 255 | # install and test changes |
| 256 | make install |
| 257 | bin/zig test std/heap.zig |
| 258 | # more changes to std/heap.zig |
| 259 | nano ../std/heap.zig |
| 260 | # install and test changes |
| 261 | make install |
| 262 | bin/zig test std/heap.zig |
| 263 | # run all the tests |
| 264 | bin/zig build --build-file ../build.zig test -Dskip-release |
| 265 | ``` |