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]

0 commit comments

Comments
 (0)