Skip to content

Commit 967b503

Browse files
authored
Misc: drop support for OCaml < 4.13 (#1919)
* Misc: drop support for OCaml < 4.13 * smaller stdlib * CHANGES
1 parent 5e840e0 commit 967b503

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+85
-1139
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ jobs:
1717
os:
1818
- ubuntu-latest
1919
ocaml-compiler:
20-
- "4.08"
21-
- "4.09"
22-
- "4.10"
23-
- "4.11"
24-
- "4.12"
2520
- "4.13"
2621
- "5.0"
2722
- "5.1"

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# dev
22

33
## Features/Changes
4+
* Misc: drop support for OCaml 4.12 and bellow
45
* Compiler: use a Wasm text files preprocessor (#1822)
56
* Compiler: support for OCaml 4.14.3+trunk (#1844)
67
* Runtime: use es6 class (#1840)

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,4 @@ opam install odoc lwt_log yojson ocp-indent graphics higlo
2828

2929
### Running the tests
3030

31-
Tests are maintained for a single version of the OCaml compiler (currently 4.13).
32-
33-
Make sure to use the correct opam switch (e.g. `opam switch 4.13.1`).
34-
3531
Run `make tests`.

compiler/bin-js_of_ocaml/check_runtime.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ open Js_of_ocaml_compiler
2222

2323
let group_by_snd l =
2424
l
25-
|> List.sort_uniq ~compare:(fun (n1, l1) (n2, l2) ->
25+
|> List.sort_uniq ~cmp:(fun (n1, l1) (n2, l2) ->
2626
match Poly.compare l1 l2 with
2727
| 0 -> String.compare n1 n2
2828
| c -> c)
@@ -49,8 +49,8 @@ let f (runtime_files, bytecode, target_env) =
4949
let runtime_files, builtin =
5050
List.partition_map runtime_files ~f:(fun name ->
5151
match Builtins.find name with
52-
| Some t -> `Snd t
53-
| None -> `Fst name)
52+
| Some t -> Right t
53+
| None -> Left name)
5454
in
5555
let builtin =
5656
if false then builtin else Js_of_ocaml_compiler_runtime_files.runtime @ builtin

compiler/bin-js_of_ocaml/compile.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ let sourcemap_section_of_info
102102
| Some _ -> Filename.concat "/builtin" filename)
103103
in
104104
let ignore_list =
105-
List.filter sources ~f:(fun filename -> String.is_prefix ~prefix:"/builtin/" filename)
105+
List.filter sources ~f:(fun filename ->
106+
String.starts_with ~prefix:"/builtin/" filename)
106107
in
107108
let offset, mappings = Source_map.Mappings.encode_with_offset mappings in
108109
let map =
@@ -207,8 +208,8 @@ let run
207208
let runtime_files, builtin =
208209
List.partition_map runtime_files ~f:(fun name ->
209210
match Builtins.find name with
210-
| Some t -> `Snd t
211-
| None -> `Fst name)
211+
| Some t -> Right t
212+
| None -> Left name)
212213
in
213214
let t1 = Timer.make () in
214215
let builtin =

compiler/bin-wasm_of_ocaml/compile.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ let run
315315
let runtime_js_files, builtin =
316316
List.partition_map runtime_js_files ~f:(fun name ->
317317
match Builtins.find name with
318-
| Some t -> `Snd t
319-
| None -> `Fst name)
318+
| Some t -> Right t
319+
| None -> Left name)
320320
in
321321
let t1 = Timer.make () in
322322
let builtin = Js_of_ocaml_compiler_runtime_files.runtime @ builtin in

compiler/lib-runtime-files/gen/gen.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ let () =
5858
match Array.to_list Sys.argv with
5959
| [] -> assert false
6060
| _ :: rest ->
61-
let rest = List.sort_uniq ~compare:String.compare rest in
61+
let rest = List.sort_uniq ~cmp:String.compare rest in
6262
let fragments =
6363
List.map rest ~f:(fun f -> f, Js_of_ocaml_compiler.Linker.Fragment.parse_file f)
6464
in

compiler/lib-runtime-files/js_of_ocaml_compiler_runtime_files.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ let runtime =
3434
; hash
3535
; ieee_754
3636
; int64
37-
; internalMod
3837
; ints
3938
; io
4039
; jslib

compiler/lib-runtime-files/tests/all.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ let%expect_test _ =
3030
+hash.js
3131
+ieee_754.js
3232
+int64.js
33-
+internalMod.js
3433
+ints.js
3534
+io.js
3635
+jslib.js
@@ -51,7 +50,8 @@ let%expect_test _ =
5150
+toplevel.js
5251
+unix.js
5352
+weak.js
54-
+zstd.js |}];
53+
+zstd.js
54+
|}];
5555
printl runtime;
5656
[%expect
5757
{|
@@ -73,7 +73,6 @@ let%expect_test _ =
7373
+hash.js
7474
+ieee_754.js
7575
+int64.js
76-
+internalMod.js
7776
+ints.js
7877
+io.js
7978
+jslib.js
@@ -93,7 +92,8 @@ let%expect_test _ =
9392
+sys.js
9493
+unix.js
9594
+weak.js
96-
+zstd.js |}];
95+
+zstd.js
96+
|}];
9797
printl extra;
9898
[%expect {|
9999
+dynlink.js

compiler/lib/build_path_prefix_map.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ let decode_map str =
100100
| Ok str -> Some str
101101
| Error err -> raise (Shortcut err))
102102
in
103-
let pairs = String.split_char ~sep:':' str in
103+
let pairs = String.split_on_char ~sep:':' str in
104104
match List.map ~f:decode_or_empty pairs with
105105
| exception Shortcut err -> Error err
106106
| map -> Ok map
107107

108108
let rewrite_opt prefix_map path =
109109
let is_prefix = function
110110
| None -> false
111-
| Some { target = _; source } -> String.is_prefix path ~prefix:source
111+
| Some { target = _; source } -> String.starts_with path ~prefix:source
112112
in
113113
match
114114
List.find

0 commit comments

Comments
 (0)