diff --git a/CHANGES.md b/CHANGES.md index 5636d23aaa..7f2cea757e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,8 @@ + Qtest comments are not re-formatted (#2034, @gpetiot) + + ocamlformat-rpc is now distributed through the ocamlformat package (#2035, @Julow) + #### New features + New syntax `(*= ... *)` for verbatim comments (#2028, @gpetiot) diff --git a/bin/ocamlformat-rpc/dune b/bin/ocamlformat-rpc/dune index 1d6513f3c5..f1bda4fa5b 100644 --- a/bin/ocamlformat-rpc/dune +++ b/bin/ocamlformat-rpc/dune @@ -12,12 +12,12 @@ (executable (name main) (public_name ocamlformat-rpc) - (package ocamlformat-rpc) + (package ocamlformat) (flags (:standard -open Ocamlformat_stdlib)) (instrumentation (backend bisect_ppx)) - (libraries ocamlformat-rpc)) + (libraries ocamlformat.rpc)) (rule (with-stdout-to @@ -27,7 +27,4 @@ (install (section man) (files ocamlformat-rpc.1) - (package ocamlformat-rpc)) - -(documentation - (package ocamlformat-rpc)) + (package ocamlformat)) diff --git a/doc/index.mld b/doc/index.mld index ee06884a5e..3a92053278 100644 --- a/doc/index.mld +++ b/doc/index.mld @@ -13,3 +13,4 @@ OCamlFormat is a tool to format OCaml code. - {{!page-howtos}How-To's} - {{!page-faq}Frequently asked questions} - {{!page-doc_comments}Doc-comments language reference} +- {{!page-rpc}RPC} diff --git a/bin/ocamlformat-rpc/index.mld b/doc/rpc.mld similarity index 100% rename from bin/ocamlformat-rpc/index.mld rename to doc/rpc.mld diff --git a/dune b/dune index 287ab3c29c..1b5577993a 100644 --- a/dune +++ b/dune @@ -32,11 +32,11 @@ (with-stdout-to ocamlformat-rpc-help.actual (run %{bin:ocamlformat-rpc} --help=plain))) - (package ocamlformat-rpc)) + (package ocamlformat)) (rule (alias runtest) - (package ocamlformat-rpc) + (package ocamlformat) (action (diff ocamlformat-rpc-help.txt ocamlformat-rpc-help.actual))) diff --git a/dune-project b/dune-project index 68f528a369..b3e96c732f 100644 --- a/dune-project +++ b/dune-project @@ -70,7 +70,9 @@ (uuseg (>= 10.0.0)) (uutf - (>= 1.0.1)))) + (>= 1.0.1)) + (csexp + (>= 1.4.0)))) (package (name ocamlformat-bench) @@ -93,22 +95,6 @@ (< v0.15)) yojson)) -(package - (name ocamlformat-rpc) - (synopsis "Auto-formatter for OCaml code (RPC mode)") - (description - "OCamlFormat is a tool to automatically format OCaml code in a uniform style. This package defines a RPC interface to OCamlFormat") - (depends - (ocaml - (and - (>= 4.08) - (< 4.15))) - (alcotest :with-test) - (ocamlformat - (= :version)) - (ocamlformat-rpc-lib - (= :version)))) - (package (name ocamlformat-rpc-lib) (synopsis "Auto-formatter for OCaml code (RPC mode)") diff --git a/lib-rpc-server/dune b/lib-rpc-server/dune index 72f46081ad..f033ac4942 100644 --- a/lib-rpc-server/dune +++ b/lib-rpc-server/dune @@ -1,4 +1,4 @@ (library (name ocamlformat_rpc) - (public_name ocamlformat-rpc) - (libraries ocamlformat ocamlformat-rpc-lib)) + (public_name ocamlformat.rpc) + (libraries ocamlformat ocamlformat.rpc_lib_protocol)) diff --git a/lib-rpc-server/ocamlformat_rpc.ml b/lib-rpc-server/ocamlformat_rpc.ml index 2e737e8e41..db447b31b4 100644 --- a/lib-rpc-server/ocamlformat_rpc.ml +++ b/lib-rpc-server/ocamlformat_rpc.ml @@ -1,5 +1,4 @@ open Ocamlformat -open Ocamlformat_rpc_lib open Ocamlformat_stdlib module IO = struct @@ -24,16 +23,19 @@ module IO = struct return () end +module Rpc = Ocamlformat_rpc_lib_protocol.Protocol +module Protocol = Rpc.Make (IO) + module V = struct let handshake x = - match Version.of_string x with + match Rpc.Version.of_string x with | Some v -> `Handled v - | None -> `Propose_another Version.V2 + | None -> `Propose_another Rpc.Version.V2 end -type state = Waiting_for_version | Version_defined of (Version.t * Conf.t) - -include Make (IO) +type state = + | Waiting_for_version + | Version_defined of (Rpc.Version.t * Conf.t) let format fg conf source = let input_name = "" in @@ -80,20 +82,16 @@ let run_format conf x = ; format Expression ; format Use_file ] -let run_format_with_args {path; config} conf x = +let run_format_with_args {Rpc.path; config} conf x = let open Result in Option.value_map path ~default:(Ok conf) ~f:run_path >>= fun conf -> Option.value_map config ~default:(Ok conf) ~f:(fun c -> run_config conf c) >>= fun conf -> run_format conf x -let handle_format_error e output = - output stdout (`Error e) ; - Out_channel.flush stdout +let handle_format_error e output = output stdout (`Error e) -let handle_path_error e output = - output stdout (`Error e) ; - Out_channel.flush stdout +let handle_path_error e output = output stdout (`Error e) let handle_config_error (e : Config_option.Error.t) output = let msg = @@ -105,8 +103,7 @@ let handle_config_error (e : Config_option.Error.t) output = Format.sprintf "Misplaced configuration value (%s, %s)" x y | Unknown (x, _) -> Format.sprintf "Unknown configuration option %s" x in - output stdout (`Error msg) ; - Out_channel.flush stdout + output stdout (`Error msg) let handle_error e output = match e with @@ -116,58 +113,55 @@ let handle_error e output = let rec rpc_main = function | Waiting_for_version -> ( - match Init.read_input stdin with + match Protocol.Init.read_input stdin with | `Halt -> Ok () | `Unknown -> Ok () | `Version vstr -> ( match V.handshake vstr with | `Handled v -> - Init.output stdout (`Version vstr) ; - Out_channel.flush stdout ; + Protocol.Init.output stdout (`Version vstr) ; rpc_main (Version_defined (v, Conf.default)) | `Propose_another v -> - let vstr = Version.to_string v in - Init.output stdout (`Version vstr) ; - Out_channel.flush stdout ; + let vstr = Rpc.Version.to_string v in + Protocol.Init.output stdout (`Version vstr) ; rpc_main Waiting_for_version ) ) | Version_defined (v, conf) as state -> ( match v with | V1 -> ( - match V1.Command.read_input stdin with + match Protocol.V1.read_input stdin with | `Halt -> Ok () | `Unknown | `Error _ -> rpc_main state | `Format x -> let conf = - match run_format_with_args empty_args conf x with + match run_format_with_args Rpc.empty_args conf x with | Ok (`Format formatted) -> - V1.Command.output stdout (`Format formatted) ; + Protocol.V1.output stdout (`Format formatted) ; conf | Error e -> - handle_error e V1.Command.output ; + handle_error e Protocol.V1.output ; conf in rpc_main (Version_defined (v, conf)) | `Config c -> ( match run_config conf c with | Ok conf -> - V1.Command.output stdout (`Config c) ; - Out_channel.flush stdout ; + Protocol.V1.output stdout (`Config c) ; rpc_main (Version_defined (v, conf)) | Error (`Config_error e) -> - handle_config_error e V1.Command.output ; + handle_config_error e Protocol.V1.output ; rpc_main state ) ) | V2 -> ( - match V2.Command.read_input stdin with + match Protocol.V2.read_input stdin with | `Halt -> Ok () | `Unknown | `Error _ -> rpc_main state | `Format (x, format_args) -> let conf = match run_format_with_args format_args conf x with | Ok (`Format formatted) -> - V2.Command.output stdout (`Format (formatted, format_args)) ; + Protocol.V2.output stdout (`Format (formatted, format_args)) ; conf | Error e -> - handle_error e V2.Command.output ; + handle_error e Protocol.V2.output ; conf in rpc_main (Version_defined (v, conf)) ) ) diff --git a/lib-rpc/lib-protocol/dune b/lib-rpc/lib-protocol/dune new file mode 100644 index 0000000000..37d0447184 --- /dev/null +++ b/lib-rpc/lib-protocol/dune @@ -0,0 +1,21 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; ; +; OCamlFormat ; +; ; +; Copyright (c) Facebook, Inc. and its affiliates. ; +; ; +; This source code is licensed under the MIT license found in ; +; the LICENSE file in the root directory of this source tree. ; +; ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Duplicate these two modules in order to share types and +; serialization/deserialization code between two independent packages. + +(library + (name ocamlformat_rpc_lib_protocol) + (public_name ocamlformat.rpc_lib_protocol) + (libraries csexp)) + +(copy_files# + (files ../{IO,protocol}.ml{,i})) diff --git a/lib-rpc/ocamlformat_rpc_lib.ml b/lib-rpc/ocamlformat_rpc_lib.ml index be95d855ac..e96bddba9b 100644 --- a/lib-rpc/ocamlformat_rpc_lib.ml +++ b/lib-rpc/ocamlformat_rpc_lib.ml @@ -9,151 +9,36 @@ (* *) (**************************************************************************) -type format_args = +type format_args = Protocol.format_args = {path: string option; config: (string * string) list option} -let empty_args = {path= None; config= None} +let empty_args = Protocol.empty_args -module Version = struct - type t = V1 | V2 - - let to_string = function V1 -> "v1" | V2 -> "v2" - - let of_string = function - | "v1" | "V1" -> Some V1 - | "v2" | "V2" -> Some V2 - | _ -> None -end +module Version = Protocol.Version module type IO = IO.S -module Make (IO : IO) = struct - module type Command_S = sig - type t - - val read_input : IO.ic -> t IO.t - - val to_sexp : t -> Csexp.t - - val output : IO.oc -> t -> unit IO.t - end - - module type Client_S = sig - type t - - type cmd - - val pid : t -> int - - val mk : pid:int -> IO.ic -> IO.oc -> t - - val query : cmd -> t -> cmd IO.t - - val halt : t -> (unit, [> `Msg of string]) result IO.t - end - - module Init : - Command_S with type t = [`Halt | `Unknown | `Version of string] = struct - type t = [`Halt | `Unknown | `Version of string] - - let read_input ic = - let open IO in - read ic - >>= function - | None -> return `Halt - | Some (Atom "Halt") -> return `Halt - | Some (List [Atom "Version"; Atom v]) -> return (`Version v) - | Some _ -> return `Unknown - - let to_sexp = - let open Csexp in - function - | `Version v -> List [Atom "Version"; Atom v] | _ -> assert false - - let output oc t = IO.write oc [to_sexp t] - end - - module V1 : sig - module Command : - Command_S - with type t = - [ `Halt - | `Unknown - | `Error of string - | `Config of (string * string) list - | `Format of string ] - - module Client : sig - include Client_S with type cmd = Command.t +module Protocol = Protocol - val config : - (string * string) list -> t -> (unit, [> `Msg of string]) result IO.t - - val format : string -> t -> (string, [> `Msg of string]) result IO.t - end - end = struct - module Command = struct - type t = - [ `Halt - | `Unknown - | `Error of string - | `Config of (string * string) list - | `Format of string ] - - let read_input ic = - let open Csexp in - let open IO in - read ic - >>= function - | None -> return `Halt - | Some (List [Atom "Format"; Atom x]) -> return (`Format x) - | Some (List [Atom "Config"; List l]) -> - let c = - List.fold_left - (fun acc -> function - | List [Atom name; Atom value] -> (name, value) :: acc - | _ -> acc ) - [] l - |> List.rev - in - return (`Config c) - | Some (List [Atom "Error"; Atom x]) -> return (`Error x) - | Some (Atom "Halt") -> return `Halt - | Some _ -> return `Unknown - - let to_sexp = - let open Csexp in - function - | `Format x -> List [Atom "Format"; Atom x] - | `Config c -> - let l = - List.map (fun (name, value) -> List [Atom name; Atom value]) c - in - List [Atom "Config"; List l] - | `Error x -> List [Atom "Error"; Atom x] - | `Halt -> Atom "Halt" - | _ -> assert false - - let output oc t = IO.write oc [to_sexp t] - end +module Make (IO : IO) = struct + module Protocol = Protocol.Make (IO) + module V1 = struct module Client = struct type t = {pid: int; input: IO.ic; output: IO.oc} - type cmd = Command.t - let pid t = t.pid let mk ~pid input output = {pid; input; output} let query command t = let open IO in - Command.output t.output command - >>= fun () -> Command.read_input t.input + Protocol.V1.output t.output command + >>= fun () -> Protocol.V1.read_input t.input let halt t = let open IO in - match Command.output t.output `Halt with + match Protocol.V1.output t.output `Halt with | exception _ -> return (Error (`Msg "failing to close connection to server")) | (_ : unit IO.t) -> return (Ok ()) @@ -178,102 +63,22 @@ module Make (IO : IO) = struct end end - module V2 : sig - module Command : - Command_S - with type t = - [ `Halt - | `Unknown - | `Error of string - | `Format of string * format_args ] - - module Client : sig - include Client_S with type cmd = Command.t - - val format : - format_args:format_args - -> string - -> t - -> (string, [> `Msg of string]) result IO.t - end - end = struct - module Command = struct - type t = - [ `Halt - | `Unknown - | `Error of string - | `Format of string * format_args ] - - let read_input ic = - let open Csexp in - let open IO in - let csexp_to_config csexpl = - List.filter_map - (function - | List [Atom name; Atom value] -> Some (name, value) - | _ -> None ) - csexpl - in - read ic - >>= function - | None -> return `Halt - | Some (List (Atom "Format" :: Atom x :: l)) -> - let extract args csexp = - match csexp with - | List [Atom "Config"; List l] -> - {args with config= Some (csexp_to_config l)} - | List [Atom "Path"; Atom path] -> {args with path= Some path} - | _ -> args - in - let args = List.fold_left extract empty_args l in - return (`Format (x, args)) - | Some (List [Atom "Error"; Atom x]) -> return (`Error x) - | Some (Atom "Halt") -> return `Halt - | Some _ -> return `Unknown - - let to_sexp = - let open Csexp in - function - | `Format (x, {path; config}) -> - let map_config name config = - let c = - List.map - (fun (name, value) -> List [Atom name; Atom value]) - config - in - List [Atom name; List c] - in - let ofp = - Option.map (fun path -> List [Atom "Path"; Atom path]) path - and oconfig = Option.map (map_config "Config") config in - List - (List.filter_map - (fun i -> i) - [Some (Atom "Format"); Some (Atom x); ofp; oconfig] ) - | `Error x -> List [Atom "Error"; Atom x] - | `Halt -> Atom "Halt" - | _ -> assert false - - let output oc t = IO.write oc [to_sexp t] - end - + module V2 = struct module Client = struct type t = {pid: int; input: IO.ic; output: IO.oc} - type cmd = Command.t - let pid t = t.pid let mk ~pid input output = {pid; input; output} let query command t = let open IO in - Command.output t.output command - >>= fun () -> Command.read_input t.input + Protocol.V2.output t.output command + >>= fun () -> Protocol.V2.read_input t.input let halt t = let open IO in - match Command.output t.output `Halt with + match Protocol.V2.output t.output `Halt with | exception _ -> return (Error (`Msg "failing to close connection to server")) | (_ : unit IO.t) -> return (Ok ()) @@ -301,9 +106,9 @@ module Make (IO : IO) = struct let rec aux = function | [] -> return (Error (`Msg "Version negociation failed")) | latest :: others -> ( - IO.write oc [Init.to_sexp (`Version latest)] + Protocol.Init.output oc (`Version latest) >>= fun () -> - Init.read_input ic + Protocol.Init.read_input ic >>= function | `Version v when v = latest -> return (get_client ~pid ic oc v) | `Version v -> ( diff --git a/lib-rpc/ocamlformat_rpc_lib.mli b/lib-rpc/ocamlformat_rpc_lib.mli index 0bacbc34ff..a632a65a20 100644 --- a/lib-rpc/ocamlformat_rpc_lib.mli +++ b/lib-rpc/ocamlformat_rpc_lib.mli @@ -24,88 +24,43 @@ module RPC = Ocamlformat_rpc_lib.Make (IO) ]} *) -type format_args = - { path: string option - (** Path used for the current formatting request, this allows - ocamlformat to determine which .ocamlformat files must be - applied. *) - ; config: (string * string) list option - (** Additional options used for the current formatting request. *) } +module Protocol = Protocol -val empty_args : format_args - -module Version : sig - type t = V1 | V2 +type format_args = Protocol.format_args - val to_string : t -> string +val empty_args : format_args - val of_string : string -> t option -end +module Version = Protocol.Version module type IO = IO.S module Make (IO : IO) : sig - module type Command_S = sig - type t - - val read_input : IO.ic -> t IO.t - - val to_sexp : t -> Csexp.t - - val output : IO.oc -> t -> unit IO.t - end - - module type Client_S = sig - type t - - type cmd - - val pid : t -> int - - val mk : pid:int -> IO.ic -> IO.oc -> t - - val query : cmd -> t -> cmd IO.t - - val halt : t -> (unit, [> `Msg of string]) result IO.t - (** The caller must close the input and output channels after calling - [halt]. *) - end - - (** Version used to set the protocol version *) - module Init : - Command_S with type t = [`Halt | `Unknown | `Version of string] - module V1 : sig - module Command : - Command_S - with type t = - [ `Halt - | `Unknown - | `Error of string - | `Config of (string * string) list - | `Format of string ] - module Client : sig - include Client_S with type cmd = Command.t + type t + + val pid : t -> int + + val mk : pid:int -> IO.ic -> IO.oc -> t val config : (string * string) list -> t -> (unit, [> `Msg of string]) result IO.t val format : string -> t -> (string, [> `Msg of string]) result IO.t + + val halt : t -> (unit, [> `Msg of string]) result IO.t + (** The caller must close the input and output channels after calling + [halt]. *) end end module V2 : sig - module Command : - Command_S - with type t = - [ `Halt - | `Unknown - | `Error of string - | `Format of string * format_args ] - module Client : sig - include Client_S with type cmd = Command.t + type t + + val pid : t -> int + + val mk : pid:int -> IO.ic -> IO.oc -> t val format : format_args:format_args @@ -114,6 +69,10 @@ module Make (IO : IO) : sig -> (string, [> `Msg of string]) result IO.t (** [format_args] modifies the server's configuration temporarily, for the current request. *) + + val halt : t -> (unit, [> `Msg of string]) result IO.t + (** The caller must close the input and output channels after calling + [halt]. *) end end diff --git a/lib-rpc/protocol.ml b/lib-rpc/protocol.ml new file mode 100644 index 0000000000..73ee89d4c6 --- /dev/null +++ b/lib-rpc/protocol.ml @@ -0,0 +1,158 @@ +(**************************************************************************) +(* *) +(* OCamlFormat *) +(* *) +(* Copyright (c) Facebook, Inc. and its affiliates. *) +(* *) +(* This source code is licensed under the MIT license found in *) +(* the LICENSE file in the root directory of this source tree. *) +(* *) +(**************************************************************************) + +type format_args = + {path: string option; config: (string * string) list option} + +let empty_args = {path= None; config= None} + +module Version = struct + type t = V1 | V2 + + let to_string = function V1 -> "v1" | V2 -> "v2" + + let of_string = function + | "v1" | "V1" -> Some V1 + | "v2" | "V2" -> Some V2 + | _ -> None +end + +module Make (IO : IO.S) = struct + module type Command_S = sig + type t + + val read_input : IO.ic -> t IO.t + + val output : IO.oc -> t -> unit IO.t + end + + module Init = struct + type t = [`Halt | `Unknown | `Version of string] + + let read_input ic = + let open IO in + read ic + >>= function + | None -> return `Halt + | Some (Atom "Halt") -> return `Halt + | Some (List [Atom "Version"; Atom v]) -> return (`Version v) + | Some _ -> return `Unknown + + let to_sexp = + let open Csexp in + function + | `Version v -> List [Atom "Version"; Atom v] | _ -> assert false + + let output oc t = IO.write oc [to_sexp t] + end + + module V1 = struct + type t = + [ `Halt + | `Unknown + | `Error of string + | `Config of (string * string) list + | `Format of string ] + + let read_input ic = + let open Csexp in + let open IO in + read ic + >>= function + | None -> return `Halt + | Some (List [Atom "Format"; Atom x]) -> return (`Format x) + | Some (List [Atom "Config"; List l]) -> + let c = + List.fold_left + (fun acc -> function + | List [Atom name; Atom value] -> (name, value) :: acc + | _ -> acc ) + [] l + |> List.rev + in + return (`Config c) + | Some (List [Atom "Error"; Atom x]) -> return (`Error x) + | Some (Atom "Halt") -> return `Halt + | Some _ -> return `Unknown + + let to_sexp = + let open Csexp in + function + | `Format x -> List [Atom "Format"; Atom x] + | `Config c -> + let l = + List.map (fun (name, value) -> List [Atom name; Atom value]) c + in + List [Atom "Config"; List l] + | `Error x -> List [Atom "Error"; Atom x] + | `Halt -> Atom "Halt" + | _ -> assert false + + let output oc t = IO.write oc [to_sexp t] + end + + module V2 = struct + type t = + [`Halt | `Unknown | `Error of string | `Format of string * format_args] + + let read_input ic = + let open Csexp in + let open IO in + let csexp_to_config csexpl = + List.filter_map + (function + | List [Atom name; Atom value] -> Some (name, value) | _ -> None + ) + csexpl + in + read ic + >>= function + | None -> return `Halt + | Some (List (Atom "Format" :: Atom x :: l)) -> + let extract args csexp = + match csexp with + | List [Atom "Config"; List l] -> + {args with config= Some (csexp_to_config l)} + | List [Atom "Path"; Atom path] -> {args with path= Some path} + | _ -> args + in + let args = List.fold_left extract empty_args l in + return (`Format (x, args)) + | Some (List [Atom "Error"; Atom x]) -> return (`Error x) + | Some (Atom "Halt") -> return `Halt + | Some _ -> return `Unknown + + let to_sexp = + let open Csexp in + function + | `Format (x, {path; config}) -> + let map_config name config = + let c = + List.map + (fun (name, value) -> List [Atom name; Atom value]) + config + in + List [Atom name; List c] + in + let ofp = + Option.map (fun path -> List [Atom "Path"; Atom path]) path + and oconfig = Option.map (map_config "Config") config in + List + (List.filter_map + (fun i -> i) + [Some (Atom "Format"); Some (Atom x); ofp; oconfig] ) + | `Error x -> List [Atom "Error"; Atom x] + | `Halt -> Atom "Halt" + | _ -> assert false + + let output oc t = IO.write oc [to_sexp t] + end +end diff --git a/lib-rpc/protocol.mli b/lib-rpc/protocol.mli new file mode 100644 index 0000000000..7db30b222d --- /dev/null +++ b/lib-rpc/protocol.mli @@ -0,0 +1,59 @@ +(**************************************************************************) +(* *) +(* OCamlFormat *) +(* *) +(* Copyright (c) Facebook, Inc. and its affiliates. *) +(* *) +(* This source code is licensed under the MIT license found in *) +(* the LICENSE file in the root directory of this source tree. *) +(* *) +(**************************************************************************) + +type format_args = + { path: string option + (** Path used for the current formatting request, this allows + ocamlformat to determine which .ocamlformat files must be + applied. *) + ; config: (string * string) list option + (** Additional options used for the current formatting request. *) } + +val empty_args : format_args + +module Version : sig + type t = V1 | V2 + + val to_string : t -> string + + val of_string : string -> t option +end + +module Make (IO : IO.S) : sig + module type Command_S = sig + type t + + val read_input : IO.ic -> t IO.t + + val output : IO.oc -> t -> unit IO.t + end + + (** Version used to set the protocol version *) + module Init : + Command_S with type t = [`Halt | `Unknown | `Version of string] + + module V1 : + Command_S + with type t = + [ `Halt + | `Unknown + | `Error of string + | `Config of (string * string) list + | `Format of string ] + + module V2 : + Command_S + with type t = + [ `Halt + | `Unknown + | `Error of string + | `Format of string * format_args ] +end diff --git a/ocamlformat-rpc.opam b/ocamlformat-rpc.opam deleted file mode 100644 index f4cddec836..0000000000 --- a/ocamlformat-rpc.opam +++ /dev/null @@ -1,33 +0,0 @@ -# This file is generated by dune, edit dune-project instead -opam-version: "2.0" -synopsis: "Auto-formatter for OCaml code (RPC mode)" -description: - "OCamlFormat is a tool to automatically format OCaml code in a uniform style. This package defines a RPC interface to OCamlFormat" -maintainer: ["OCamlFormat Team "] -authors: ["Josh Berdine "] -homepage: "https://github.com/ocaml-ppx/ocamlformat" -bug-reports: "https://github.com/ocaml-ppx/ocamlformat/issues" -depends: [ - "dune" {>= "2.8"} - "ocaml" {>= "4.08" & < "4.15"} - "alcotest" {with-test} - "ocamlformat" {= version} - "ocamlformat-rpc-lib" {= version} - "odoc" {with-doc} -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/ocaml-ppx/ocamlformat.git" -license: ["MIT" "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"] # OCamlFormat is distributed under the MIT license. Parts of the OCaml library are vendored for OCamlFormat and distributed under their original LGPL 2.1 license diff --git a/ocamlformat-rpc.opam.template b/ocamlformat-rpc.opam.template deleted file mode 100644 index 950f2c6769..0000000000 --- a/ocamlformat-rpc.opam.template +++ /dev/null @@ -1 +0,0 @@ -license: ["MIT" "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"] # OCamlFormat is distributed under the MIT license. Parts of the OCaml library are vendored for OCamlFormat and distributed under their original LGPL 2.1 license diff --git a/ocamlformat.opam b/ocamlformat.opam index f8abecfcc7..2b8ad27317 100644 --- a/ocamlformat.opam +++ b/ocamlformat.opam @@ -28,6 +28,7 @@ depends: [ "stdio" {< "v0.15"} "uuseg" {>= "10.0.0"} "uutf" {>= "1.0.1"} + "csexp" {>= "1.4.0"} "odoc" {with-doc} ] build: [ diff --git a/test/rpc/dune b/test/rpc/dune index e037db462c..1f6d6a8733 100644 --- a/test/rpc/dune +++ b/test/rpc/dune @@ -6,7 +6,7 @@ small_margin/.ocamlformat big_margin/.ocamlformat) (modules rpc_test) - (package ocamlformat-rpc) + (package ocamlformat) (enabled_if (<> %{os_type} Win32)) (action @@ -16,6 +16,6 @@ (name rpc_test_fail) (libraries ocamlformat-rpc-lib unix) (modules rpc_test_fail) - (package ocamlformat-rpc) + (package ocamlformat) (action (run %{test} not-installed-ocamlformat-rpc)))