Skip to content

Commit 34f04af

Browse files
authored
Merge pull request #408 from AltGr/ocaml-412-port
Port to OCaml 4.12
2 parents 65ce0c4 + 82cea09 commit 34f04af

File tree

95 files changed

+1237
-1589
lines changed

Some content is hidden

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

95 files changed

+1237
-1589
lines changed

.ci-macosx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ brew update
66
brew install pkg-config
77
brew install opam
88
brew install libev
9-
opam init -y --compiler=4.05.0
9+
opam init -y --compiler=4.12.0
1010
eval $(opam env)
1111

1212
opam install -y -j 2 . --deps-only --locked

.github/workflows/static-builds.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,16 @@ jobs:
4646
sw_vers
4747
system_profiler SPSoftwareDataType
4848
uname -a
49-
# Need unreleased 2.1.0~rc
50-
# - name: Retrieve opam
51-
# run: |
52-
# mkdir "$HOME/bin"
53-
# wget https://github.com/ocaml/opam/releases/download/2.1.0-beta2/opam-2.1.0-beta2-x86_64-macos -O $HOME/bin/opam
54-
# chmod a+x $HOME/bin/opam
55-
# echo "$HOME/bin" >> $GITHUB_PATH
56-
- name: Install latest opam
49+
- name: Retrieve opam
5750
run: |
58-
brew install opam --HEAD
51+
mkdir "$HOME/bin"
52+
wget https://github.com/ocaml/opam/releases/download/2.1.0/opam-2.1.0-x86_64-macos -O $HOME/bin/opam
53+
chmod a+x $HOME/bin/opam
54+
echo "$HOME/bin" >> $GITHUB_PATH
5955
- name: Prepare build environment
6056
run: |
6157
opam init -a --bare
62-
opam switch create . ocaml-base-compiler 'dune<2' --deps-only
58+
opam switch create . ocaml-base-compiler --deps-only
6359
- name: Build the binaries
6460
run: |
6561
opam exec -- make LINKING_MODE=static

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@ _opam
66
.opam-switch
77
Makefile.local
88
docker/
9-
src/ppx-metaquot/ast_lifter.ml
109

1110
learnocaml-server.byte
1211
learn-ocaml.install
1312

14-
src/grader/embedded_cmis.ml
15-
src/grader/embedded_grading_cmis.ml
16-
1713
demo-repository/exercises/*.stderr
1814
demo-repository/exercises/*.stdout
1915
demo-repository/exercises/*.outcomes

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
FROM ocaml/opam:alpine-3.13-ocaml-4.05 as compilation
1+
FROM ocaml/opam:alpine-3.13-ocaml-4.12 as compilation
22
LABEL Description="learn-ocaml building" Vendor="OCamlPro"
33

4-
WORKDIR learn-ocaml
4+
WORKDIR /home/opam/learn-ocaml
55

6-
COPY learn-ocaml.opam learn-ocaml.opam.locked learn-ocaml-client.opam ./
6+
COPY learn-ocaml.opam learn-ocaml.opam.locked learn-ocaml-client.opam learn-ocaml-client.opam.locked ./
77
RUN sudo chown -R opam:nogroup .
88

99
ENV OPAMYES true
1010
RUN echo 'archive-mirrors: [ "https://opam.ocaml.org/cache" ]' >> ~/.opam/config \
1111
&& opam repository set-url default http://opam.ocaml.org \
12-
&& opam switch 4.05 \
12+
&& opam switch 4.12 \
1313
&& echo 'pre-session-commands: [ "sudo" "apk" "add" depexts ]' >> ~/.opam/config \
1414
&& opam install . --deps-only --locked
1515

@@ -42,7 +42,7 @@ WORKDIR /learnocaml
4242

4343
COPY --from=compilation /home/opam/install-prefix/bin/learn-ocaml-client /usr/bin
4444

45-
ENTRYPOINT ["dumb-init","learn-ocaml-client"]
45+
ENTRYPOINT ["dumb-init","/usr/bin/learn-ocaml-client"]
4646

4747
LABEL org.opencontainers.image.title="learn-ocaml-client"
4848
LABEL org.opencontainers.image.description="learn-ocaml command-line client"
@@ -68,7 +68,7 @@ WORKDIR /home/learn-ocaml
6868

6969
COPY --from=compilation /home/opam/install-prefix /usr
7070

71-
ENTRYPOINT ["dumb-init","learn-ocaml","--sync-dir=/sync","--repo=/repository"]
71+
ENTRYPOINT ["dumb-init","/usr/bin/learn-ocaml","--sync-dir=/sync","--repo=/repository"]
7272
CMD ["build","serve"]
7373

7474
LABEL org.opencontainers.image.title="learn-ocaml"

Dockerfile.test-client

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This Dockerfile is useful for testing purposes
22
# to ensure learn-ocaml-client can be built alone from learn-ocaml-client.opam
33

4-
FROM ocaml/opam:alpine-3.13-ocaml-4.05 as compilation
4+
FROM ocaml/opam:alpine-3.13-ocaml-4.12 as compilation
55
LABEL Description="learn-ocaml building" Vendor="OCamlPro"
66

77
WORKDIR learn-ocaml
@@ -13,7 +13,7 @@ RUN sudo chown -R opam:nogroup .
1313
ENV OPAMYES true
1414
RUN echo 'archive-mirrors: [ "https://opam.ocaml.org/cache" ]' >> ~/.opam/config \
1515
&& opam repository set-url default http://opam.ocaml.org \
16-
&& opam switch 4.05 \
16+
&& opam switch 4.12 \
1717
&& echo 'pre-session-commands: [ "sudo" "apk" "add" depexts ]' >> ~/.opam/config \
1818
&& opam pin add -n -y -k path learn-ocaml-client . \
1919
&& opam install learn-ocaml-client --deps-only

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ testrun: build install
5757
learn-ocaml build --repo $(REPO) -j1
5858
rm -rf www/css
5959
ln -s ../static/css www
60-
learn-ocaml serve
60+
LEARNOCAML_SERVER_NOCACHE=1 learn-ocaml serve
6161

6262
docker-images: Dockerfile learn-ocaml.opam
6363
@rm -rf docker
@@ -95,7 +95,7 @@ travis: # From https://stackoverflow.com/questions/21053657/how-to-run-travis-ci
9595
static-binaries:
9696
./scripts/static-build.sh
9797

98-
BINARIES = src/main/learnocaml_client.bc src/main/learnocaml_main.bc src/main/learnocaml_server_main.exe
98+
BINARIES = src/main/learnocaml_client.bc.exe src/main/learnocaml_main.bc.exe src/main/learnocaml_server_main.exe
9999

100100
.PHONY: detect-libs
101101
detect-libs:
@@ -104,6 +104,7 @@ detect-libs:
104104
baseid="detect-libs.$$$$"; echo ...; \
105105
$(MAKE) LINKING_MODE=dynamic OCAMLPARAM="_,verbose=1" > $$baseid.log 2>&1; \
106106
for bin in $(BINARIES); do \
107+
rm -f "_build/default/$$bin"; \
107108
base=$${bin#src/main/}; base=$${base%.*}; \
108109
grep -e "'$$bin'" $$baseid.log > $$baseid.$$base.log; \
109110
printf "%s: " "$$base"; \

docs/tutorials/step-7.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ exception OutOfRange of int
3636
For the first graded function, we want to be sure the student function
3737
returned both the right `Ok` output and the right exception with its
3838
is correct argument. The predefined tester that compares both possible
39-
results with `Pervasives.compare` function is called `test`. This is
39+
results with `Stdlib.compare` function is called `test`. This is
4040
obviously the default value of optional argument [~test].
4141

4242
```ocaml
@@ -198,7 +198,7 @@ let p_list l =
198198
let t = List.fold_left (fun a x -> a && p x) true l in
199199
if t then
200200
(* Check that there is at least two different elements *)
201-
let l = List.sort_uniq (Pervasives.compare) l in
201+
let l = List.sort_uniq (Stdlib.compare) l in
202202
if List.length l > 1 then true else false
203203
else false
204204

dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
)
88

99
(env
10-
(release (flags -safe-string -w +a-4-42-44-45-48-3)
10+
(release (flags -safe-string -w +a-4-42-44-45-48-3-58)
1111
(ocamlc_flags)
1212
(ocamlopt_flags))
1313
)

dune-project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
(lang dune 1.7)
1+
(lang dune 2.3)
22
(name learn-ocaml)
33
(version 0.12)
4+
(allow_approximate_merlin)

learn-ocaml-client.opam

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ depends: [
2121
"asak"
2222
"gg"
2323
"vg"
24-
"cohttp" {>= "1.0.0" & < "2.0.0"}
25-
"cohttp-lwt-unix" {>= "1.0.0" & < "2.0.0"}
24+
"cohttp" {>= "2.0.0"}
25+
"cohttp-lwt-unix" {>= "2.0.0"}
2626
"ssl" {= "0.5.5"}
2727
"digestif" {>= "0.7.1"}
28-
"dune" {>= "1.11.4" & <= "2.0.1"}
28+
"dune"
2929
"ezjsonm"
3030
"lwt" {>= "4.0.0"}
3131
"lwt_ssl"
32-
"ocaml" {= "4.05.0"}
32+
"ocaml" {= "4.12.0"}
3333
"ocamlfind" {build}
3434
"ocp-indent-nlfork"
3535
"ocp-ocamlres" {>= "0.4"}
36-
"ocplib-json-typed" {= "0.6"}
36+
"ocplib-json-typed" {>= "0.7"}
3737
"ipaddr" {= "2.8.0" }
3838
"cstruct" {>= "3.3.0"}
3939
"ppx_tools"
40-
"ppx_sexp_conv" {= "v0.9.0"}
41-
"ppx_fields_conv" {= "v0.9.0"}
40+
"ppx_sexp_conv"
41+
"ppx_fields_conv"
4242
]
4343
build: [
4444
["dune" "build" "@install" "-p" name "-j" jobs]

learn-ocaml-client.opam.locked

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
opam-version: "2.0"
2+
name: "learn-ocaml-client"
3+
version: "0.12"
4+
synopsis: "The learn-ocaml client"
5+
description: """\
6+
This contains the binaries to interact with the learn-ocaml
7+
platform from the command line."""
8+
maintainer: "Yann Régis-Gianas"
9+
authors: [
10+
"Benjamin Canou (OCamlPro)"
11+
"Çağdaş Bozman (OCamlPro)"
12+
"Grégoire Henry (OCamlPro)"
13+
"Louis Gesbert (OCamlPro)"
14+
"Pierrick Couderc (OCamlPro)"
15+
]
16+
license: "MIT"
17+
homepage: "https://github.com/ocaml-sf/learn-ocaml"
18+
bug-reports: "https://github.com/ocaml-sf/learn-ocaml/issues"
19+
depends: [
20+
"angstrom" {= "0.15.0"}
21+
"asak" {= "0.3"}
22+
"astring" {= "0.8.5"}
23+
"base" {= "v0.14.1"}
24+
"base-bigarray" {= "base"}
25+
"base-bytes" {= "base"}
26+
"base-threads" {= "base"}
27+
"base-unix" {= "base"}
28+
"base64" {= "3.5.0"}
29+
"bigarray-compat" {= "1.0.0"}
30+
"bigstringaf" {= "0.8.0"}
31+
"biniou" {= "1.2.1"}
32+
"cmdliner" {= "1.0.4"}
33+
"cohttp" {= "4.0.0"}
34+
"cohttp-lwt" {= "4.0.0"}
35+
"cohttp-lwt-unix" {= "4.0.0"}
36+
"conduit" {= "1.3.0"}
37+
"conduit-lwt" {= "1.3.0"}
38+
"conduit-lwt-unix" {= "1.3.0"}
39+
"conf-libssl" {= "3"}
40+
"conf-pkg-config" {= "2"}
41+
"conf-which" {= "1"}
42+
"cppo" {= "1.6.7"}
43+
"csexp" {= "1.5.1"}
44+
"cstruct" {= "5.0.0"}
45+
"digestif" {= "1.0.0"}
46+
"dune" {= "2.9.0"}
47+
"dune-configurator" {= "2.9.0"}
48+
"easy-format" {= "1.3.2"}
49+
"eqaf" {= "0.7"}
50+
"ezjsonm" {= "1.1.0"}
51+
"fieldslib" {= "v0.14.0"}
52+
"fmt" {= "0.8.9"}
53+
"gg" {= "0.9.3"}
54+
"hex" {= "1.4.0"}
55+
"ipaddr" {= "2.8.0"}
56+
"jbuilder" {= "1.0+beta20.2"}
57+
"js_of_ocaml" {= "3.9.0"}
58+
"js_of_ocaml-compiler" {= "3.9.1"}
59+
"js_of_ocaml-ppx" {= "3.9.0"}
60+
"jsonm" {= "1.0.1"}
61+
"logs" {= "0.7.0"}
62+
"lwt" {= "5.4.1"}
63+
"lwt_ssl" {= "1.1.3"}
64+
"magic-mime" {= "1.1.3"}
65+
"menhir" {= "20210419"}
66+
"menhirLib" {= "20210419"}
67+
"menhirSdk" {= "20210419"}
68+
"mmap" {= "1.1.0"}
69+
"num" {= "1.4"}
70+
"ocaml" {= "4.12.0"}
71+
"ocaml-compiler-libs" {= "v0.12.3"}
72+
"ocaml-config" {= "2"}
73+
"ocaml-migrate-parsetree" {= "1.8.0"}
74+
"ocaml-options-vanilla" {= "1"}
75+
"ocaml-syntax-shims" {= "1.0.0"}
76+
"ocamlbuild" {= "0.14.0"}
77+
"ocamlfind" {= "1.9.1"}
78+
"ocp-indent-nlfork" {= "1.5.4"}
79+
"ocp-ocamlres" {= "0.4"}
80+
"ocplib-endian" {= "1.1"}
81+
"ocplib-json-typed" {= "0.7.1"}
82+
"omd" {= "1.3.1"}
83+
"parsexp" {= "v0.14.1"}
84+
"pprint" {= "20200410"}
85+
"ppx_derivers" {= "1.2.1"}
86+
"ppx_fields_conv" {= "v0.14.1"}
87+
"ppx_sexp_conv" {= "v0.14.1"}
88+
"ppx_tools" {= "6.3"}
89+
"ppxlib" {= "0.15.0"}
90+
"re" {= "1.9.0"}
91+
"result" {= "1.5"}
92+
"seq" {= "0.2.2"}
93+
"sexplib" {= "v0.14.0"}
94+
"sexplib0" {= "v0.14.0"}
95+
"ssl" {= "0.5.5"}
96+
"stdlib-shims" {= "0.3.0"}
97+
"stringext" {= "1.6.0"}
98+
"topkg" {= "1.0.3"}
99+
"uchar" {= "0.0.2"}
100+
"uri" {= "4.2.0"}
101+
"uri-sexp" {= "4.2.0"}
102+
"uutf" {= "1.0.2"}
103+
"vg" {= "0.9.4"}
104+
"yojson" {= "1.7.0"}
105+
]
106+
build: ["dune" "build" "@install" "-p" name "-j" jobs]
107+
dev-repo: "git+https://github.com/ocaml-sf/learn-ocaml"

learn-ocaml.opam

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ depends: [
1717
"base" {>= "v0.9.4"}
1818
"base64"
1919
"cmdliner"
20-
"cohttp" {>= "1.0.0" & < "2.0.0"}
21-
"cohttp-lwt" {>= "1.0.0" & < "2.0.0"}
22-
"cohttp-lwt-unix" {>= "1.0.0" & < "2.0.0"}
20+
"cohttp" {>= "2.0.0"}
21+
"cohttp-lwt" {>= "2.0.0"}
22+
"cohttp-lwt-unix" {>= "2.0.0"}
2323
"conf-git"
2424
"decompress" {= "0.8.1"}
2525
"digestif" {>= "0.7.1"}
2626
"dune" {>= "1.11.4"}
2727
"easy-format" {>= "1.3.0" }
28-
"ipaddr" {= "2.8.0" }
28+
"ipaddr" {>= "2.8.0" }
2929
"ezjsonm"
3030
"js_of_ocaml" {>= "3.3.0"}
3131
"js_of_ocaml-compiler" {>= "3.3.0"}
@@ -40,13 +40,14 @@ depends: [
4040
"magic-mime"
4141
"markup"
4242
"markup-lwt"
43-
"ocaml" {= "4.05.0"}
43+
"ocaml" {= "4.12.0"}
4444
"ocamlfind" {build}
4545
"ocp-indent-nlfork"
46-
"ocp-ocamlres" {>= "0.4"}
47-
"ocplib-json-typed" {= "0.6"}
48-
"odoc" {build & >= "1.3.0"}
49-
"omd" {<= "1.3.1"}
46+
"ocp-ocamlres" {= "0.4"}
47+
"ocplib-json-typed" {>= "0.6"}
48+
"ocplib-json-typed-browser" {>= "0.6"}
49+
"odoc" {build}
50+
"omd"
5051
"pprint"
5152
"ppx_cstruct"
5253
"ppx_tools"

0 commit comments

Comments
 (0)