Skip to content

Commit

Permalink
Switch to Dune
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Nuno Monteiro committed Dec 10, 2018
1 parent ea1b913 commit 82388f3
Show file tree
Hide file tree
Showing 22 changed files with 97 additions and 83 deletions.
7 changes: 7 additions & 0 deletions async/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(library
(name httpaf_async)
(public_name httpaf-async)
(wrapped false)
(libraries
async core angstrom-async faraday-async httpaf)
(flags (:standard -safe-string)))
9 changes: 0 additions & 9 deletions async/jbuild

This file was deleted.

10 changes: 10 additions & 0 deletions benchmarks/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(executable
(libraries httpaf httpaf-async async core)
(modules wrk_async_benchmark)
(name wrk_async_benchmark)
(flags (:standard -w -9)))

(executable
(name wrk_lwt_benchmark)
(modules Wrk_lwt_benchmark)
(libraries httpaf httpaf-lwt lwt.unix))
11 changes: 0 additions & 11 deletions benchmarks/jbuild

This file was deleted.

2 changes: 1 addition & 1 deletion benchmarks/wrk_async_benchmark.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let text = "CHAPTER I. Down the Rabbit-Hole Alice was beginning to get very tir
let text = Bigstring.of_string text

let headers = Headers.of_list ["content-length", string_of_int (Bigstring.length text)]
let error_handler _ ?request error start_response =
let error_handler _ ?request:_ error start_response =
let response_body = start_response Headers.empty in
begin match error with
| `Exn exn ->
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/wrk_lwt_benchmark.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let connection_handler =
reqd (Response.create `Not_found) "Route not found"
in

let error_handler _ ?request error start_response =
let error_handler _ ?request:_ error start_response =
let response_body = start_response Headers.empty in

begin match error with
Expand Down
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 1.5)
4 changes: 2 additions & 2 deletions examples/async/async_echo_post.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Httpaf
open Httpaf_async


let error_handler _ ?request error start_response =
let error_handler _ ?request:_ error start_response =
let response_body = start_response Headers.empty in
begin match error with
| `Exn exn ->
Expand Down Expand Up @@ -46,7 +46,7 @@ let main port max_accepts_per_batch () =
Tcp.(Server.create_sock ~on_handler_error:`Raise
~backlog:10_000 ~max_connections:10_000 ~max_accepts_per_batch where_to_listen)
(Server.create_connection_handler ~request_handler ~error_handler)
>>= fun server ->
>>= fun _server ->
Deferred.never ()

let () =
Expand Down
5 changes: 5 additions & 0 deletions examples/async/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(executables
(libraries httpaf httpaf-async async core)
(modules async_echo_post async_get async_post)
(names async_echo_post async_get async_post)
(flags (:standard -w -9)))
4 changes: 0 additions & 4 deletions examples/async/jbuild

This file was deleted.

3 changes: 3 additions & 0 deletions examples/lwt/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executables
(names lwt_get lwt_post lwt_echo_server)
(libraries httpaf httpaf-lwt lwt lwt.unix))
5 changes: 0 additions & 5 deletions examples/lwt/jbuild

This file was deleted.

8 changes: 4 additions & 4 deletions httpaf-async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ homepage: "https://github.com/inhabitedtype/httpaf"
bug-reports: "https://github.com/inhabitedtype/httpaf/issues"
dev-repo: "git+https://github.com/inhabitedtype/httpaf.git"
build: [
["jbuilder" "subst" "-p" name] {pinned}
["jbuilder" "build" "-p" name "-j" jobs]
["jbuilder" "runtest" "-p" name] {with-test}
["dune" "subst" "-p" name] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name] {with-test}
]
depends: [
"ocaml" {>= "4.03.0"}
"jbuilder" {build & >= "1.0+beta10"}
"dune" {build}
"angstrom-async" {>= "0.9.0"}
"faraday-async"
"async"
Expand Down
6 changes: 3 additions & 3 deletions httpaf-lwt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ homepage: "https://github.com/inhabitedtype/httpaf"
bug-reports: "https://github.com/inhabitedtype/httpaf/issues"
dev-repo: "git+https://github.com/inhabitedtype/httpaf.git"
build: [
["jbuilder" "subst" "-p" name] {pinned}
["jbuilder" "build" "-p" name "-j" jobs]
["dune" "subst" "-p" name] {pinned}
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml" {>= "4.03.0"}
"faraday-lwt-unix"
"httpaf"
"jbuilder" {build & >= "1.0+beta10"}
"dune" {build}
"lwt"
]
synopsis: "Lwt support for http/af"
8 changes: 4 additions & 4 deletions httpaf.opam
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ homepage: "https://github.com/inhabitedtype/httpaf"
bug-reports: "https://github.com/inhabitedtype/httpaf/issues"
dev-repo: "git+https://github.com/inhabitedtype/httpaf.git"
build: [
["jbuilder" "subst" "-p" name] {pinned}
["jbuilder" "build" "-p" name "-j" jobs]
["jbuilder" "runtest" "-p" name] {with-test}
["dune" "subst" "-p" name] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name] {with-test}
]
depends: [
"ocaml" {>= "4.03.0"}
"jbuilder" {build & >= "1.0+beta10"}
"dune" {build}
"alcotest" {with-test}
"angstrom" {>= "0.9.0"}
"faraday" {>= "0.5.0"}
Expand Down
23 changes: 23 additions & 0 deletions httpaf_mirage.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(* The function that results from [create_connection_handler] should be passed
to [Lwt_io.establish_server_with_client_socket]. For an example, see
[examples/lwt_echo_server.ml]. *)
module Server : sig
type request_handler =
Lwt_unix.file_descr Httpaf.Server_connection.request_handler

val create_connection_handler
: ?config : Httpaf.Server_connection.Config.t
-> request_handler : (Unix.sockaddr -> request_handler)
-> error_handler : (Unix.sockaddr -> Httpaf.Server_connection.error_handler)
-> (Unix.sockaddr -> Lwt_unix.file_descr -> unit Lwt.t)
end

(* For an example, see [examples/lwt_get.ml]. *)
module Client : sig
val request
: Lwt_unix.file_descr
-> Httpaf.Request.t
-> error_handler : Httpaf.Client_connection.error_handler
-> response_handler : Httpaf.Client_connection.response_handler
-> [`write] Httpaf.Body.t
end
6 changes: 6 additions & 0 deletions lib/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(library
(name httpaf)
(public_name httpaf)
(libraries
angstrom faraday bigstringaf result)
(flags (:standard -safe-string)))
8 changes: 0 additions & 8 deletions lib/jbuild

This file was deleted.

22 changes: 22 additions & 0 deletions lib_test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(executables
(libraries bigstringaf httpaf alcotest)
(modules test_httpaf test_httpaf_server test_httpaf_client simulator)
(names test_httpaf test_httpaf_server test_httpaf_client))

(alias
(name runtest)
(package httpaf)
(deps test_httpaf.exe)
(action (run %{deps})))

(alias
(name runtest)
(package httpaf)
(deps test_httpaf_server.exe)
(action (run %{deps})))

(alias
(name runtest)
(package httpaf)
(deps test_httpaf_client.exe)
(action (run %{deps})))
24 changes: 0 additions & 24 deletions lib_test/jbuild

This file was deleted.

5 changes: 5 additions & 0 deletions lwt/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(library
(name httpaf_lwt)
(public_name httpaf-lwt)
(libraries faraday-lwt-unix httpaf lwt.unix)
(flags (:standard -safe-string)))
7 changes: 0 additions & 7 deletions lwt/jbuild

This file was deleted.

0 comments on commit 82388f3

Please sign in to comment.