From e64c0dee35a6da1f9e538cc822f52e800a4cef99 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sun, 21 Apr 2019 15:14:42 -0700 Subject: [PATCH 1/3] readme: Add instructions for making changes to the standard library Closes #2324 --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index 197c80fb18..520efb221f 100644 --- a/README.md +++ b/README.md @@ -223,3 +223,43 @@ use stage 1. ``` ./stage2/bin/zig build --build-file ../build.zig install -Drelease-fast ``` + +## Developing Zig + +### Standard Library + +First, build the Stage 1 compiler as described in [the Building section](#building). + +Then, make your changes to the standard library files in `std`. After every change, +(from the build directory you used to build the compiler) run either `make install` +(on POSIX) or `msbuild -p:Configuration=Release INSTALL.vcxproj` (on Windows) as +well as the relevant tests using `bin/zig test `. + +Once your changes are finished, run all the zig tests (while skipping the longer +test process for all possible platforms) by running the following (also from the +build directory you used to build the compiler): + +``` +bin/zig build --build-file ../build.zig test -Dskip-release +``` + +For example, when making changes to `std/heap.zig` on POSIX: + +```sh +# build and install compiler in 'build' directory +mkdir build +cd build +... +# make changes to std/heap.zig +nano ../std/heap.zig +# install and test changes +make install +bin/zig test std/heap.zig +# more changes to std/heap.zig +nano ../std/heap.zig +# install and test changes +make install +bin/zig test std/heap.zig +# run all the tests +bin/zig build --build-file ../build.zig test -Dskip-release +``` From af7daae26b874a40319041cce784645b03aa8fb3 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sun, 21 Apr 2019 21:53:35 -0700 Subject: [PATCH 2/3] readme: Simplify instructions for making changes to the standard library --- README.md | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 520efb221f..7e2e124a9e 100644 --- a/README.md +++ b/README.md @@ -229,37 +229,20 @@ use stage 1. ### Standard Library First, build the Stage 1 compiler as described in [the Building section](#building). +Then, make your changes to the standard library files in `std` (note: not +`build/lib/zig/std`). To test changes to the standard library, do the following +from the build directory: -Then, make your changes to the standard library files in `std`. After every change, -(from the build directory you used to build the compiler) run either `make install` -(on POSIX) or `msbuild -p:Configuration=Release INSTALL.vcxproj` (on Windows) as -well as the relevant tests using `bin/zig test `. +1. Run `make install` (on POSIX) or `msbuild -p:Configuration=Release INSTALL.vcxproj` + (on Windows). +2. Test your changes with `bin/zig test ` (e.g. `bin/zig test std/heap.zig`). -Once your changes are finished, run all the zig tests (while skipping the longer -test process for all possible platforms) by running the following (also from the -build directory you used to build the compiler): +Once your changes are finished, run all the zig tests from the build directory: ``` bin/zig build --build-file ../build.zig test -Dskip-release ``` -For example, when making changes to `std/heap.zig` on POSIX: - -```sh -# build and install compiler in 'build' directory -mkdir build -cd build -... -# make changes to std/heap.zig -nano ../std/heap.zig -# install and test changes -make install -bin/zig test std/heap.zig -# more changes to std/heap.zig -nano ../std/heap.zig -# install and test changes -make install -bin/zig test std/heap.zig -# run all the tests -bin/zig build --build-file ../build.zig test -Dskip-release -``` +*Note: The `-Dskip-release` flag will skip running the longer test process that tests +all possible build configurations. This shorter test process is good enough when +submitting pull requests* From 6936f0514f1fb2625bdaa070dccc5bd3ef23d377 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Fri, 26 Apr 2019 14:14:48 -0700 Subject: [PATCH 3/3] readme: Fix filepath to test file when testing std lib changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e2e124a9e..6b1b2b2238 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ from the build directory: 1. Run `make install` (on POSIX) or `msbuild -p:Configuration=Release INSTALL.vcxproj` (on Windows). -2. Test your changes with `bin/zig test ` (e.g. `bin/zig test std/heap.zig`). +2. Test your changes with `bin/zig test lib/zig/std/` (e.g. `bin/zig test lib/zig/std/heap.zig`). Once your changes are finished, run all the zig tests from the build directory: