Skip to content
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

Update to dune 2.0 and generate opam files with dune #206

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
.*.sw[a-z]
*~
_build/
_tests/
lib_test/tests_
setup.log
setup.data
*.native
*.byte
*.docdir
*.install
.merlin
_opam/
.vscode/
.merlin
16 changes: 0 additions & 16 deletions META.angstrom.template

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ doc:
dune build @doc

clean:
rm -rf _build *.install
dune clean
37 changes: 24 additions & 13 deletions angstrom-async.opam
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
maintainer: "Spiros Eliopoulos <[email protected]>"
authors: [ "Spiros Eliopoulos <[email protected]>" ]
license: "BSD-3-clause"
synopsis: "Async support for Angstrom"
maintainer: ["Spiros Eliopoulos <[email protected]>"]
authors: ["Spiros Eliopoulos <[email protected]>"]
license: "BSD-3-Clause"
homepage: "https://github.com/inhabitedtype/angstrom"
bug-reports: "https://github.com/inhabitedtype/angstrom/issues"
dev-repo: "git+https://github.com/inhabitedtype/angstrom.git"
depends: [
"dune" {>= "2.0"}
"ocaml" {>= "4.04"}
"odoc" {with-doc}
"angstrom"
"async"
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
depends: [
"ocaml" {>= "4.04.1"}
"dune" {>= "1.8"}
"angstrom" {>= "0.7.0"}
"async" {>= "v0.10.0"}
]
synopsis: "Async support for Angstrom"
dev-repo: "git+https://github.com/inhabitedtype/angstrom.git"
37 changes: 24 additions & 13 deletions angstrom-lwt-unix.opam
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
maintainer: "Spiros Eliopoulos <[email protected]>"
authors: [ "Spiros Eliopoulos <[email protected]>" ]
license: "BSD-3-clause"
synopsis: "Lwt_unix support for Angstrom"
maintainer: ["Spiros Eliopoulos <[email protected]>"]
authors: ["Spiros Eliopoulos <[email protected]>"]
license: "BSD-3-Clause"
homepage: "https://github.com/inhabitedtype/angstrom"
bug-reports: "https://github.com/inhabitedtype/angstrom/issues"
dev-repo: "git+https://github.com/inhabitedtype/angstrom.git"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
depends: [
"ocaml" {>= "4.03.0"}
"dune" {>= "1.8"}
"dune" {>= "2.0"}
"ocaml" {>= "4.04"}
"odoc" {with-doc}
"angstrom"
"lwt"
"base-unix"
"lwt"
]
synopsis: "Lwt_unix support for Angstrom"
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/inhabitedtype/angstrom.git"
35 changes: 23 additions & 12 deletions angstrom-unix.opam
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
maintainer: "Spiros Eliopoulos <[email protected]>"
authors: [ "Spiros Eliopoulos <[email protected]>" ]
license: "BSD-3-clause"
synopsis: "Unix support for Angstrom"
maintainer: ["Spiros Eliopoulos <[email protected]>"]
authors: ["Spiros Eliopoulos <[email protected]>"]
license: "BSD-3-Clause"
homepage: "https://github.com/inhabitedtype/angstrom"
bug-reports: "https://github.com/inhabitedtype/angstrom/issues"
dev-repo: "git+https://github.com/inhabitedtype/angstrom.git"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
depends: [
"ocaml" {>= "4.03.0"}
"dune" {>= "1.8"}
"dune" {>= "2.0"}
"ocaml" {>= "4.04"}
"odoc" {with-doc}
"angstrom"
"base-unix"
]
synopsis: "Unix support for Angstrom"
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/inhabitedtype/angstrom.git"
54 changes: 33 additions & 21 deletions angstrom.opam
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
maintainer: "Spiros Eliopoulos <[email protected]>"
authors: [ "Spiros Eliopoulos <[email protected]>" ]
license: "BSD-3-clause"
homepage: "https://github.com/inhabitedtype/angstrom"
bug-reports: "https://github.com/inhabitedtype/angstrom/issues"
dev-repo: "git+https://github.com/inhabitedtype/angstrom.git"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
depends: [
"ocaml" {>= "4.04.0"}
"dune" {>= "1.8"}
"alcotest" {with-test & >= "0.8.1"}
"bigstringaf"
"result"
"ppx_let" {with-test & >= "0.14.0"}
"ocaml-syntax-shims" {build}
]
synopsis: "Parser combinators built for speed and memory-efficiency"
description: """
Angstrom is a parser-combinator library that makes it easy to write efficient,
Expand All @@ -27,4 +8,35 @@ exposes monadic and applicative interfaces for composition, and supports
incremental input through buffered and unbuffered interfaces. Both interfaces
give the user total control over the blocking behavior of their application,
with the unbuffered interface enabling zero-copy IO. Parsers are backtracking by
default and support unbounded lookahead."""
default and support unbounded lookahead.
"""
maintainer: ["Spiros Eliopoulos <[email protected]>"]
authors: ["Spiros Eliopoulos <[email protected]>"]
license: "BSD-3-Clause"
homepage: "https://github.com/inhabitedtype/angstrom"
bug-reports: "https://github.com/inhabitedtype/angstrom/issues"
depends: [
"dune" {>= "2.0"}
"alcotest" {with-test & >= "0.8.1"}
"ocaml" {>= "4.04"}
"ocaml-syntax-shims" {build}
"odoc" {with-doc}
"ppx_let" {with-test & >= "0.14"}
"bigstringaf"
"result"
]
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/inhabitedtype/angstrom.git"
8 changes: 4 additions & 4 deletions benchmarks/pure_benchmark.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let zero =

let make_bench name parser contents =
Bench.Test.create ~name (fun () ->
match Angstrom.(parse_bigstring parser contents) with
match Angstrom.(parse_bigstring ~consume:All parser contents) with
| Ok _ -> ()
| Error err -> failwith err)
;;
Expand Down Expand Up @@ -58,10 +58,10 @@ let main () =
]
in
let http =
Bench.make_command [ make_http "http" http_get ]
Bench.make_command [ make_http "http" http_get ]
in
let numbers =
Bench.make_command [
Bench.make_command [
Bench.Test.create ~name:"float" (fun () ->
float_of_string "1.7242915150166418e+36");
Bench.Test.create ~name:"int" (fun () ->
Expand Down Expand Up @@ -111,7 +111,7 @@ let main () =
]
in
Command.run
(Command.group ~summary:"various angstrom benchmarks"
(Command.group ~summary:"various angstrom benchmarks"
[ "json" , json
; "endian" , endian
; "http" , http
Expand Down
71 changes: 70 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,71 @@
(lang dune 1.8)
(lang dune 2.0)
(name angstrom)

(license BSD-3-Clause)
(authors "Spiros Eliopoulos <[email protected]>")
(maintainers "Spiros Eliopoulos <[email protected]>")
(source
(github inhabitedtype/angstrom))
(bug_reports "https://github.com/inhabitedtype/angstrom/issues")
(homepage "https://github.com/inhabitedtype/angstrom")

(generate_opam_files true)

(package
(name angstrom)
(synopsis "Parser combinators built for speed and memory-efficiency")
(description "\
Angstrom is a parser-combinator library that makes it easy to write efficient,
expressive, and reusable parsers suitable for high-performance applications. It
exposes monadic and applicative interfaces for composition, and supports
incremental input through buffered and unbuffered interfaces. Both interfaces
give the user total control over the blocking behavior of their application,
with the unbuffered interface enabling zero-copy IO. Parsers are backtracking by
default and support unbounded lookahead.
")
(depends
(alcotest
(and
:with-test
(>= 0.8.1)))
(ocaml
(>= 4.04))
(ocaml-syntax-shims :build)
(odoc :with-doc)
(ppx_let
(and
:with-test
(>= 0.14)))
bigstringaf
result))

(package
(name angstrom-async)
(synopsis "Async support for Angstrom")
(depends
(ocaml
(>= 4.04))
(odoc :with-doc)
angstrom
async))

(package
(name angstrom-lwt-unix)
(synopsis "Lwt_unix support for Angstrom")
(depends
(ocaml
(>= 4.04))
(odoc :with-doc)
angstrom
base-unix
lwt))

(package
(name angstrom-unix)
(synopsis "Unix support for Angstrom")
(depends
(ocaml
(>= 4.04))
(odoc :with-doc)
angstrom
base-unix))
1 change: 1 addition & 0 deletions examples/dune
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
(libraries angstrom))

;; Build bytecode library just to make sure this compiles

(alias
(name examples)
(deps RFC7159.cma RFC2616.cma))
11 changes: 6 additions & 5 deletions lib_test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
(preprocess
(per_module
(future_syntax test_let_syntax_native)
((pps ppx_let) test_let_syntax_ppx))))
((pps ppx_let)
test_let_syntax_ppx))))

(executables
(libraries alcotest angstrom angstrom_test)
Expand All @@ -18,10 +19,10 @@
(modules test_json)
(names test_json))

(alias
(name runtest)
(package angstrom)
(rule
(alias runtest)
(mode promote)
(deps
(:< test_angstrom.exe))
(action
(run %{<})))
(run %{<})))
2 changes: 1 addition & 1 deletion lib_test/test_json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ let read f =

let () =
let twitter_big = read Sys.argv.(1) in
match Angstrom.(parse_bigstring RFC7159.json twitter_big) with
match Angstrom.(parse_bigstring ~consume:All RFC7159.json twitter_big ) with
| Ok _ -> ()
| Error err -> failwith err