diff --git a/bisect_ppx.opam b/bisect_ppx.opam index 77a20062..d68c7372 100644 --- a/bisect_ppx.opam +++ b/bisect_ppx.opam @@ -23,6 +23,7 @@ depends: [ "dune" {>= "2.7.0"} "ocaml" {>= "4.03.0"} "ppxlib" {>= "0.28.0"} + "melange" "dune" {with-test & >= "3.0.0"} "ocamlformat" {with-test & = "0.16.0"} diff --git a/dune-project b/dune-project index e1e4354c..67e6bdf3 100644 --- a/dune-project +++ b/dune-project @@ -1,2 +1,5 @@ -(lang dune 2.7) +(lang dune 3.8) + +(using melange 0.1) + (cram enable) diff --git a/src/common/dune b/src/common/dune index 385c41a0..721333fe 100644 --- a/src/common/dune +++ b/src/common/dune @@ -1,4 +1,5 @@ (library (name bisect_common) + (modes :standard melange) (public_name bisect_ppx.common) (synopsis "Bisect_ppx internal functions (internal)")) diff --git a/src/ppx/dune b/src/ppx/dune index fa344af7..68415483 100644 --- a/src/ppx/dune +++ b/src/ppx/dune @@ -7,7 +7,7 @@ (kind ppx_rewriter) (instrumentation.backend (ppx bisect_ppx)) (synopsis "Code coverage for OCaml") - (ppx_runtime_libraries bisect_ppx.runtime) + (ppx_runtime_libraries bisect_ppx.runtime_melange) (preprocess (pps ppxlib.metaquot)) (flags (:standard -open Ocaml_shadow)) (libraries bisect_ppx.common ppxlib str)) diff --git a/src/runtime/js/dune b/src/runtime/js/dune new file mode 100644 index 00000000..e3d9efc1 --- /dev/null +++ b/src/runtime/js/dune @@ -0,0 +1,7 @@ +(library + (name bisect) + (modes melange) + (public_name bisect_ppx.runtime_melange) + (synopsis "Bisect_ppx runtime library for Melange") + (libraries bisect_common melange) + (preprocess (pps melange.ppx))) diff --git a/src/runtime/js/jest.ml b/src/runtime/js/jest.ml index e986f8e7..d4ec2c70 100644 --- a/src/runtime/js/jest.ml +++ b/src/runtime/js/jest.ml @@ -7,12 +7,11 @@ this will cause timeout in Jest because Jest will wait until you manually invoke param.done() within afterAll. *) -external afterAll : ((unit -> unit) [@bs]) -> unit = "afterAll" - [@@bs.val] +external afterAll : ((unit -> unit) [@u]) -> unit = "afterAll" let () = afterAll ((fun () -> Runtime.write_coverage_data (); Runtime.reset_coverage_data ()) - [@bs]) + [@u]) diff --git a/src/runtime/js/runtime.ml b/src/runtime/js/runtime.ml index 7078db6c..1e51a5dc 100644 --- a/src/runtime/js/runtime.ml +++ b/src/runtime/js/runtime.ml @@ -13,20 +13,20 @@ struct struct external openSync : string -> - ([ `Read [@as "r"] - | `Read_write [@as "r+"] - | `Read_write_sync [@as "rs+"] - | `Write [@as "w"] - | `Write_fail_if_exists [@as "wx"] - | `Write_read [@as "w+"] - | `Write_read_fail_if_exists [@as "wx+"] - | `Append [@as "a"] - | `Append_fail_if_exists [@as "ax"] - | `Append_read [@as "a+"] - | `Append_read_fail_if_exists [@as "ax+"] ] - [@string]) -> + ([ `Read [@mel.as "r"] + | `Read_write [@mel.as "r+"] + | `Read_write_sync [@mel.as "rs+"] + | `Write [@mel.as "w"] + | `Write_fail_if_exists [@mel.as "wx"] + | `Write_read [@mel.as "w+"] + | `Write_read_fail_if_exists [@mel.as "wx+"] + | `Append [@mel.as "a"] + | `Append_fail_if_exists [@mel.as "ax"] + | `Append_read [@mel.as "a+"] + | `Append_read_fail_if_exists [@mel.as "ax+"] ] + [@mel.string]) -> unit = "openSync" - [@@module "fs"] + [@@mel.module "fs"] type encoding = [ | `hex @@ -42,7 +42,7 @@ struct external writeFileSync : string -> string -> encoding -> unit = "writeFileSync" - [@@val] [@@module "fs"] + [@@mel.module "fs"] end end @@ -70,7 +70,7 @@ let write_coverage_data () = let reset_coverage_data = Bisect_common.reset_counters -let node_at_exit = [%bs.raw {| +let node_at_exit: (unit -> unit) -> unit = [%mel.raw {| function (callback) { if (typeof process !== 'undefined' && typeof process.on !== 'undefined') process.on("exit", callback); diff --git a/src/runtime/native/dune b/src/runtime/native/dune index 76ae2c33..6dc4f703 100644 --- a/src/runtime/native/dune +++ b/src/runtime/native/dune @@ -1,5 +1,5 @@ (library - (name bisect) + (name bisect_native) (public_name bisect_ppx.runtime) (synopsis "Bisect_ppx runtime library (internal)") (libraries bisect_ppx.common unix))