Skip to content

Commit

Permalink
Fix dependencies (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmattio authored Nov 28, 2020
1 parent 55605b5 commit 5dee70c
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 34 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,32 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Retrieve opam cache
uses: actions/cache@v2
if: runner.os != 'Windows'
id: cache-opam
with:
path: ~/.opam
key: v1-${{ runner.os }}-opam-${{ matrix.ocaml-version }}-${{ hashFiles('*.opam.locked') }}
restore-keys: |
v1-${{ runner.os }}-opam-${{ matrix.ocaml-version }}-
# - name: Retrieve opam cache
# uses: actions/cache@v2
# if: runner.os != 'Windows'
# id: cache-opam
# with:
# path: ~/.opam
# key: v1-${{ runner.os }}-opam-${{ matrix.ocaml-version }}-${{ hashFiles('*.opam.locked') }}
# restore-keys: |
# v1-${{ runner.os }}-opam-${{ matrix.ocaml-version }}-

- name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ matrix.ocaml-version }}

- name: Print OCaml version
run: opam exec -- ocaml --version

- name: Install system dependencies
if: runner.os == 'Windows'
run: opam depext conf-pkg-config

- name: Update opam repository
if: steps.cache-opam.outputs.cache-hit != 'true'
run: opam update

- name: Install dependencies
if: steps.cache-opam.outputs.cache-hit != 'true'
run: |
Expand All @@ -53,7 +64,7 @@ jobs:
run: make build

- name: Check formatting
run: make format
run: make fmt

- name: Run tests
run: make test
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ doc:
doc-path:
@echo "_build/default/_doc/_html/index.html"

.PHONY: format
format:
.PHONY: fmt
fmt:
opam exec -- dune build @fmt --auto-promote

.PHONY: watch
Expand Down
4 changes: 2 additions & 2 deletions README.cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ $ opam install opium
### Master

```
$ opam pin add rock --dev-repo
$ opam pin add opium --dev-repo
$ opam pin add rock.~dev https://github.com/rgrinberg/opium.git
$ opam pin add opium.~dev https://github.com/rgrinberg/opium.git
```

## Documentation
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ $ opam install opium
### Master

```
$ opam pin add rock --dev-repo
$ opam pin add opium --dev-repo
$ opam pin add rock.~dev https://github.com/rgrinberg/opium.git
$ opam pin add opium.~dev https://github.com/rgrinberg/opium.git
```

## Documentation
Expand Down
11 changes: 2 additions & 9 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
(lang dune 1.11)

(using fmt 1.2)
(lang dune 2.0)

(name opium)

