Skip to content

Commit 5ae38c4

Browse files
authored
Merge pull request #3834 from BuckleScript/update_docs_for_contrib
Update contribution guide line && remove staled docs
2 parents 8b3a3a4 + 1b3e7a2 commit 5ae38c4

File tree

1 file changed

+6
-41
lines changed

1 file changed

+6
-41
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,11 @@ This is primarily used when you need to test the repo with a different OCaml tha
6161
For example, you might be testing BuckleScript on the 4.06 OCaml compiler instead of 4.02. Clone our patched [OCaml 4.06](https://github.com/bucklescript/ocaml), then do:
6262

6363
```
64-
./configure -prefix `pwd` && make -j9 world.opt && make install
64+
git -C ocaml checkout 4.06.1+BS && node ./scripts/buildocaml.js
6565
```
6666

67-
Make sure the new compiler (`ocamlopt.opt`) is in your environment:
68-
69-
```
70-
export PATH="/absolute-path-to-the-bucklescript-forked-ocaml-repo/bin:$PATH"
71-
```
72-
73-
Then:
74-
7567
```
76-
./scripts/ninja.js -env && ninja -C jscomp -f env.ninja
77-
```
78-
79-
Done!
80-
81-
Tip: you can also quickly switch between the environment compiler and the vendored one like so:
82-
83-
```
84-
ninja -C jscomp -f env.ninja -t clean && ninja -C jscomp
85-
```
86-
87-
```
88-
ninja -C jscomp -t clean && ninja -C jscomp -f env.ninja
68+
./scripts/ninja.js cleanbuild
8969
```
9070

9171
Note: clean up is necessary since the binary artifacts between versions of compiler may be incompatible.
@@ -100,36 +80,21 @@ cd foo
10080
npm run build
10181
```
10282

103-
And whenever you modify a file in bucklescript, run this inside `jscomp/`:
83+
And whenever you modify a file in bucklescript, run this:
10484

10585
```
106-
make ../lib/bsc.exe && ./install-bsc.sh # build the compiler and make it available globally
107-
make ../lib/bsb.exe && ./install-bsb.sh # build the build system and make it available globally
86+
npm install -g .
10887
```
10988

110-
This will substitute the global `bsc.exe` & `bsb.exe` you just installed with the newly built one. Then run `npm run build` again in the dummy project and see the changes! The iteration cycle for testing these should be around 2 seconds =).
111-
112-
## Troubleshooting
113-
114-
Did any of the above step not work?
115-
116-
- If you get compilation errors even from a supposedly clean compilation, you might have skipped the opam reinstall step above: `opam switch reinstall 4.02.3+buckle-master`
117-
- Make sure you did ``eval `opam config env` `` in your CLI/bashrc/zshrc
118-
- **If the vendored ocaml changed between when you last iterated on the repo and now**, you probably skipped the `opam switch reinstall 4.02.3+buckle-master` part. You'll have to do `git clean -xdf` and then restart with the build instructions. Careful, as `git clean` removes your uncommitted changes.
119-
- **If these fail too**, make sure you do have the correct `ocamlopt` in your environment: `which ocamlopt` should show an `opam` path, not `reason-cli` path. If you see the latter, this means it overrode the global `ocamlopt` BuckleScript needed. In this case, either temporarily uninstall reason-cli or make sure your opam PATH overrides the reason-cli PATH (and not the other way around) in your bashrc/zshrc.
120-
121-
Whenever there are dependencies changes: do `make depend` in the specific directory, when available. This allows the makefile to track new dependencies.
12289

12390
## Change the Vendored OCaml Compiler
12491

12592
This section is reserved for when you're making a change to the vendored ocaml compiler itself, in `ocaml`, and then testing on super-errors changes at the same time. If you're doing this for whatever reason, then the previous quick iteration workflow wouldn't work. Here's what you have to do after each change:
12693

12794
```
12895
# at project root
129-
cd jscomp
130-
make force-snapshotml # make sure your changes are reflected in jscomp/bin/whole_compiler.ml
131-
make -C ../lib bsc.exe && ./install-bsc.sh
132-
make -C ../lib bsb.exe && ./install-bsb.sh
96+
cd ocaml && make -j9 world.opt && make install && cd ..
97+
./scripts/ninja.js cleanbuild
13398
```
13499

135100
## Contributing to the runtime

0 commit comments

Comments
 (0)