Skip to content

Commit

Permalink
Merge pull request #76 from anmonteiro/anmonteiro/switch-to-dune
Browse files Browse the repository at this point in the history
Switch to Dune
  • Loading branch information
dpatti authored Jan 15, 2019
2 parents 1bd293e + 4d32c6e commit 862403f
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 89 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.PHONY: all build clean test

build:
jbuilder build --dev @install
dune build @install

all: build

test:
jbuilder runtest --dev
dune runtest

install:
jbuilder install
dune install

uninstall:
jbuilder uninstall
dune uninstall

clean:
rm -rf _build *.install
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ opam install --deps-only httpaf
After this, you may install a development version of the library using the
install command as usual.

Tests can be run via jbuilder:
Tests can be run via dune:

```bash
jbuilder runtest
dune runtest
```

## License
Expand Down
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
3 changes: 3 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 1.5)

(name httpaf)
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"] {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"] {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"] {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
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 862403f

Please sign in to comment.