-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Leandro Ostera <[email protected]>
- Loading branch information
Showing
3 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Contributing | ||
|
||
Thanks for contributing to UTop! | ||
|
||
## Setting up local switches | ||
|
||
UTop comes from a `dune-workspace.dev` file to test it across all supported | ||
versions. | ||
|
||
Run `make create-switches` to create all the required switches. | ||
|
||
Now you can run `dune` with the `--workspace dev-workspace.dev` flag to run | ||
the same command across all the workspaces. The `make | ||
all-supported-ocaml-versions` command will build the project with this setup. | ||
|
||
## Compatibility Across Versions | ||
|
||
Some code will be different from one version of OCaml to the next. If you find | ||
some that does, please abstract it away using the `UTop_compat` module. | ||
|
||
For example, the `Load_path.get_paths ()` function has changed recently to | ||
return a record with shape `{ visible: string list; hidden: string list }`, but | ||
this function used to return a single `string list`. | ||
|
||
Defining this function using pre-processor macros allows us to give the same | ||
function two different bodies on different version of the language. | ||
|
||
```ocaml | ||
let get_load_path () = | ||
#if OCAML_VERSION >= (5, 2, 0) | ||
Load_path.((get_paths ()).visible) | ||
#else | ||
Load_path.get_paths () | ||
#endif | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
(lang dune 1.0) | ||
;; This file is used by `make all-supported-ocaml-versions` | ||
(context (opam (switch 4.02.3))) | ||
(context (opam (switch 4.03.0))) | ||
(context (opam (switch 4.04.2))) | ||
(context (opam (switch 4.05.0))) | ||
(context (opam (switch 4.06.1))) | ||
(context (opam (switch 4.07.0))) | ||
(context (opam (switch utop-411))) | ||
(context (opam (switch utop-412))) | ||
(context (opam (switch utop-413))) | ||
(context (opam (switch utop-414))) | ||
(context (opam (switch utop-500))) | ||
(context (opam (switch utop-510))) |