From 5dee70c5dd4bb4ec550a8d237d8e7976fd448947 Mon Sep 17 00:00:00 2001 From: Thibaut Mattio Date: Sat, 28 Nov 2020 12:11:15 +0100 Subject: [PATCH] Fix dependencies (#227) --- .github/workflows/ci.yml | 31 +++++++++++++++++++++---------- Makefile | 4 ++-- README.cpp.md | 4 ++-- README.md | 4 ++-- dune-project | 11 ++--------- dune-workspace.dev | 13 +++++++++++++ opium-testing.opam | 2 +- opium-testing.opam.locked | 4 ++-- opium.opam | 3 ++- opium.opam.locked | 4 ++-- opium/src/cookie.ml | 15 ++++++++++++++- opium/src/import.ml | 10 ++++++++++ rock.opam | 2 +- rock.opam.locked | 3 ++- 14 files changed, 76 insertions(+), 34 deletions(-) create mode 100644 dune-workspace.dev diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e73a7f9b..a53667f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: | @@ -53,7 +64,7 @@ jobs: run: make build - name: Check formatting - run: make format + run: make fmt - name: Run tests run: make test diff --git a/Makefile b/Makefile index 3a5dd73f..00ba0adc 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.cpp.md b/README.cpp.md index bfd20be3..9df58c34 100644 --- a/README.cpp.md +++ b/README.cpp.md @@ -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 diff --git a/README.md b/README.md index 851682b4..7c37f945 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/dune-project b/dune-project index d1ab7e6c..833de6b0 100644 --- a/dune-project +++ b/dune-project @@ -1,6 +1,4 @@ -(lang dune 1.11) - -(using fmt 1.2) +(lang dune 2.0) (name opium) @@ -26,8 +24,6 @@ (depends (ocaml (>= 4.08)) - (dune - (>= 1.11)) (lwt (>= 5.3.0)) bigstringaf @@ -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 @@ -75,8 +70,6 @@ (depends (ocaml (>= 4.08)) - (dune - (>= 1.11)) (opium (= :version)) alcotest diff --git a/dune-workspace.dev b/dune-workspace.dev new file mode 100644 index 00000000..fd1bb344 --- /dev/null +++ b/dune-workspace.dev @@ -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))) diff --git a/opium-testing.opam b/opium-testing.opam index 23aecea1..0c27e33a 100644 --- a/opium-testing.opam +++ b/opium-testing.opam @@ -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" diff --git a/opium-testing.opam.locked b/opium-testing.opam.locked index 16dec2eb..34329ba2 100644 --- a/opium-testing.opam.locked +++ b/opium-testing.opam.locked @@ -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"} @@ -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"} diff --git a/opium.opam b/opium.opam index 866c04aa..2e3ff0d1 100644 --- a/opium.opam +++ b/opium.opam @@ -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" diff --git a/opium.opam.locked b/opium.opam.locked index b5565eab..ca0d48b5 100644 --- a/opium.opam.locked +++ b/opium.opam.locked @@ -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"} @@ -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"} diff --git a/opium/src/cookie.ml b/opium/src/cookie.ml index 13b41269..eee40c25 100644 --- a/opium/src/cookie.ml +++ b/opium/src/cookie.ml @@ -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 @@ -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 diff --git a/opium/src/import.ml b/opium/src/import.ml index 931ab9b9..867a91b3 100644 --- a/opium/src/import.ml +++ b/opium/src/import.ml @@ -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 diff --git a/rock.opam b/rock.opam index 02c65478..65645a23 100644 --- a/rock.opam +++ b/rock.opam @@ -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" diff --git a/rock.opam.locked b/rock.opam.locked index 8a9f8310..effd4388 100644 --- a/rock.opam.locked +++ b/rock.opam.locked @@ -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"}