authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2020-01-17 02:49:25-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-01-17 02:49:25-05:00
log9348609e6a409d688ae4899b6e3b8347e1c1353e
tree0f753799a1de181c6428fab96208c13896580d14
parentab2cb435e5e35a23f9674c2a382102de5f37449c
parentaf9eb7ac13b522c1880357ae7349a0b984b83ab4
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #4208 from mikdusan/contributing

doc: update contributing

1 files changed, 20 insertions(+), 15 deletions(-)

CONTRIBUTING.md+20-15
......@@ -51,23 +51,28 @@ knowledge of Zig internals.**
5151
5252### Editing Source Code
5353
54First, build the Stage 1 compiler as described in [the Building section](#building).
55
56One modification you may want to make is adding `-DZIG_SKIP_INSTALL_LIB_FILES=ON`
57to the cmake line. If you use the build directory as a working directory to run
58tests with, zig will find the lib files in the source directory, and they will not
59be "installed" every time you run `make`. This will allow you to make modifications
60directly to the standard library, for example, and have them effective immediately.
61Note that if you already ran `make` or `make install` with the default cmake
62settings, there will already be a `lib/` directory in your build directory. When
63executed from the build directory, zig will find this instead of the source lib/
64directory. Remove the unwanted directory so that the desired one can be found.
54First, build the Stage 1 compiler as described in [Building from Source](README.md#Building-from-Source).
55
56Zig locates lib files relative to executable path by searching up the
57filesystem tree for a sub-path of `lib/zig/std/std.zig` or `lib/std/std.zig`.
58Typically the former is an install and the latter a git working tree which
59contains the build directory.
60
61During development it is not necessary to perform installs when modifying
62stage1 or userland sources and in fact it is faster and simpler to run,
63test and debug from a git working tree.
64
65- `make` is typically sufficient to build zig during development iterations.
66- `make install` performs a build __and__ install.
67- `msbuild -p:Configuration=Release INSTALL.vcxproj` on Windows performs a
68build and install. To avoid install, pass cmake option `-DZIG_SKIP_INSTALL_LIB_FILES=ON`.
6569
6670To test changes, do the following from the build directory:
6771
681. Run `make install` (on POSIX) or
721. Run `make` (on POSIX) or
6973 `msbuild -p:Configuration=Release INSTALL.vcxproj` (on Windows).
702. `bin/zig build test` (on POSIX) or `bin\zig.exe build test` (on Windows).
742. `$BUILD_DIR/zig build test` (on POSIX) or
75 `$BUILD_DIR/Release\zig.exe build test` (on Windows).
7176
7277That runs the whole test suite, which does a lot of extra testing that you
7378likely won't always need, and can take upwards of 1 hour. This is what the
......@@ -85,8 +90,8 @@ Another example is choosing a different set of things to test. For example,
8590not the other ones. Combining this suggestion with the previous one, you could
8691do this:
8792
88`bin/zig build test-std -Dskip-release` (on POSIX) or
89`bin\zig.exe build test-std -Dskip-release` (on Windows).
93`$BUILD_DIR/bin/zig build test-std -Dskip-release` (on POSIX) or
94`$BUILD_DIR/Release\zig.exe build test-std -Dskip-release` (on Windows).
9095
9196This will run only the standard library tests, in debug mode only, for all
9297targets (it will cross-compile the tests for non-native targets but not run