Expand All @@ -26,8 +24,6 @@
(depends
(ocaml
(>= 4.08))
(dune
(>= 1.11))
(lwt
(>= 5.3.0))
bigstringaf
Expand All @@ -44,14 +40,13 @@
(depends
(ocaml
(>= 4.08))
(dune
(>= 1.11))
(rock
(= :version))
(lwt
(>= 5.3.0))
httpaf-lwt-unix
logs
fmt
mtime
cmdliner
ptime
Expand All @@ -75,8 +70,6 @@
(depends
(ocaml
(>= 4.08))
(dune
(>= 1.11))
(opium
(= :version))
alcotest
Expand Down
13 changes: 13 additions & 0 deletions dune-workspace.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(lang dune 2.0)

(context
(opam
(switch 4.08.1)))

(context
(opam
(switch 4.09.1)))

(context
(opam
(switch 4.10.1)))
2 changes: 1 addition & 1 deletion opium-testing.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ homepage: "https://github.com/rgrinberg/opium"
doc: "https://rgrinberg.github.io/opium/"
bug-reports: "https://github.com/rgrinberg/opium/issues"
depends: [
"dune" {>= "2.0"}
"ocaml" {>= "4.08"}
"dune" {>= "1.11"}
"opium" {= version}
"alcotest"
"alcotest-lwt"
Expand Down
4 changes: 2 additions & 2 deletions opium-testing.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ depends: [
"base-unix" {= "base"}
"base64" {= "3.4.0"}
"bigarray-compat" {= "1.0.0"}
"bigstringaf" {= "0.6.1"}
"bigstringaf" {= "0.7.0"}
"biniou" {= "1.2.1"}
"cmdliner" {= "1.0.4"}
"conf-m4" {= "1"}
Expand All @@ -43,7 +43,7 @@ depends: [
"lwt" {= "5.3.0"}
"lwt_ppx" {= "2.0.1"}
"magic-mime" {= "1.1.2"}
"mirage-crypto" {= "0.8.6"}
"mirage-crypto" {= "0.8.7"}
"mmap" {= "1.1.0"}
"mtime" {= "1.2.0"}
"multipart-form-data" {= "0.3.0"}
Expand Down
3 changes: 2 additions & 1 deletion opium.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ homepage: "https://github.com/rgrinberg/opium"
doc: "https://rgrinberg.github.io/opium/"
bug-reports: "https://github.com/rgrinberg/opium/issues"
depends: [
"dune" {>= "2.0"}
"ocaml" {>= "4.08"}
"dune" {>= "1.11"}
"rock" {= version}
"lwt" {>= "5.3.0"}
"httpaf-lwt-unix"
"logs"
"fmt"
"mtime"
"cmdliner"
"ptime"
Expand Down
4 changes: 2 additions & 2 deletions opium.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ depends: [
"base-unix" {= "base"}
"base64" {= "3.4.0"}
"bigarray-compat" {= "1.0.0"}
"bigstringaf" {= "0.6.1"}
"bigstringaf" {= "0.7.0"}
"biniou" {= "1.2.1"}
"cmdliner" {= "1.0.4"}
"conf-m4" {= "1"}
Expand All @@ -43,7 +43,7 @@ depends: [
"lwt" {= "5.3.0"}
"lwt_ppx" {= "2.0.1"}
"magic-mime" {= "1.1.2"}
"mirage-crypto" {= "0.8.6"}
"mirage-crypto" {= "0.8.7"}
"mmap" {= "1.1.0"}
"mtime" {= "1.2.0"}
"multipart-form-data" {= "0.3.0"}
Expand Down
15 changes: 14 additions & 1 deletion opium/src/cookie.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)

(* Stdlib List superset for compatiblity with OCaml < 4.10.0 *)
module List = struct
include List

let rec find_map f = function
| [] -> None
| x :: l ->
(match f x with
| Some _ as result -> result
| None -> find_map f l)
;;
end

module Signer = struct
type t =
{ secret : string
Expand Down Expand Up @@ -475,7 +488,7 @@ let cookie_of_header ?signed_with cookie_key (key, value) =
| "Cookie" | "cookie" ->
String.split_on_char ';' value
|> List.map (Astring.String.cut ~sep:"=")
|> ListLabels.find_map ~f:(function
|> List.find_map (function
| Some (k, value) when k = cookie_key ->
let value =
match signed_with with
Expand Down
10 changes: 10 additions & 0 deletions opium/src/import.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ module List = struct
in
aux [] l false
;;

let concat_map ~f l =
let rec aux f acc = function
| [] -> rev acc
| x :: l ->
let xs = f x in
aux f (rev_append xs acc) l
in
aux f [] l
;;
end

module String = struct
Expand Down
2 changes: 1 addition & 1 deletion rock.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ homepage: "https://github.com/rgrinberg/opium"
doc: "https://rgrinberg.github.io/opium/"
bug-reports: "https://github.com/rgrinberg/opium/issues"
depends: [
"dune" {>= "2.0"}
"ocaml" {>= "4.08"}
"dune" {>= "1.11"}
"lwt" {>= "5.3.0"}
"bigstringaf"
"hmap"
Expand Down
3 changes: 2 additions & 1 deletion rock.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ depends: [
"base-threads" {= "base"}
"base-unix" {= "base"}
"bigarray-compat" {= "1.0.0"}
"bigstringaf" {= "0.6.1"}
"bigstringaf" {= "0.7.0"}
"conf-m4" {= "1"}
"conf-pkg-config" {= "1.3"}
"cppo" {= "1.6.6"}
"csexp" {= "1.3.2"}
"dune" {= "2.7.1"}
Expand Down

0 comments on commit 5dee70c

Please sign in to comment.