Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to OCaml 5.1.1, jsoo 5.8.2 #602

Merged
merged 40 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e34b5f7
feat(build): Migrate ocplib-i18n to ppxlib
AltGr Sep 28, 2021
d73e5a0
Use pin-depends until release of newer ocp-indent-nlfork
AltGr Sep 28, 2021
9b789c9
Update stdlib file names for 4.13
AltGr Sep 28, 2021
49c7208
fix(build): Fix/disable some warnings
AltGr Jul 22, 2024
4b30226
Update genlifter.ml from upstrim ppx_tools
AltGr Jul 22, 2024
b2a2186
Remove dependency on ocaml-migrate-parsetree
AltGr Jul 22, 2024
60a2e07
Upgrade to OCaml 4.13
AltGr Jul 22, 2024
965e42e
Udate to OCaml 4.14.2
AltGr Jul 23, 2024
d565011
Disable Asak for now (it's not compatible with OCaml 5.0 at the moment)
AltGr Jul 23, 2024
7d096a5
Update dune-project
AltGr Jul 23, 2024
d0ac3b5
ocplib-json-typed is now json-data-encoding
AltGr Jul 23, 2024
0c9c994
Update opam files for OCaml 5.0
AltGr Jul 23, 2024
841d586
ppx_ocplib_i18n doesn't cope well with dune sandboxing
AltGr Jul 23, 2024
c5ee058
Disable partitioning functionality for now (asak isn't compatible wit…
AltGr Jul 23, 2024
22decce
Update stdlib cmi list
AltGr Jul 23, 2024
91421ae
Now compiles (but is broken) with 5.0.0
AltGr Jul 23, 2024
5a52fe3
Fix a bunch of deprecation warnings & errors
AltGr Jul 24, 2024
5a1264f
Adjust jsoo compilation flags
AltGr Jul 24, 2024
029b614
Working with OCaml 5.0.0 / jsoo 5.0.1
AltGr Jul 24, 2024
e46d9b6
Update jsoo to 5.1.1
AltGr Jul 24, 2024
a3e89a1
Many fixes and update for jsoo 5
AltGr Jul 25, 2024
1a76ddb
fix: Actually bind the `--dry-run` flag
AltGr Jul 25, 2024
ec60736
Improve web-worker debug messages
AltGr Jul 25, 2024
4faac64
Adjust to OCaml 5.1.1
AltGr Jul 25, 2024
5f5dbb7
feat: complete porting to OCaml 5.1 and jsoo 5.8
AltGr Jul 25, 2024
9d757cd
feat: bump version to 1.1.0
AltGr Jul 25, 2024
046d7dd
feat: Reenable asak (using pin-depends for compat patch with OCaml 5)
AltGr Jul 25, 2024
8012c6b
fix(CI): fix Dockerfile and client dependencies
AltGr Jul 25, 2024
a5b4abf
fix(CI): use older dependency releases in lockfile
AltGr Jul 25, 2024
283456d
fix(CI): fix static builds and some specific deps
AltGr Jul 25, 2024
e721ad4
fix(CI): fix base Alpine version for final Docker images
AltGr Jul 25, 2024
31b244c
Fixes following review
AltGr Jul 26, 2024
379c47b
chore: Make dune-build a bit more verbose (for debugging purpose)
erikmd Jan 16, 2025
c50b77d
deps(opam): Bump conf-pkg-config
erikmd Jan 16, 2025
2081069
deps(opam): Bump conf-libssl
erikmd Jan 18, 2025
a636b26
deps(opam): Skip conduit-lwt-unix's latest release for now
erikmd Jan 18, 2025
6b0bc56
fix(build): Update linking flags (needed for POSIX & macOS static bin…
erikmd Jan 18, 2025
3e8afe8
fix(build): Fix static build on macOS w.r.t. libzstd
erikmd Jan 18, 2025
6f6be0f
build(js_of_ocaml): Remove `--no-source-map` from root dune file
erikmd Jan 18, 2025
cb5c1dd
Remove temporary pin-depends
AltGr Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/opam-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
uses: avsm/setup-ocaml@v1
# TODO: Keep up-to-date!
with:
ocaml-version: 4.12.0
ocaml-version: 5.1.1
- name: Install opam-publish
run: |
opam install -y -j 2 "opam-publish>=2.3.0"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/static-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ jobs:
run: |
opam init -a --bare
brew install openssl@3 # Workaround https://github.com/ocaml/opam-repository/issues/19676
brew install zstd # Install zstd to avoid "ld: Undefined symbols: _ZSTD_*" at linking time
# ^-> see also https://github.com/ocaml/ocaml/issues/12562
opam switch create . ocaml-base-compiler --deps-only
- name: Build the binaries
run: |
Expand Down
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ocaml/opam:alpine-3.13-ocaml-4.12 as compilation
FROM ocaml/opam:alpine-3.20-ocaml-5.1 as compilation
LABEL Description="learn-ocaml building" Vendor="OCamlPro"

WORKDIR /home/opam/learn-ocaml
Expand All @@ -9,7 +9,7 @@ RUN sudo chown -R opam:nogroup .
ENV OPAMYES true
RUN echo 'archive-mirrors: [ "https://opam.ocaml.org/cache" ]' >> ~/.opam/config \
&& opam repository set-url default http://opam.ocaml.org \
&& opam switch 4.12 \
&& opam switch 5.1 \
&& echo 'pre-session-commands: [ "sudo" "apk" "add" depexts ]' >> ~/.opam/config \
&& opam install . --deps-only --locked

Expand All @@ -28,10 +28,10 @@ RUN cat /proc/cpuinfo /proc/meminfo
RUN opam install . --destdir /home/opam/install-prefix --locked


FROM alpine:3.13 as client
FROM alpine:3.20 as client

RUN apk update \
&& apk add ncurses-libs libev dumb-init openssl \
&& apk add ncurses-libs libev dumb-init libssl3 libcrypto3 \
&& addgroup learn-ocaml \
&& adduser learn-ocaml -DG learn-ocaml

Expand All @@ -45,7 +45,7 @@ COPY --from=compilation /home/opam/install-prefix/bin/learn-ocaml-client /usr/bi
ENTRYPOINT ["dumb-init","/usr/bin/learn-ocaml-client"]


FROM alpine:3.13 as program
FROM alpine:3.20 as program

RUN apk update \
&& apk add ncurses-libs libev dumb-init git openssl lsof \
Expand All @@ -61,7 +61,7 @@ EXPOSE 8443
USER learn-ocaml
WORKDIR /home/learn-ocaml

ARG opam_switch="/home/opam/.opam/4.12"
ARG opam_switch="/home/opam/.opam/5.1"

COPY --from=compilation /home/opam/install-prefix /usr
COPY --from=compilation "$opam_switch/bin"/ocaml* "$opam_switch/bin/"
Expand All @@ -73,7 +73,6 @@ COPY --from=compilation "$opam_switch/lib/gg" "$opam_switch/lib/gg"

# Fixes for ocamlfind
COPY --from=compilation "$opam_switch/lib/findlib.conf" "$opam_switch/lib/"
COPY --from=compilation "$opam_switch/lib/stdlib" "$opam_switch/lib/stdlib"
ENV PATH="${opam_switch}/bin:${PATH}"
ENV OCAMLPATH="/usr/lib"
RUN ln -sf "$opam_switch/lib/vg" "/usr/lib"
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.test-client
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Dockerfile is useful for testing purposes
# to ensure learn-ocaml-client can be built alone from learn-ocaml-client.opam

FROM ocaml/opam:alpine-3.13-ocaml-4.12 as compilation
FROM ocaml/opam:alpine-3.20-ocaml-5.1 as compilation
LABEL Description="learn-ocaml building" Vendor="OCamlPro"

WORKDIR /home/opam/learn-ocaml
Expand All @@ -13,7 +13,7 @@ RUN sudo chown -R opam:nogroup .
ENV OPAMYES true
RUN echo 'archive-mirrors: [ "https://opam.ocaml.org/cache" ]' >> ~/.opam/config \
&& opam repository set-url default http://opam.ocaml.org \
&& opam switch 4.12 \
&& opam switch 5.1 \
&& echo 'pre-session-commands: [ "sudo" "apk" "add" depexts ]' >> ~/.opam/config \
&& opam pin add -n -y -k path learn-ocaml-client . \
&& opam install learn-ocaml-client --deps-only
Expand All @@ -34,7 +34,7 @@ RUN opam install learn-ocaml-client --destdir /home/opam/install-prefix \
&& ls -l /home/opam/install-prefix/bin/learn-ocaml-client


FROM alpine:3.13 as client
FROM alpine:3.20 as client

ARG BUILD_DATE
ARG VCS_BRANCH
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.test-server
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Dockerfile is useful for testing purposes
# to ensure learn-ocaml can be built alone from learn-ocaml.opam

FROM ocaml/opam:alpine-3.13-ocaml-4.12 as compilation
FROM ocaml/opam:alpine-3.20-ocaml-5.1 as compilation
LABEL Description="learn-ocaml building" Vendor="OCamlPro"

WORKDIR /home/opam/learn-ocaml
Expand All @@ -13,7 +13,7 @@ RUN sudo chown -R opam:nogroup .
ENV OPAMYES true
RUN echo 'archive-mirrors: [ "https://opam.ocaml.org/cache" ]' >> ~/.opam/config \
&& opam repository set-url default http://opam.ocaml.org \
&& opam switch 4.12 \
&& opam switch 5.1 \
&& echo 'pre-session-commands: [ "sudo" "apk" "add" depexts ]' >> ~/.opam/config \
&& opam pin add -n -y -k path learn-ocaml . \
&& opam install learn-ocaml --deps-only
Expand All @@ -37,7 +37,7 @@ RUN opam install learn-ocaml --destdir /home/opam/install-prefix \
&& ls -l /home/opam/install-prefix/bin/learn-ocaml


FROM alpine:3.13 as program
FROM alpine:3.20 as program

ARG BUILD_DATE
ARG VCS_BRANCH
Expand Down Expand Up @@ -67,7 +67,7 @@ EXPOSE 8443
USER learn-ocaml
WORKDIR /home/learn-ocaml

ARG opam_switch="/home/opam/.opam/4.12"
ARG opam_switch="/home/opam/.opam/5.1"

COPY --from=compilation /home/opam/install-prefix /usr
COPY --from=compilation "$opam_switch/bin"/ocaml* "$opam_switch/bin/"
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ build-deps:
opam install . --deps-only --locked

.PHONY: build
# cf. man 5 dune-config
build:
@${DUNE} build ${DUNE_ARGS}
@${DUNE} build ${DUNE_ARGS} --display=short

.PHONY: test
test:
Expand Down
13 changes: 11 additions & 2 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@
)

(env
(release (flags -safe-string -w +a-4-42-44-45-48-3-58-32-33)
(release (flags -safe-string -w +a-4-42-44-45-48-3-58-32-33-70)
(ocamlc_flags)
(ocamlopt_flags))
(ocamlopt_flags)
(js_of_ocaml
(compilation_mode whole_program)
(flags --opt=2 --enable=use-js-string --target-env=browser)))

(dev (flags (:standard -safe-string -w -32 -warn-error -a+8))
Copy link
Member

@erikmd erikmd Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  1. adding this dev profile, should I change my usual learn-ocaml programming inner loop?

    Namely, coding then building learn-ocaml with a bash alias that runs:
    cd $learn_ocaml && eval $(opam env) && opam install . --deps-only --locked && make && make opaminstall && learn-ocaml build --repo=demo-repository serve

  2. I had the impression that the dev profile had less warnings enabled than in the release profile ? but probably I'm mistaken

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically it was impossible to build in dev mode because (i) dune didn't allow to customise the jsoo flags manually, it was tied to the built-in profiles, and (ii) source-map was blowing on us and the compilation wouldn't terminate. Thankfully both of these are now fixed :)

In the new setting, the jsoo --opt=2 flag makes release compilation quite a bit slower so I'd advise to use the dev mode when, well, developping 🤯 . The Makefile still defaults to release though, I'll add a PROFILE ?= release variable.
Then you could just run make testrun PROFILE=dev

  1. hm it's quite possible, I haven't taken much attention to the specific warning flags ; I've copied them from another of my projects mainly to disable warn-error in dev mode which I find very hard to work with ("yes I know that this argument is unused, I just commented out the code, will you go on anyways ?" ;) )

(js_of_ocaml
(compilation_mode whole_program)
(flags --source-map-inline --pretty --enable=use-js-string --target-env=browser)
))
)
5 changes: 2 additions & 3 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
(lang dune 2.4)
(lang dune 3.6)
(name learn-ocaml)
(version 1.0.0)
(allow_approximate_merlin)
(version 1.1.0)
18 changes: 9 additions & 9 deletions learn-ocaml-client.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "learn-ocaml-client"
version: "1.0.0"
version: "1.1.0"
authors: [
"Benjamin Canou (OCamlPro)"
"Çağdaş Bozman (OCamlPro)"
Expand All @@ -18,35 +18,35 @@ homepage: "https://github.com/ocaml-sf/learn-ocaml"
bug-reports: "https://github.com/ocaml-sf/learn-ocaml/issues"
dev-repo: "git+https://github.com/ocaml-sf/learn-ocaml"
depends: [
"asak" {>= "0.4"}
"base64"
"base" {>= "v0.9.4"}
"cmdliner" {>= "1.1.0"}
"cohttp" {>= "2.0.0"}
"cohttp-lwt-unix" {>= "2.0.0"}
"conduit-lwt-unix" {< "7.1.0"}
"cstruct" {>= "3.3.0"}
"digestif" {>= "0.7.1"}
"dune" {>= "2.3.0"}
"ezjsonm"
"gg"
"ipaddr" {= "2.9.0" }
"ipaddr" {>= "2.9.0" }
"lwt" {>= "4.0.0"}
"lwt_ssl"
"ocaml" {(>= "4.12") & (< "4.13~")}
"ocaml" {(>= "5.1") & (< "5.2~")}
"ocamlfind" {build}
"ocaml-migrate-parsetree" {= "1.8.0"}
"ocp-indent-nlfork"
"ocplib-json-typed" {>= "0.7"}
"json-data-encoding" {>= "0.7"}
"ocp-ocamlres" {>= "0.4"}
"omd" {<= "1.3.1"}
"omd" {< "2.0"}
"ppxlib"
"ppx_expect"
"ppx_inline_test"
"ppx_fields_conv"
"ppx_sexp_conv"
"ppx_tools"
"ssl" {= "0.5.12"}
"ssl" {>= "0.5.12"}
"vg"
"asak" {>= "0.5"}
"js_of_ocaml" {>= "5.0.0"}
]
build: [
["dune" "build" "@install" "-p" name "-j" jobs]
Expand Down
Loading
Loading