Skip to content
Draft
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
1 change: 1 addition & 0 deletions bisect_ppx.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
5 changes: 4 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
(lang dune 2.7)
(lang dune 3.8)

(using melange 0.1)

(cram enable)
1 change: 1 addition & 0 deletions src/common/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(library
(name bisect_common)
(modes :standard melange)
(public_name bisect_ppx.common)
(synopsis "Bisect_ppx internal functions (internal)"))
2 changes: 1 addition & 1 deletion src/ppx/dune
Original file line number Diff line number Diff line change
Expand Up @@ -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))
7 changes: 7 additions & 0 deletions src/runtime/js/dune
Original file line number Diff line number Diff line change
@@ -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)))
5 changes: 2 additions & 3 deletions src/runtime/js/jest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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])
30 changes: 15 additions & 15 deletions src/runtime/js/runtime.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,7 +42,7 @@ struct

external writeFileSync : string -> string -> encoding -> unit =
"writeFileSync"
[@@val] [@@module "fs"]
[@@mel.module "fs"]
end
end

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/native/dune
Original file line number Diff line number Diff line change
@@ -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))