-
Notifications
You must be signed in to change notification settings - Fork 356
chore: Use Dune package management #3132
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
base: main
Are you sure you want to change the base?
Conversation
I've been using dune package management to build this project whenever I've needed to contribute to it over the past year and it's worked fine until recently. Here are some PRs/issues relating to fixing the problems I've encountered recently: |
There's also currently an issue with the |
This is great! Thanks for the work, @sabine and @gridbugs. Upon offline discussion with Sabine, we wanted to test this on MacOS and Windows to ensure the workflow remains unaffected for contributors on those platforms. I tested with WSL2 (which is the recommended way to develop ocaml.org on Windows), and the ocaml.org project (with The ocaml.org playground doesn't build, as expected - as it seems to have some dependency issues. I'll try to investigate what's happening there! |
Sounds great! Looks like we'll be migrating fully to |
Thanks @Sudha247 for sabine#53. This makes the playground dune build succeed. One thing I observe on my machine: Both on the main branch, and on this branch, running the playground build just deletes the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace all ````` by ````bash` in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the removal of the dependency on Anton's river fork be merged ahead in a separate PR?
RUN opam install . --deps-only | ||
# Install Dune Developer Preview | ||
RUN curl -fsSL https://get.dune.build/install | sh | ||
RUN /bin/bash -c 'source "/root/.local/share/dune/env/env.bash"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have any effect? The environment disappears after this call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must not download a dev preview on each build, that's brittle and wasteful.
RUN sudo apk -U upgrade --no-cache && sudo apk add --no-cache \ | ||
RUN apk -U upgrade --no-cache && apk add --no-cache \ | ||
# to download and install Dune Developer Preview with alpine:3.21 | ||
build-base patch tar ca-certificates git rsync curl sudo bash \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need for sudo
, rsync
, bash
or nano
?
rpclib-lwt)) | ||
(astring (= 0.8.5)) | ||
(base-bigarray (= base)) | ||
(base-bytes (= base)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is customary to depend on all these base-*
packages. After all, they're just transitive dependencies of the compiler selected.
watch: ## Watch for the filesystem and rebuild on every change | ||
opam exec -- dune build @run -w --force --no-buffer | ||
dune build @run -w --force --no-buffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read the HACKING doc a bit quickly, and ran make watch
instead of make start
first:
$ make watch
dune build @run -w --force --no-buffer
File "src/ocamlorg_web/lib/dune", line 13, characters 2-15:
13 | mirage-kv-mem))
^^^^^^^^^^^^^
Error: Library "mirage-kv-mem" not found.
-> required by library "ocamlorg_web" in _build/default/src/ocamlorg_web/lib
-> required by executable main in src/ocamlorg_web/bin/dune:2
-> required by _build/default/src/ocamlorg_web/bin/main.exe
-> required by alias src/ocamlorg_web/bin/run in src/ocamlorg_web/bin/dune:8
######################################################################## 100.0%
Done: 95% (95/100, 5 left, 1 failed) (jobs: 1)Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Rebuilding...
Done in 1911ms.
Shouldn't every rule that does a build depend on dune.lock
, instead of just a couple of them? (or taking a step back, I thought the usual thing to do is commit the dune.lock
, so I'm a bit confused about why it's being generated on the fly).
This patch changes the build configuration to use Dune Package Management.
Done / To do:
dune-workspace
to pinopam-repository
just as we currently do (moved the pins fromdune-project
there / removedriver
pin, as it's no longer necessary / pin opam-repository insidedune-workspace
)Dockerfile
.opam
filesMakefile
s to reflect using only Dune, and no longer usingopam
CONTRIBUTING.md
andHACKING.md
playground/
to build with Dune Developer Previewdune pkg
needs to be initialised. Rationale: this is needed to measure first build time without using docker~/.cache/ocamlorg
isdune pkg
also using~/.cache/dune
. What's the impact of deleting it?dune.lock
directory is enough to go back to the old build -- relevant only for open PRs / current work in progress, we should encourage people to rebase on main and use Dune package management after the merge of this patchTo test this
Current status
I believe this is ready to merge.