The unpac monorepo manager self-hosting as a monorepo using unpac

Update to 5.0.0~alpha0

Drop compatibility with 4.12+domains.

Add a Dockerfile for easy testing.

+48 -62
+4
.dockerignore
··· 1 + Dockerfile 2 + _build 3 + .git 4 + **/*.swp
+15
Dockerfile
··· 1 + FROM ocaml/opam:debian-11-ocaml-5.0 2 + # Make sure we're using opam-2.1: 3 + RUN sudo ln -sf /usr/bin/opam-2.1 /usr/bin/opam 4 + # Add the alpha repository with some required preview versions of dependencies: 5 + RUN opam remote add alpha git+https://github.com/kit-ty-kate/opam-alpha-repository.git 6 + # Install utop for interactive use: 7 + RUN opam install utop 8 + # Install Eio's dependencies (adding just the opam files first to help with caching): 9 + RUN mkdir eio 10 + WORKDIR eio 11 + COPY *.opam ./ 12 + RUN opam install --deps-only -t . 13 + # Build and test Eio: 14 + COPY . ./ 15 + RUN opam install -t .
+3
Makefile
··· 16 16 test_luv: 17 17 rm -rf _build 18 18 EIO_BACKEND=luv dune runtest 19 + 20 + docker: 21 + docker build -t eio .
+19 -19
README.md
··· 13 13 * [Motivation](#motivation) 14 14 * [Current Status](#current-status) 15 15 * [Structure of the Code](#structure-of-the-code) 16 - * [Getting Started](#getting-started) 16 + * [Getting OCaml 5.0](#getting-ocaml-50) 17 + * [Getting Eio](#getting-eio) 18 + * [Running Eio](#running-eio) 17 19 * [Testing with Mocks](#testing-with-mocks) 18 20 * [Fibers](#fibers) 19 21 * [Tracing](#tracing) ··· 66 68 67 69 ## Current Status 68 70 69 - Eio can be used with OCaml 5.0.0+trunk or with 4.12.0+domains. 70 - 71 71 Eio is able to run a web-server with [good performance][http-bench], 72 72 but you are likely to encounter missing features while using it. 73 73 If you'd like to help out, please try porting your program to use Eio and submit PRs or open issues when you find problems. ··· 99 99 plus a low-level API that can be used directly (in non-portable code). 100 100 - [Eio_main][] selects an appropriate backend (e.g. `eio_linux` or `eio_luv`), depending on your platform. 101 101 102 - ## Getting Started 102 + ## Getting OCaml 5.0 103 103 104 - You'll need a version of the OCaml compiler with effects. 105 - `5.0.0+trunk` often works but is a moving target, so we suggest using `4.12.0+domains` for now 106 - (however, this only supports x86_64 systems). 107 - You can get it like this: 104 + You'll need OCaml 5.0.0~alpha0 or later. 105 + You can either install it yourself or build the included [Dockerfile](./Dockerfile). 108 106 109 - ``` 110 - opam switch create 4.12.0+domains --repositories=multicore=git+https://github.com/ocaml-multicore/multicore-opam.git,default 111 - ``` 107 + To install it yourself: 112 108 113 - To use 5.0.0~alpha0 (which is needed on ARM), use this command instead: 109 + 1. Make sure you have opam 2.1 or later (run `opam --version` to check). 110 + 111 + 2. Use opam to install OCaml 5.0.0~alpha0 or later: 114 112 115 - ``` 116 - opam switch create 5.0.0~alpha0 --repo=default,alpha=git+https://github.com/kit-ty-kate/opam-alpha-repository.git 117 - ``` 113 + ``` 114 + opam switch create 5.0.0~alpha0 --repo=default,alpha=git+https://github.com/kit-ty-kate/opam-alpha-repository.git 115 + ``` 116 + 117 + ## Getting Eio 118 118 119 119 If you want to run the latest development version from Git, run these commands 120 120 (otherwise, skip them and you'll get the latest release from opam): ··· 125 125 opam pin -yn . 126 126 ``` 127 127 128 - Finally, install this library (and `utop` if you want to try it interactively): 128 + Either way, install `eio_main` (and `utop` if you want to try it interactively): 129 129 130 130 ``` 131 - opam depext -i eio_main utop # (for opam 2.0) 132 - opam install eio_main utop # (for opam 2.1) 131 + opam install eio_main utop 133 132 ``` 134 - (Run `opam --version` if you're not sure which one you have installed.) 133 + 134 + ## Running Eio 135 135 136 136 Try out the examples interactively by running `utop` in the shell. 137 137
+4 -7
doc/prelude.ml
··· 24 24 method run_raw fn = fn () 25 25 end 26 26 27 - (* https://github.com/ocaml/ocaml/issues/10324 *) 28 - let dontcrash = Sys.opaque_identity 29 - 30 27 let run fn = 31 28 Eio_main.run @@ fun env -> 32 29 fn @@ object 33 - method net = dontcrash env#net 34 - method stdin = dontcrash env#stdin 35 - method stdout = dontcrash env#stdout 36 - method cwd = dontcrash env#cwd 30 + method net = env#net 31 + method stdin = env#stdin 32 + method stdout = env#stdout 33 + method cwd = env#cwd 37 34 method domain_mgr = fake_domain_mgr 38 35 method clock = fake_clock env#clock 39 36 end
+1 -4
dune-project
··· 12 12 (synopsis "Effect-based direct-style IO API for OCaml") 13 13 (description "An effect-based IO API for multicore OCaml with fibers.") 14 14 (depends 15 - (ocaml (>= 4.12.0)) 16 - base-domains 15 + (ocaml (>= 5.0.0~alpha0)) 17 16 (bigstringaf (>= 0.9.0)) 18 17 (cstruct (>= 6.0.1)) 19 18 lwt-dllist ··· 30 29 (description "An eio implementation for Linux using io-uring.") 31 30 (depends 32 31 (alcotest (and (>= 1.4.0) :with-test)) 33 - base-domains 34 32 (eio (= :version)) 35 33 (mdx (and (>= 1.10.0) :with-test)) 36 34 (logs (>= 0.7.0)) ··· 42 40 (synopsis "Eio implementation using luv (libuv)") 43 41 (description "An eio implementation for most platforms, using luv.") 44 42 (depends 45 - base-domains 46 43 (eio (= :version)) 47 44 (luv (>= 0.5.11)) 48 45 (luv_unix (>= 0.5.0))
+1 -2
eio.opam
··· 10 10 bug-reports: "https://github.com/ocaml-multicore/eio/issues" 11 11 depends: [ 12 12 "dune" {>= "2.9"} 13 - "ocaml" {>= "4.12.0"} 14 - "base-domains" 13 + "ocaml" {>= "5.0.0~alpha0"} 15 14 "bigstringaf" {>= "0.9.0"} 16 15 "cstruct" {>= "6.0.1"} 17 16 "lwt-dllist"
-1
eio_linux.opam
··· 11 11 depends: [ 12 12 "dune" {>= "2.9"} 13 13 "alcotest" {>= "1.4.0" & with-test} 14 - "base-domains" 15 14 "eio" {= version} 16 15 "mdx" {>= "1.10.0" & with-test} 17 16 "logs" {>= "0.7.0"}
-1
eio_luv.opam
··· 10 10 bug-reports: "https://github.com/ocaml-multicore/eio/issues" 11 11 depends: [ 12 12 "dune" {>= "2.9"} 13 - "base-domains" 14 13 "eio" {= version} 15 14 "luv" {>= "0.5.11"} 16 15 "luv_unix" {>= "0.5.0"}
-12
lib_eio/core/dune
··· 2 2 (name eio__core) 3 3 (public_name eio.core) 4 4 (libraries cstruct lwt-dllist fmt)) 5 - 6 - (rule 7 - (target effect.ml) 8 - (enabled_if (>= %{ocaml_version} "5.0")) 9 - (action 10 - (copy effect.new.ml effect.ml))) 11 - 12 - (rule 13 - (target effect.ml) 14 - (enabled_if (< %{ocaml_version} "5.0")) 15 - (action 16 - (copy effect.compat.ml effect.ml)))
-2
lib_eio/core/effect.compat.ml
··· 1 - include Stdlib.EffectHandlers 2 - type 'a t = 'a eff = ..
-1
lib_eio/core/effect.new.ml
··· 1 - include Stdlib.Effect
-2
lib_eio/core/eio__core.ml
··· 18 18 | Trace : (?__POS__:(string * int * int * int) -> ('a, Format.formatter, unit, unit) format4 -> 'a) Effect.t 19 19 end 20 20 21 - module Effect = Effect 22 - 23 21 let traceln_mutex = Mutex.create () 24 22 25 23 let default_traceln ?__POS__:pos fmt =
-3
lib_eio/core/eio__core.mli
··· 455 455 (** [get_error t] is [Cancel.get_error (cancellation_context t)] *) 456 456 end 457 457 458 - (** Temporary hack for compatibility with ocaml.4.12+domains *) 459 - module Effect = Effect 460 - 461 458 module Effects : sig 462 459 type 'a enqueue = ('a, exn) result -> unit 463 460 (** A function provided by the scheduler to reschedule a previously-suspended thread. *)
-1
lib_eio/mock/backend.ml
··· 1 1 module Fiber_context = Eio.Private.Fiber_context 2 - module Effect = Eio.Private.Effect (* For compatibility with 4.12+domains *) 3 2 module Lf_queue = Eio_utils.Lf_queue 4 3 5 4 exception Deadlock_detected
-2
lib_eio/unix/eio_unix.ml
··· 1 - module Effect = Eio.Private.Effect 2 - 3 1 module Private = struct 4 2 type _ Eio.Generic.ty += Unix_file_descr : [`Peek | `Take] -> Unix.file_descr Eio.Generic.ty 5 3
-2
lib_eio/unix/eio_unix.mli
··· 48 48 49 49 (** API for Eio backends only. *) 50 50 module Private : sig 51 - open Eio.Private 52 - 53 51 type _ Eio.Generic.ty += Unix_file_descr : [`Peek | `Take] -> Unix.file_descr Eio.Generic.ty 54 52 (** See {!FD}. *) 55 53
+1 -1
lib_eio/utils/suspended.ml
··· 1 1 (** A suspended fiber with its context. *) 2 2 3 - open Eio.Private.Effect.Deep 3 + open Effect.Deep 4 4 module Ctf = Eio.Private.Ctf 5 5 6 6 type 'a t = {
-1
lib_eio_linux/eio_linux.ml
··· 18 18 module Log = (val Logs.src_log src : Logs.LOG) 19 19 20 20 open Eio.Std 21 - module Effect = Eio.Private.Effect 22 21 23 22 module Fiber_context = Eio.Private.Fiber_context 24 23 module Ctf = Eio.Private.Ctf
-1
lib_eio_luv/eio_luv.ml
··· 18 18 module Log = (val Logs.src_log src : Logs.LOG) 19 19 20 20 open Eio.Std 21 - module Effect = Eio.Private.Effect 22 21 23 22 module Ctf = Eio.Private.Ctf 24 23