diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 19b14278..18202e35 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,6 +23,7 @@ jobs: - 4.11.0 - 4.12.0 - 4.13.0 + - ocaml-base-compiler.4.14.0~beta1 steps: - uses: actions/checkout@v2 @@ -32,6 +33,9 @@ jobs: with: ocaml-compiler: ${{ matrix.ocaml-compiler }} cache-prefix: opam-${{ matrix.ocaml-compiler }}- + opam-repositories: | + default: https://github.com/ocaml/opam-repository.git + beta: https://github.com/ocaml/ocaml-beta-repository.git - name: Install dependencies run: | diff --git a/jupyter.opam b/jupyter.opam index 7aa4e749..ba728192 100644 --- a/jupyter.opam +++ b/jupyter.opam @@ -17,7 +17,7 @@ build: [ [ "dune" "build" "-p" name "-j" jobs ] ] depends: [ - "ocaml" {>= "4.04.0" & < "4.14"} + "ocaml" {>= "4.04.0" & < "4.15"} "base-threads" "base-unix" "uuidm" {>= "0.9.6"} diff --git a/jupyter/src/comm/manager.ml b/jupyter/src/comm/manager.ml index 5f7d4034..f18f05b0 100644 --- a/jupyter/src/comm/manager.ml +++ b/jupyter/src/comm/manager.ml @@ -91,7 +91,7 @@ struct let default = `Assoc [] let create ?(data = default) target = - let comm_id = Uuidm.(to_string (create `V4)) in + let comm_id = Uuidm.(to_string (v `V4)) in ignore (register target comm_id) ; Jupyter_notebook__Unsafe.send_iopub (IOPUB_COMM_OPEN { diff --git a/jupyter/src/core/message.ml b/jupyter/src/core/message.ml index d1b8c981..efd200db 100644 --- a/jupyter/src/core/message.ml +++ b/jupyter/src/core/message.ml @@ -92,7 +92,7 @@ let epoch_to_iso8601_string epoch = let create_next ?(time = Unix.gettimeofday ()) ~content_to_yojson parent content = let date = Some (epoch_to_iso8601_string time) in - let msg_id = Uuidm.(to_string (create `V4)) in + let msg_id = Uuidm.(to_string (v `V4)) in let msg_type = match content_to_yojson content with | `List (`String msg_type :: _) -> msg_type diff --git a/jupyter/src/notebook/jupyter_notebook.ml b/jupyter/src/notebook/jupyter_notebook.ml index 06ced5d7..ba01480a 100644 --- a/jupyter/src/notebook/jupyter_notebook.ml +++ b/jupyter/src/notebook/jupyter_notebook.ml @@ -40,7 +40,7 @@ let display ?ctx ?display_id ?(metadata = `Assoc []) ?(base64 = false) mime data let send content = Unsafe.send_iopub ?ctx content in match display_id with | None -> - let display_id = Uuidm.(to_string (create `V4)) in + let display_id = Uuidm.(to_string (v `V4)) in send (IOPUB_DISPLAY_DATA { display_data = `Assoc [mime, `String data]; display_metadata = metadata; diff --git a/jupyter/src/repl/caml_args.cppo.ml b/jupyter/src/repl/caml_args.cppo.ml index afa79b2a..9f7aa221 100644 --- a/jupyter/src/repl/caml_args.cppo.ml +++ b/jupyter/src/repl/caml_args.cppo.ml @@ -83,7 +83,11 @@ let file_argument name = (Array.length Sys.argv - !Arg.current) in Compenv.readenv ppf Compenv.Before_link; +#if OCAML_VERSION < (4,14,0) if prepare ppf && Toploop.run_script ppf name newargs +#else + if prepare ppf && Toploop.run_script ppf (Toploop.File name) newargs +#endif then exit 0 else exit 2 end @@ -205,6 +209,12 @@ module Options = Main_args.Make_bytetop_options (struct let _dlocations = set Clflags.locations let _dno_locations = clear Clflags.locations #endif + +#if OCAML_VERSION >= (4,14,0) +let _force_tmc = set Clflags.force_tmc +let _dshape = set Clflags.dump_shape +let _eval (_ : string) = () +#endif end) #if OCAML_VERSION >= (4,05,0) diff --git a/jupyter/src/repl/dune b/jupyter/src/repl/dune index 4c2969cf..e4fe92cc 100644 --- a/jupyter/src/repl/dune +++ b/jupyter/src/repl/dune @@ -34,6 +34,11 @@ (deps error.cppo.ml) (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets}))) +(rule + (targets evaluation.ml) + (deps evaluation.cppo.ml) + (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets}))) + (rule (targets lwt_async_rewrite.ml) (deps lwt_async_rewrite.cppo.ml) diff --git a/jupyter/src/repl/evaluation.ml b/jupyter/src/repl/evaluation.cppo.ml similarity index 95% rename from jupyter/src/repl/evaluation.ml rename to jupyter/src/repl/evaluation.cppo.ml index 10abf533..84713a05 100644 --- a/jupyter/src/repl/evaluation.ml +++ b/jupyter/src/repl/evaluation.cppo.ml @@ -60,7 +60,12 @@ let init ?(preinit = ignore) ?init_file () = preinit () ; begin match init_file with | None -> () - | Some path -> ignore (Toploop.use_silently Format.std_formatter path) + | Some path -> +#if OCAML_VERSION < (4,14,0) + ignore (Toploop.use_silently Format.std_formatter path) +#else + ignore (Toploop.use_silently Format.std_formatter (Toploop.File path)) +#endif end let setvalue name value = Toploop.setvalue name (Obj.repr value) diff --git a/jupyter/src/repl/lwt_async_rewrite.cppo.ml b/jupyter/src/repl/lwt_async_rewrite.cppo.ml index 4ed98ee8..a88fe8e2 100644 --- a/jupyter/src/repl/lwt_async_rewrite.cppo.ml +++ b/jupyter/src/repl/lwt_async_rewrite.cppo.ml @@ -88,7 +88,11 @@ let rule_path rule = ; Types.type_manifest = Some ty ; _ } -> begin +#if OCAML_VERSION < (4,14,0) match Ctype.expand_head env ty with +#else + match Types.Transient_expr.repr (Ctype.expand_head env ty) with +#endif | { Types.desc = Types.Tconstr (path, _, _); _ } -> path | _ -> path end @@ -132,7 +136,11 @@ let is_eval = function (* Returns the rewrite rule associated to a type, if any. *) let rule_of_type typ = +#if OCAML_VERSION < (4,14,0) match (Ctype.expand_head !Toploop.toplevel_env typ).Types.desc with +#else + match (Types.Transient_expr.repr (Ctype.expand_head !Toploop.toplevel_env typ)).Types.desc with +#endif | Types.Tconstr (path, _, _) -> begin try Some (List.find (fun rule -> rule_matches rule path) rewrite_rules) @@ -165,8 +173,10 @@ let rewrite phrase = let tstr, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr Location.none in #elif OCAML_VERSION < (4,12,0) let tstr, _, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr Location.none in -#else +#elif OCAML_VERSION < (4,14,0) let tstr, _, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr in +#else + let tstr, _, _, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr in #endif Parsetree.Ptop_def (List.map2 rewrite_str_item pstr tstr.Typedtree.str_items) else