diff --git a/CHANGES.md b/CHANGES.md index 2c30fd348e2..65ee876bd55 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -28,6 +28,10 @@ unreleased - Allow %{...} variables in pps flags (#2076, @mlasson review by @diml and @aalekseyev). +- Add a 'cookies' option to ppx_rewriter/deriver flags in library stanzas + (#2106, @mlasson @diml). This allow to specify cookie requests from + variables expanded at each invocation of the preprocessor. + - Add more opam metadata and use it to generate `.opam` files. In particular, a `package` field has been added to specify package specific information. (#2017, #2091, @avsm, @jonludlam, @rgrinberg) diff --git a/doc/dune-files.rst b/doc/dune-files.rst index 06b6458292a..21ec92c9e8d 100644 --- a/doc/dune-files.rst +++ b/doc/dune-files.rst @@ -140,7 +140,12 @@ to use the :ref:`include_subdirs` stanza. available choices are ``ppx_rewriter`` and ``ppx_deriver`` and must be set when the library is intended to be used as a ppx rewriter or a ``[@@deriving ...]`` plugin. The reason why ``ppx_rewriter`` and ``ppx_deriver`` are split - is historical and hopefully we won't need two options soon + is historical and hopefully we won't need two options soon. Both ppx kinds + support an optional field ``(cookies )`` where ```` is a + list of pairs ``( )`` with ```` being the cookie name and + ```` is a string that supports `Variables expansion`_ evaluated + by each invocation of the preprocessor (note: libraries that share + cookies with the same name should agree on their expanded value) - ``(ppx_runtime_libraries ())`` is for when the library is a ppx rewriter or a ``[@@deriving ...]`` plugin and has runtime dependencies. You diff --git a/src/gen_meta.ml b/src/gen_meta.ml index a054203bc37..16b9b6c3037 100644 --- a/src/gen_meta.ml +++ b/src/gen_meta.ml @@ -75,7 +75,7 @@ let gen_lib pub_name lib ~version = let preds = match Lib.kind lib with | Normal -> [] - | Ppx_rewriter | Ppx_deriver -> [Pos "ppx_driver"] + | Ppx_rewriter _ | Ppx_deriver _ -> [Pos "ppx_driver"] in let lib_deps = Lib.Meta.requires lib in let ppx_rt_deps = Lib.Meta.ppx_runtime_deps lib in @@ -95,7 +95,7 @@ let gen_lib pub_name lib ~version = ] ; (match Lib.kind lib with | Normal -> [] - | Ppx_rewriter | Ppx_deriver -> + | Ppx_rewriter _ | Ppx_deriver _ -> (* Deprecated ppx method support *) let no_ppx_driver = Neg "ppx_driver" and no_custom_ppx = Neg "custom_ppx" in List.concat @@ -107,10 +107,10 @@ let gen_lib pub_name lib ~version = ] ; match Lib.kind lib with | Normal -> assert false - | Ppx_rewriter -> + | Ppx_rewriter _ -> [ rule "ppx" [no_ppx_driver; no_custom_ppx] Set "./ppx.exe --as-ppx" ] - | Ppx_deriver -> + | Ppx_deriver _ -> [ rule "requires" [no_ppx_driver; no_custom_ppx] Add "ppx_deriving" ; rule "ppxopt" [no_ppx_driver; no_custom_ppx] Set diff --git a/src/install_rules.ml b/src/install_rules.ml index ab479cc0160..a555d6825af 100644 --- a/src/install_rules.ml +++ b/src/install_rules.ml @@ -152,8 +152,8 @@ let init_meta sctx ~dir = let lib_ppxs sctx ~(lib : Dune_file.Library.t) ~scope ~dir_kind = match lib.kind with - | Normal | Ppx_deriver -> [] - | Ppx_rewriter -> + | Normal | Ppx_deriver _ -> [] + | Ppx_rewriter _ -> let name = Dune_file.Library.best_name lib in match (dir_kind : Dune_lang.File_syntax.t) with | Dune -> diff --git a/src/lib_kind.ml b/src/lib_kind.ml index 181769b9131..318dc89b4ed 100644 --- a/src/lib_kind.ml +++ b/src/lib_kind.ml @@ -1,19 +1,73 @@ +module Ppx_args = struct + module Cookie = struct + type t = + { name : string + ; value : String_with_vars.t + } + + let decode = + let open Stanza.Decoder in + let* () = Syntax.since Stanza.syntax (1, 10) in + enter + ( + let+ name = plain_string + (fun ~loc str -> + if String.contains str '=' then + Errors.fail loc "Character '=' is not allowed in cookie names" + else + str + ) + and+ value = String_with_vars.decode in + { name; value } + ) + + let encode { name; value } = + let open Dune_lang in + List + [ Encoder.string name + ; String_with_vars.encode value + ] + end + + type t = + { cookies : Cookie.t list + } + + let decode = + let open Stanza.Decoder in + let args = + let+ cookies = field "cookies" (list Cookie.decode) ~default:[] in + {cookies} + in + fields args + + let encode { cookies } = + let open Dune_lang.Encoder in + record_fields + [ field_l "cookies" Cookie.encode cookies ] +end + type t = | Normal - | Ppx_deriver - | Ppx_rewriter + | Ppx_deriver of Ppx_args.t + | Ppx_rewriter of Ppx_args.t let decode = let open Dune_lang.Decoder in - enum - [ "normal" , Normal - ; "ppx_deriver" , Ppx_deriver - ; "ppx_rewriter" , Ppx_rewriter + sum + [ "normal" , return Normal + ; "ppx_deriver" , (let+ args = Ppx_args.decode in Ppx_deriver args) + ; "ppx_rewriter" , (let+ args = Ppx_args.decode in Ppx_rewriter args) ] let encode t = - Dune_lang.Encoder.string ( + match match t with - | Normal -> "normal" - | Ppx_deriver -> "ppx_deriver" - | Ppx_rewriter -> "ppx_rewriter") + | Normal -> Dune_lang.atom "normal" + | Ppx_deriver x -> + List (Dune_lang.atom "ppx_deriver" :: Ppx_args.encode x) + | Ppx_rewriter x -> + List (Dune_lang.atom "ppx_rewriter" :: Ppx_args.encode x) + with + | List [x] -> x + | x -> x diff --git a/src/lib_kind.mli b/src/lib_kind.mli index 291b9da3775..2755c58fca6 100644 --- a/src/lib_kind.mli +++ b/src/lib_kind.mli @@ -1,6 +1,19 @@ +module Ppx_args : sig + module Cookie : sig + type t = + { name : string + ; value : String_with_vars.t + } + end + + type t = + { cookies : Cookie.t list + } +end + type t = | Normal - | Ppx_deriver - | Ppx_rewriter + | Ppx_deriver of Ppx_args.t + | Ppx_rewriter of Ppx_args.t include Dune_lang.Conv with type t := t diff --git a/src/lib_rules.ml b/src/lib_rules.ml index 7d360c24e1d..6328dd45998 100644 --- a/src/lib_rules.ml +++ b/src/lib_rules.ml @@ -77,7 +77,7 @@ module Gen (P : sig val sctx : Super_context.t end) = struct ; Dyn (fun (_, _, _, library_flags) -> As library_flags) ; As (match lib.kind with | Normal -> [] - | Ppx_deriver | Ppx_rewriter -> ["-linkall"]) + | Ppx_deriver _ | Ppx_rewriter _ -> ["-linkall"]) ; Dyn (fun (cm_files, _, _, _) -> Deps cm_files) ; Hidden_targets (match mode with diff --git a/src/merlin.ml b/src/merlin.ml index 42d7aecd4c9..cd632fa1b70 100644 --- a/src/merlin.ml +++ b/src/merlin.ml @@ -126,15 +126,12 @@ let pp_flags sctx ~expander ~dir_kind { preprocess; libname; _ } = match Dune_file.Preprocess.remove_future_syntax preprocess (Super_context.context sctx).version with - | Pps { loc = _; pps; flags; staged = _ } -> begin - match Preprocessing.get_ppx_driver sctx ~scope ~dir_kind pps with + | Pps { loc; pps; flags; staged = _ } -> begin + match Preprocessing.get_ppx_driver sctx ~loc ~expander ~lib_name:libname ~flags ~scope ~dir_kind pps with | Error _ -> None - | Ok exe -> - let flags = List.map ~f:(Expander.expand_str expander) flags in + | Ok (exe, flags) -> (Path.to_absolute_filename exe - :: "--as-ppx" - :: Preprocessing.cookie_library_name libname - @ flags) + :: "--as-ppx" :: flags) |> List.map ~f:quote_for_merlin |> String.concat ~sep:" " |> Filename.quote diff --git a/src/preprocessing.ml b/src/preprocessing.ml index 21071ebd903..a03633dd25f 100644 --- a/src/preprocessing.ml +++ b/src/preprocessing.ml @@ -477,9 +477,71 @@ let get_compat_ppx_exe sctx ~name ~kind = in ppx_exe sctx ~key ~dir_kind:Jbuild -let get_ppx_driver sctx ~loc ~scope ~dir_kind pps = +let get_cookies ~loc ~expander ~lib_name libs = + let expander, library_name_cookie = + match lib_name with + | None -> expander, None + | Some lib_name -> + let library_name = Lib_name.Local.to_string lib_name in + let bindings = + Pform.Map.singleton "library_name" + (Values [String library_name]) + in + Expander.add_bindings expander ~bindings, + Some ("library-name", (library_name, Lib_name.of_local (loc, lib_name))) + in + try + Ok (libs + |> List.concat_map ~f: + (fun t -> + match Lib.kind t with + | Normal -> [] + | Ppx_rewriter {cookies} + | Ppx_deriver {cookies} -> + List.map ~f:(fun {Lib_kind.Ppx_args.Cookie.name; value} -> + (name, (Expander.expand_str expander value, Lib.name t))) + cookies + ) + |> (fun l -> + match library_name_cookie with + | None -> l + | Some cookie -> cookie :: l + ) + |> String.Map.of_list_reducei ~f: + (fun name ((val1, lib1) as res) (val2, lib2) -> + if String.equal val1 val2 then + res + else + let lib1 = Lib_name.to_string lib1 in + let lib2 = Lib_name.to_string lib2 in + Errors.fail loc "%a" Fmt.text + (sprintf "%s and %s have inconsistent requests for cookie %S; \ + %s requests %S and %s requests %S" + lib1 lib2 name + lib1 val1 + lib2 val2) + ) + |> String.Map.foldi ~init:[] + ~f:(fun name (value, _) acc -> (name, value) :: acc) + |> List.rev + |> List.concat_map ~f: + (fun (name, value) -> + ["--cookie"; sprintf "%s=%S" name value] + ) + ) + with exn -> Error exn + +let ppx_driver_and_flags_internal sctx ~loc ~expander ~lib_name ~flags ~dir_kind libs = + let open Result.O in + let flags = List.map ~f:(Expander.expand_str expander) flags in + let+ cookies = get_cookies ~loc ~lib_name ~expander libs in + let sctx = SC.host sctx in + ppx_driver_exe sctx libs ~dir_kind, flags @ cookies + +let ppx_driver_and_flags sctx ~lib_name ~expander ~scope ~loc ~dir_kind ~flags pps = let open Result.O in let* libs = Lib.DB.resolve_pps (Scope.libs scope) pps in + let* exe, flags = ppx_driver_and_flags_internal sctx ~loc ~expander ~lib_name ~flags ~dir_kind libs in let+ driver = match (dir_kind : Dune_lang.File_syntax.t) with | Dune -> @@ -489,15 +551,11 @@ let get_ppx_driver sctx ~loc ~scope ~dir_kind pps = | Jbuild -> Ok (Jbuild_driver.get_driver pps) in - (ppx_driver_exe (SC.host sctx) libs ~dir_kind, driver) + (exe, driver, flags) + let workspace_root_var = String_with_vars.virt_var __POS__ "workspace_root" -let cookie_library_name lib_name = - match lib_name with - | None -> [] - | Some name -> - ["--cookie"; sprintf "library-name=%S" (Lib_name.Local.to_string name)] (* Generate rules for the reason modules in [modules] and return a a new module with only OCaml sources *) @@ -584,26 +642,24 @@ let lint_module sctx ~dir ~expander ~dep_kind ~lint ~lib_name ~scope ~dir_kind = if staged then Errors.fail loc "Staged ppx rewriters cannot be used as linters."; - let flags = List.map ~f:(Expander.expand_str expander) flags in - let args : _ Arg_spec.t = - S [ As flags - ; As (cookie_library_name lib_name) - ] - in let corrected_suffix = ".lint-corrected" in let driver_and_flags = let open Result.O in - let+ (exe, driver) = - get_ppx_driver sctx ~loc ~scope ~dir_kind pps in - (exe, - let bindings = - Pform.Map.singleton "corrected-suffix" - (Values [String corrected_suffix]) - in - let expander = Expander.add_bindings expander ~bindings in - Build.memoize "ppx flags" - (Expander.expand_and_eval_set expander driver.info.lint_flags - ~standard:(Build.return []))) + let+ (exe, driver, driver_flags) = + ppx_driver_and_flags sctx ~expander ~loc ~lib_name ~flags ~dir_kind ~scope pps + in + let flags = + let bindings = + Pform.Map.singleton "corrected-suffix" + (Values [String corrected_suffix]) + in + let expander = Expander.add_bindings expander ~bindings in + Build.memoize "ppx flags" + (Expander.expand_and_eval_set expander driver.info.lint_flags + ~standard:(Build.return [])) + in + let args : _ Arg_spec.t = S [ As driver_flags ] in + (exe, flags, args) in (fun ~source ~ast -> Module.iter ast ~f:(fun kind src -> @@ -611,15 +667,16 @@ let lint_module sctx ~dir ~expander ~dep_kind ~lint ~lib_name ~scope ~dir_kind = ~loc:None (promote_correction ~suffix:corrected_suffix (Option.value_exn (Module.file source kind)) - (Build.of_result_map driver_and_flags ~f:(fun (exe, flags) -> - flags >>> - Build.run ~dir:(SC.context sctx).build_dir - (Ok exe) - [ args - ; Ml_kind.ppx_driver_flag kind - ; Dep src.path - ; Dyn (fun x -> As x) - ])))))) + (Build.of_result_map driver_and_flags + ~f:(fun (exe, flags, args) -> + flags >>> + Build.run ~dir:(SC.context sctx).build_dir + (Ok exe) + [ args + ; Ml_kind.ppx_driver_flag kind + ; Dep src.path + ; Dyn (fun x -> As x) + ])))))) in fun ~(source : Module.t) ~ast -> Per_module.get lint (Module.name source) ~source ~ast) @@ -660,26 +717,21 @@ let make sctx ~dir ~expander ~dep_kind ~lint ~preprocess if lint then lint_module ~ast ~source:m; ast) | Pps { loc; pps; flags; staged } -> - let flags = List.map ~f:(Expander.expand_str expander) flags in if not staged then begin - let args : _ Arg_spec.t = - S [ As flags - ; As (cookie_library_name lib_name) - ] - in let corrected_suffix = ".ppx-corrected" in let driver_and_flags = let open Result.O in - let+ (exe, driver) = get_ppx_driver sctx ~loc ~scope ~dir_kind pps in + let+ (exe, driver, flags) = ppx_driver_and_flags sctx ~expander ~loc ~lib_name ~flags ~dir_kind ~scope pps in + let args : _ Arg_spec.t = S [ As flags ] in (exe, - let bindings = + (let bindings = Pform.Map.singleton "corrected-suffix" (Values [String corrected_suffix]) in let expander = Expander.add_bindings expander ~bindings in Build.memoize "ppx flags" (Expander.expand_and_eval_set expander driver.info.flags - ~standard:(Build.return ["--as-ppx"]))) + ~standard:(Build.return ["--as-ppx"]))), args) in (fun m ~lint -> let ast = setup_reason_rules sctx m in @@ -692,7 +744,7 @@ let make sctx ~dir ~expander ~dep_kind ~lint ~preprocess >>> Build.of_result_map driver_and_flags ~targets:[dst] - ~f:(fun (exe, flags) -> + ~f:(fun (exe, flags, args) -> flags >>> Build.run ~dir:(SC.context sctx).build_dir @@ -705,8 +757,9 @@ let make sctx ~dir ~expander ~dep_kind ~lint ~preprocess end else begin let pp_flags = Build.of_result ( let open Result.O in - let+ (exe, driver) = - get_ppx_driver sctx ~loc ~scope ~dir_kind pps in + let+ (exe, driver, flags) = + ppx_driver_and_flags sctx ~expander ~loc ~scope ~dir_kind ~flags ~lib_name pps + in Build.memoize "ppx command" (Build.path exe >>> @@ -721,7 +774,6 @@ let make sctx ~dir ~expander ~dep_kind ~lint ~preprocess [ [Path.reach exe ~from:(SC.context sctx).build_dir] ; driver_flags ; flags - ; cookie_library_name lib_name ]) ~f:quote_for_shell |> String.concat ~sep:" " @@ -742,8 +794,7 @@ let pp_modules t ?(lint=true) modules = let pp_module_as t ?(lint=true) name m = Per_module.get t name m ~lint -let get_ppx_driver sctx ~scope ~dir_kind pps = +let get_ppx_driver sctx ~loc ~expander ~scope ~lib_name ~flags ~dir_kind pps = let open Result.O in - let+ libs = Lib.DB.resolve_pps (Scope.libs scope) pps in - let sctx = SC.host sctx in - ppx_driver_exe sctx libs ~dir_kind + let* libs = Lib.DB.resolve_pps (Scope.libs scope) pps in + ppx_driver_and_flags_internal sctx ~loc ~expander ~lib_name ~flags ~dir_kind libs diff --git a/src/preprocessing.mli b/src/preprocessing.mli index c42ac3ceec1..2bcf754e149 100644 --- a/src/preprocessing.mli +++ b/src/preprocessing.mli @@ -38,13 +38,17 @@ val pp_module_as -> Module.t -> Module.t -(** Get a path to a cached ppx driver *) +(** Get a path to a cached ppx driver with some extra flags for cookies. *) val get_ppx_driver : Super_context.t + -> loc:Loc.t + -> expander:Expander.t -> scope:Scope.t + -> lib_name:Lib_name.Local.t option + -> flags:String_with_vars.t list -> dir_kind:Dune_lang.File_syntax.t -> (Loc.t * Lib_name.t) list - -> Path.t Or_exn.t + -> (Path.t * string list) Or_exn.t module Compat_ppx_exe_kind : sig (** [Dune] for directories using a [dune] file, and [Jbuild driver] @@ -61,8 +65,4 @@ val get_compat_ppx_exe -> kind:Compat_ppx_exe_kind.t -> Path.t -(** [cookie_library_name lib_name] is ["--cookie"; lib_name] if [lib_name] is not - [None] *) -val cookie_library_name : Lib_name.Local.t option -> string list - val gen_rules : Super_context.t -> string list -> unit diff --git a/src/stdune/map.ml b/src/stdune/map.ml index cb1d76a02b0..8b5c72a63df 100644 --- a/src/stdune/map.ml +++ b/src/stdune/map.ml @@ -128,6 +128,12 @@ module Make(Key : Comparable.S) : S with type key = Key.t = struct List.fold_left l ~init:empty ~f:(fun acc (key, data) -> let x = Option.value (find acc key) ~default:init in add acc key (f x data)) + + let of_list_reducei l ~f = + List.fold_left l ~init:empty ~f:(fun acc (key, data) -> + match find acc key with + | None -> add acc key data + | Some x -> add acc key (f key x data)) let of_list_multi l = List.fold_left (List.rev l) ~init:empty ~f:(fun acc (key, data) -> diff --git a/src/stdune/map_intf.ml b/src/stdune/map_intf.ml index 156124f2ccd..a410b50f555 100644 --- a/src/stdune/map_intf.ml +++ b/src/stdune/map_intf.ml @@ -66,6 +66,7 @@ module type S = sig val of_list_multi : (key * 'a) list -> 'a list t val of_list_reduce : (key * 'a) list -> f:('a -> 'a -> 'a) -> 'a t + val of_list_reducei : (key * 'a) list -> f:(key -> 'a -> 'a -> 'a) -> 'a t (** Return a map of [(k, v)] bindings such that: diff --git a/test/blackbox-tests/test-cases/dune-ppx-driver-system/driver-tests/dune b/test/blackbox-tests/test-cases/dune-ppx-driver-system/driver-tests/dune index 018ee4a39a9..53a8886cbb7 100644 --- a/test/blackbox-tests/test-cases/dune-ppx-driver-system/driver-tests/dune +++ b/test/blackbox-tests/test-cases/dune-ppx-driver-system/driver-tests/dune @@ -19,9 +19,17 @@ (modules foo3) (preprocess (pps ppx_other))) +; Incompatible cookies +(library + (name foo4) + (public_name foo.4) + (modules foo4) + (preprocess (pps ppx3 ppx4))) + (rule (with-stdout-to foo1.ml (echo ""))) (rule (with-stdout-to foo2.ml (echo ""))) (rule (with-stdout-to foo3.ml (echo ""))) +(rule (with-stdout-to foo4.ml (echo ""))) (library (name ppx1) @@ -37,6 +45,20 @@ (modules ()) (libraries driver2)) +(library + (name ppx3) + (public_name foo.ppx3) + (kind (ppx_rewriter (cookies (germany "spritzgeback")))) + (modules ()) + (libraries driver2)) + +(library + (name ppx4) + (public_name foo.ppx4) + (kind (ppx_rewriter (cookies (germany "lebkuchen") (library-name "%{library_name}")))) + (modules ()) + (libraries driver2)) + (library (name driver1) (public_name foo.driver1) @@ -62,10 +84,22 @@ (rule (with-stdout-to test_ppx_args.ml (echo ""))) +(library + (name ppx_with_cookies_print_args) + (kind (ppx_rewriter + (cookies (italy "%{env:ITALY=undefined}") + (france "%{env:FRANCE=undefined}")))) + (modules ()) + (libraries driver_print_args)) + +(env (_ (env-vars (ITALY "Biscotti") (FRANCE "Petit Beurre") (AMERICA "Oreo") (ENGLAND "Snickerdoodle")))) + (library (name test_ppx_args) (modules test_ppx_args) - (preprocess (pps -arg1 driver_print_args -arg2 -- -foo bar))) + (preprocess + (pps -arg1 driver_print_args ppx_with_cookies_print_args -arg2 -arg3=%{env:AMERICA=undefined} -- + -foo bar %{env:ENGLAND=undefined}))) (library (name driver_print_tool) @@ -80,13 +114,19 @@ "\| Ast_mapper.default_mapper)) ))) -(rule (with-stdout-to test_ppx_staged.ml (echo ""))) +(library + (name ppx_with_cookies_print_tool) + (kind (ppx_rewriter + (cookies (italy "%{env:ITALY=undefined}") + (france "%{env:FRANCE=undefined}")))) + (modules ()) + (libraries driver_print_tool)) -(env (_ (env-vars (FOO baz)))) +(rule (with-stdout-to test_ppx_staged.ml (echo ""))) (library (name test_ppx_staged) (modules test_ppx_staged) - (preprocess - (staged_pps -arg1 driver_print_tool -arg2 -arg3=%{env:FOO=undefined} -- - -foo bar %{env:FOO=undefined}))) + (preprocess + (staged_pps -arg1 driver_print_tool ppx_with_cookies_print_tool -arg2 -arg3=%{env:AMERICA=undefined} -- + -foo bar %{env:ENGLAND=undefined}))) diff --git a/test/blackbox-tests/test-cases/dune-ppx-driver-system/run.t b/test/blackbox-tests/test-cases/dune-ppx-driver-system/run.t index 8ed58b5d08b..587bd0cc27c 100644 --- a/test/blackbox-tests/test-cases/dune-ppx-driver-system/run.t +++ b/test/blackbox-tests/test-cases/dune-ppx-driver-system/run.t @@ -31,6 +31,18 @@ Not compatible with Dune using ocaml-migrate-parsetree, ppxlib or ppx_driver. [1] +Incompatible Cookies + + $ dune build --root driver-tests foo4.cma + Entering directory 'driver-tests' + File "dune", line 27, characters 13-28: + 27 | (preprocess (pps ppx3 ppx4))) + ^^^^^^^^^^^^^^^ + Error: foo.ppx3 and foo.ppx4 have inconsistent requests for cookie "germany"; + foo.ppx3 requests "spritzgeback" and foo.ppx4 requests + "lebkuchen" + [1] + Same, but with error pointing to .ppx $ dune build --root driver-tests .ppx/foo.ppx1+foo.ppx2/ppx.exe @@ -54,11 +66,17 @@ Test the argument syntax $ dune build --root driver-tests test_ppx_args.cma Entering directory 'driver-tests' ppx test_ppx_args.pp.ml - .ppx/eb9468425030036114a3b9ffa4c89e4d/ppx.exe + .ppx/fb8f5a35329c41c0aef8d783a2c365db/ppx.exe -arg1 -arg2 + -arg3=Oreo -foo bar + Snickerdoodle + --cookie + france="Petit Beurre" + --cookie + italy="Biscotti" --cookie library-name="test_ppx_args" -o @@ -66,9 +84,9 @@ Test the argument syntax --impl test_ppx_args.ml --as-ppx - File "dune", line 68, characters 13-60: - 68 | (preprocess (pps -arg1 driver_print_args -arg2 -- -foo bar))) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "dune", line 101, characters 3-138: + 101 | (pps -arg1 driver_print_args ppx_with_cookies_print_args -arg2 -arg3=%{env:AMERICA=undefined} -- + 102 | -foo bar %{env:ENGLAND=undefined}))) Error: rule failed to generate the following targets: - test_ppx_args.pp.ml [1] @@ -79,10 +97,10 @@ Test that going throught the -ppx option of the compiler works Entering directory 'driver-tests' ocamldep .test_ppx_staged.objs/test_ppx_staged.ml.d tool name: ocamldep - args:--as-ppx -arg1 -arg2 -arg3=baz -foo bar baz --cookie library-name="test_ppx_staged" + args:--as-ppx -arg1 -arg2 -arg3=Oreo -foo bar Snickerdoodle --cookie france="Petit Beurre" --cookie italy="Biscotti" --cookie library-name="test_ppx_staged" ocamlc .test_ppx_staged.objs/byte/test_ppx_staged.{cmi,cmo,cmt} tool name: ocamlc - args:--as-ppx -arg1 -arg2 -arg3=baz -foo bar baz --cookie library-name="test_ppx_staged" + args:--as-ppx -arg1 -arg2 -arg3=Oreo -foo bar Snickerdoodle --cookie france="Petit Beurre" --cookie italy="Biscotti" --cookie library-name="test_ppx_staged" Test using installed drivers