Skip to content

Commit

Permalink
fix: expose a single public library
Browse files Browse the repository at this point in the history
  • Loading branch information
leostera committed Dec 21, 2023
1 parent afc024d commit 329b093
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## Unreleased

* Redo packaging to expose a single public library: `riot`

## 0.0.5

* Add `register name pid`
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ An actor-model multi-core scheduler for OCaml 5.
Riot is an [actor-model][actors] multi-core scheduler for OCaml 5. It brings
[Erlang][erlang]-style concurrency to the language, where lightweight processes communicate via message-passing.

<!-- $MDX file=test/readme_example.ml,part=main -->
```ocaml
open Riot
type Message.t += Hello_world
let () =
Expand All @@ -28,7 +30,8 @@ let () =
spawn (fun () ->
match receive () with
| Hello_world ->
Logger.info (fun f -> f "hello world from %a!" Pid.pp (self ())))
Logger.info (fun f -> f "hello world from %a!" Pid.pp (self ()));
shutdown ())
in
send pid Hello_world
```
Expand Down
4 changes: 2 additions & 2 deletions bench/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(executables
(names spawn_many)
(libraries riot))
(names spawn_many)
(libraries riot))
2 changes: 2 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(mdx
(libraries riot))
5 changes: 3 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(lang dune 3.10)
(lang dune 3.11)
(using mdx 0.4)

(name riot)

Expand All @@ -19,12 +20,12 @@
(description "Riot is an actor-model multi-core scheduler for OCaml 5. It brings Erlang-style concurrency to the language, where lighweight process communicate via message passing")
(depends
(ocaml (>= "5.1"))
dune
(ptime (>= "1.1.0"))
(iomux (>= "0.3"))
(bigstringaf (>= "0.9.1"))
(uri (>= "4.4.0"))
(telemetry (>= "0.0.1"))
(mdx (and :with-test (>= "2.3.1")))
(odoc (and :with-doc (>= "2.2.2")))
)
(tags
Expand Down
3 changes: 2 additions & 1 deletion riot.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ tags: ["multicore" "erlang" "actor" "message-passing" "processes"]
homepage: "https://github.com/leostera/riot"
bug-reports: "https://github.com/leostera/riot/issues"
depends: [
"dune" {>= "3.11"}
"ocaml" {>= "5.1"}
"dune" {>= "3.10"}
"ptime" {>= "1.1.0"}
"iomux" {>= "0.3"}
"bigstringaf" {>= "0.9.1"}
"uri" {>= "4.4.0"}
"telemetry" {>= "0.0.1"}
"mdx" {with-test & >= "2.3.1"}
"odoc" {with-doc & >= "2.2.2"}
]
build: [
Expand Down
2 changes: 1 addition & 1 deletion riot/lib/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.lib)
(package riot)
(name lib)
(libraries lib_net logger runtime))
2 changes: 1 addition & 1 deletion riot/lib/logger/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.lib.logger)
(package riot)
(name logger)
(libraries runtime))
2 changes: 1 addition & 1 deletion riot/lib/net/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.lib.net)
(package riot)
(name lib_net)
(libraries runtime logger))
8 changes: 4 additions & 4 deletions riot/riot.mli
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ module Gen_server : sig
custom request types, including the response type in its type variable.
Like this:
```ocaml
{@ocaml[
open Riot
type _ Gen_server.req +=
| Is_connected : bool Gen_server.req
| Profile : profile_req -> profile_res Gen_server.req
```
]}
*)

(** [state init_result] is used to initialize a new generic server. *)
Expand All @@ -264,7 +264,7 @@ module Gen_server : sig
(** [Impl] is the module type of the generic server base implementations. You
can use this type when defining new gen servers like this:
```ocaml
{@ocaml[
type args = int
module Server : Gen_server.Impl with type args = args = struct
type nonrec args = args
Expand All @@ -274,7 +274,7 @@ module Gen_server : sig
(* ... *)
end
```
]}
*)
module type Impl = sig
type args
Expand Down
2 changes: 1 addition & 1 deletion riot/runtime/core/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.core)
(package riot)
(name core)
(libraries log util))
2 changes: 1 addition & 1 deletion riot/runtime/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.runtime)
(package riot)
(name runtime)
(libraries core log net scheduler time util))
2 changes: 1 addition & 1 deletion riot/runtime/log/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.log)
(package riot)
(name log)
(libraries ptime ptime.clock.os))
2 changes: 1 addition & 1 deletion riot/runtime/net/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.net)
(package riot)
(name net)
(libraries core util log iomux uri unix telemetry bigstringaf))
2 changes: 1 addition & 1 deletion riot/runtime/scheduler/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.scheduler)
(package riot)
(name scheduler)
(libraries core util net time log))
2 changes: 1 addition & 1 deletion riot/runtime/time/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.runtime.time)
(package riot)
(name time)
(libraries core ptime ptime.clock.os))
2 changes: 1 addition & 1 deletion riot/runtime/util/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(public_name riot.util)
(package riot)
(name util)
(libraries log unix))
1 change: 1 addition & 0 deletions test/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(tests
(names
readme_example
application_test
telemetry_test
process_registration_test
Expand Down
18 changes: 18 additions & 0 deletions test/readme_example.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[@@@warning "-8"]

(* $MDX part-begin=main *)
open Riot

type Message.t += Hello_world

let () =
Riot.run @@ fun () ->
let pid =
spawn (fun () ->
match receive () with
| Hello_world ->
Logger.info (fun f -> f "hello world from %a!" Pid.pp (self ()));
shutdown ())
in
send pid Hello_world
(* $MDX part-end *)

0 comments on commit 329b093

Please sign in to comment.