This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,2 @@
(lang dune 2.8)
(allow_approximate_merlin)

View file

@ -0,0 +1,11 @@
The vendored project does not trigger a third warning
When the root project is on dune lang <= 2.7 it does not raise a warning
However the non-vendored sub-dir on dune lang >= 2.8 does raise a warning
$ printf "(lang dune 2.7)\n (allow_approximate_merlin)" > dune-project
$ dune build @check
File "notvendor/dune-project", line 2, characters 0-26:
2 | (allow_approximate_merlin)
^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning: This field was deprecated in version 2.8 of the dune language. It is
useless since the Merlin configurations are not ambiguous anymore.

View file

@ -0,0 +1,2 @@
(lang dune 2.8)
(allow_approximate_merlin)

View file

@ -0,0 +1,83 @@
Showcase behavior when passing the `--context` flag to ocaml-merlin
$ cat >dune-project <<EOF
> (lang dune 3.14)
> EOF
$ cat > dune-workspace << EOF
> (lang dune 3.14)
>
> (context default)
>
> (context
> (default
> (name alt)))
> EOF
$ lib1=foo
$ lib2=bar
$ cat >dune <<EOF
> (library
> (name $lib1)
> (modules $lib1)
> (enabled_if (= %{context_name} "default")))
> (library
> (name $lib2)
> (modules $lib2)
> (enabled_if (= %{context_name} "alt")))
> EOF
$ touch $lib1.ml $lib2.ml
$ dune build
$ FILE1=$PWD/$lib1.ml
$ FILE2=$PWD/$lib2.ml
If `generate_merlin_rules` is not used, we can't query anything in alt context
because by default Merlin rules are only created for the default context
$ printf '(4:File%d:%s)' ${#FILE2} $FILE2 | dune ocaml-merlin | grep -i "$lib2"
((5:ERROR58:No config found for file bar.ml. Try calling 'dune build'.))
$ printf '(4:File%d:%s)' ${#FILE2} $FILE2 | dune ocaml-merlin --context alt | grep -i "$lib2"
((5:ERROR58:No config found for file bar.ml. Try calling 'dune build'.))
Let's use `generate_merlin_rules` to test these commands
$ cat > dune-workspace << EOF
> (lang dune 3.16)
>
> (context default)
>
> (context
> (default
> (name alt)
> (generate_merlin_rules)))
> EOF
$ dune build
Request config for file in alt context without using --context
$ printf '(4:File%d:%s)' ${#FILE2} $FILE2 | dune ocaml-merlin | grep -i "$lib2" | sed 's/^[^:]*:[^:]*://'
No config found for file bar.ml. Try calling 'dune build'.))
Request config for file in alt context using --context
$ printf '(4:File%d:%s)' ${#FILE2} $FILE2 | dune ocaml-merlin --context alt | dune format-dune-file | grep -i "$lib2" | sed 's/^[^:]*:[^:]*://'
$TESTCASE_ROOT/_build/alt/.bar.objs/cctx.ocaml-index)
$TESTCASE_ROOT/_build/alt/.bar.objs/byte)
bar))
Request config for default context without using --context
$ printf '(4:File%d:%s)' ${#FILE1} $FILE1 | dune ocaml-merlin | dune format-dune-file | grep -i "$lib1" | sed 's/^[^:]*:[^:]*://'
$TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
$TESTCASE_ROOT/_build/default/.foo.objs/byte)
foo))
Request config for default context using --context
$ printf '(4:File%d:%s)' ${#FILE1} $FILE1 | dune ocaml-merlin --context alt | dune format-dune-file | grep -i "$lib1" | sed 's/^[^:]*:[^:]*://'
No config found for file foo.ml. Try calling 'dune build'.))

View file

@ -0,0 +1,2 @@
(library
(name foo))

View file

@ -0,0 +1,2 @@
let bar = 42
let r = Result.Ok "3"

View file

@ -0,0 +1,85 @@
$ export BUILD_PATH_PREFIX_MAP=\
> "OPAM_PREFIX=$(ocamlc -where):$BUILD_PATH_PREFIX_MAP"
If Merlin field is absent, default context is chosen
$ cat >dune-workspace <<EOF
> (lang dune 2.9)
> (context (default))
> (context
> (default
> (name cross)))
> EOF
$ dune build
$ [ ! -d _build/cross/.merlin-conf ] && echo "No config in cross"
No config in cross
$ ls -a _build/default/.merlin-conf
.
..
lib-foo
$ dune ocaml merlin dump-config "$PWD"
Foo: _build/default/foo
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB OPAM_PREFIX) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g)) (UNIT_NAME foo))
Foo: _build/default/foo.ml
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB OPAM_PREFIX) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g)) (UNIT_NAME foo))
If Merlin field is present, this context is chosen
$ cat >dune-workspace <<EOF
> (lang dune 2.8)
> (context (default))
> (context
> (default
> (name cross)
> (merlin)))
> EOF
$ dune build
$ ls -a _build/cross/.merlin-conf
.
..
lib-foo
$ [ ! -d _build/default/.merlin-conf ] && echo "No config in default"
No config in default
$ dune ocaml merlin dump-config "$PWD"
Foo: _build/cross/foo
((INDEX $TESTCASE_ROOT/_build/cross/.foo.objs/cctx.ocaml-index) (STDLIB OPAM_PREFIX) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/cross/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g)) (UNIT_NAME foo))
Foo: _build/cross/foo.ml
((INDEX $TESTCASE_ROOT/_build/cross/.foo.objs/cctx.ocaml-index) (STDLIB OPAM_PREFIX) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/cross/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g)) (UNIT_NAME foo))
If `generate_merlin_rules` field is present, rules are generated even if merlin
is disabled in that context
$ cat >dune-workspace <<EOF
> (lang dune 3.16)
> (context (default))
> (context
> (default
> (name cross)
> (generate_merlin_rules)))
> EOF
$ dune build
$ ls -a _build/cross/.merlin-conf
.
..
lib-foo
$ ls -a _build/default/.merlin-conf
.
..
lib-foo
$ dune ocaml merlin dump-config "$PWD"
Foo: _build/default/foo
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB OPAM_PREFIX) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g)) (UNIT_NAME foo))
Foo: _build/default/foo.ml
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB OPAM_PREFIX) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g)) (UNIT_NAME foo))

View file

@ -0,0 +1,10 @@
(lang dune 3.16)
(using melange 0.1)
(dialect
(name mlx)
(implementation
(extension mlx)
(preprocess (run cat %{input-file}))
(merlin_reader mlx)))

View file

@ -0,0 +1,2 @@
(executable
(name x))

View file

@ -0,0 +1,2 @@
(library
(name x))

View file

@ -0,0 +1,3 @@
(library
(modes melange)
(name x_mel))

View file

@ -0,0 +1,119 @@
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
$ ocamlfind_libs="$(ocamlfind printconf path | while read line; do printf lib=${line}:; done)"
$ export BUILD_PATH_PREFIX_MAP="$ocamlfind_libs:$BUILD_PATH_PREFIX_MAP"
$ melc_compiler="$(which melc)"
$ export BUILD_PATH_PREFIX_MAP="/MELC_COMPILER=$melc_compiler:$BUILD_PATH_PREFIX_MAP"
CRAM sanitization
$ dune build ./exe/.merlin-conf/exe-x --profile release
$ dune ocaml merlin dump-config $PWD/exe
X: _build/default/exe/x
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.x.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/melange/.x_mel.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/exe/.x.eobjs/byte)
(S $TESTCASE_ROOT/exe)
(FLG (-w -40 -g))
(UNIT_NAME dune__exe__X)
(SUFFIX ".mlx .mlx"))
X: _build/default/exe/x.mlx
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.x.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/melange/.x_mel.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/exe/.x.eobjs/byte)
(S $TESTCASE_ROOT/exe)
(FLG (-w -40 -g))
(UNIT_NAME dune__exe__X)
(SUFFIX ".mlx .mlx")
(READER (mlx)))
X: _build/default/exe/x.mlx.mli
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.x.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/melange/.x_mel.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/exe/.x.eobjs/byte)
(S $TESTCASE_ROOT/exe)
(FLG (-w -40 -g))
(UNIT_NAME dune__exe__X)
(SUFFIX ".mlx .mlx"))
CRAM sanitization
$ dune build ./lib/.merlin-conf/lib-x --profile release
$ dune ocaml merlin dump-config $PWD/lib
X: _build/default/lib/x
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.x.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/melange/.x_mel.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.x.objs/byte)
(S $TESTCASE_ROOT/lib)
(FLG (-w -40 -g))
(UNIT_NAME x)
(SUFFIX ".mlx .mlx")
(READER (mlx)))
X: _build/default/lib/x.mlx
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.x.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/melange/.x_mel.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.x.objs/byte)
(S $TESTCASE_ROOT/lib)
(FLG (-w -40 -g))
(UNIT_NAME x)
(SUFFIX ".mlx .mlx")
(READER (mlx)))
CRAM sanitization
$ dune build ./melange/.merlin-conf/lib-x_mel --profile release
$ dune ocaml merlin dump-config $PWD/melange
X_mel: _build/default/melange/x_mel
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.x.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/melange/.x_mel.objs/cctx.ocaml-index)
(STDLIB lib/melange/melange)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B lib/melange/__private__/melange_mini_stdlib/melange/.public_cmi_melange)
(B lib/melange/js/melange)
(B lib/melange/melange)
(B $TESTCASE_ROOT/_build/default/melange/.x_mel.objs/melange)
(S lib/melange)
(S lib/melange/__private__/melange_mini_stdlib)
(S lib/melange/js)
(S $TESTCASE_ROOT/melange)
(FLG (-w -40 -g))
(UNIT_NAME x_mel)
(SUFFIX ".mlx .mlx")
(READER (mlx)))
X_mel: _build/default/melange/x_mel.mlx
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.x.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/melange/.x_mel.objs/cctx.ocaml-index)
(STDLIB lib/melange/melange)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B lib/melange/__private__/melange_mini_stdlib/melange/.public_cmi_melange)
(B lib/melange/js/melange)
(B lib/melange/melange)
(B $TESTCASE_ROOT/_build/default/melange/.x_mel.objs/melange)
(S lib/melange)
(S lib/melange/__private__/melange_mini_stdlib)
(S lib/melange/js)
(S $TESTCASE_ROOT/melange)
(FLG (-w -40 -g))
(UNIT_NAME x_mel)
(SUFFIX ".mlx .mlx")
(READER (mlx)))

View file

@ -0,0 +1,2 @@
(executable
(name pp))

View file

@ -0,0 +1,25 @@
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
$ dune build
$ dune ocaml dump-dot-merlin src\ with\ spaces
EXCLUDE_QUERY_DIR
STDLIB /OCAMLC_WHERE
SOURCE_ROOT $TESTCASE_ROOT
B $TESTCASE_ROOT/_build/default/src with spaces/.foo.eobjs/byte
S $TESTCASE_ROOT/src with spaces
INDEX $TESTCASE_ROOT/_build/default/p p/.pp.eobjs/cctx.ocaml-index
INDEX $TESTCASE_ROOT/_build/default/src with spaces/.foo.eobjs/cctx.ocaml-index
# FLG -pp ''\''$TESTCASE_ROOT/_build/default/p p/pp.exe'\'''
# FLG -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g
$ dune ocaml dump-dot-merlin "p p"
EXCLUDE_QUERY_DIR
STDLIB /OCAMLC_WHERE
SOURCE_ROOT $TESTCASE_ROOT
B $TESTCASE_ROOT/_build/default/p p/.pp.eobjs/byte
S $TESTCASE_ROOT/p p
INDEX $TESTCASE_ROOT/_build/default/p p/.pp.eobjs/cctx.ocaml-index
INDEX $TESTCASE_ROOT/_build/default/src with spaces/.foo.eobjs/cctx.ocaml-index
# FLG -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g

View file

@ -0,0 +1,3 @@
(executables (names foo bar)
(preprocess (per_module
((action (run "p p/pp.exe"%{input-file})) bar))))

View file

@ -0,0 +1,30 @@
(cram
(applies_to :whole_subtree)
(alias all-merlin-tests))
(cram
(applies_to merlin-tests instrumentation)
(deps %{bin:ocamlfind}))
(cram
(enabled_if
(not %{env:INSIDE_NIX=false}))
(applies_to github4125)
(deps %{bin:opam}))
(cram
(applies_to implicit-transitive-deps)
(enabled_if
(< %{ocaml_version} 5.2)))
(cram
(applies_to implicit-transitive-deps-5.2)
(enabled_if
(>= %{ocaml_version} 5.2)))
(cram
(applies_to dialect)
(enabled_if
(not %{env:INSIDE_NIX=false}))
(deps %{bin:melc})
(alias runtest-melange))

View file

@ -0,0 +1,25 @@
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
$ ocamlfind_libs="$(ocamlfind printconf path | while read line; do printf lib=${line}:; done)"
$ export BUILD_PATH_PREFIX_MAP="$ocamlfind_libs:$BUILD_PATH_PREFIX_MAP"
$ cat >dune-project <<EOF
> (lang dune 3.11)
> EOF
$ cat >dune <<EOF
> (executable
> (name pp_future_syntax)
> (preprocess future_syntax))
> EOF
$ touch pp_future_syntax.ml
$ dune build ./.merlin-conf/exe-pp_future_syntax --profile release
$ dune ocaml merlin dump-config .
Pp_future_syntax: _build/default/pp_future_syntax
((INDEX $TESTCASE_ROOT/_build/default/.pp_future_syntax.eobjs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.pp_future_syntax.eobjs/byte) (S $TESTCASE_ROOT) (FLG (-w -40 -g)) (UNIT_NAME dune__exe__Pp_future_syntax))
Pp_future_syntax: _build/default/pp_future_syntax.ml
((INDEX $TESTCASE_ROOT/_build/default/.pp_future_syntax.eobjs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.pp_future_syntax.eobjs/byte) (S $TESTCASE_ROOT) (FLG (-w -40 -g)) (UNIT_NAME dune__exe__Pp_future_syntax))
Pp_future_syntax: _build/default/pp_future_syntax.mli
((INDEX $TESTCASE_ROOT/_build/default/.pp_future_syntax.eobjs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.pp_future_syntax.eobjs/byte) (S $TESTCASE_ROOT) (FLG (-w -40 -g)) (UNIT_NAME dune__exe__Pp_future_syntax))

View file

@ -0,0 +1,13 @@
(library
(name usesppx1)
(modules ())
(preprocess (pps ppx1)))
(library
(name usesppx2)
(modules ())
(preprocess (pps ppx2)))
(alias
(name default)
(action (echo %{read:.merlin-conf})))

View file

@ -0,0 +1,3 @@
(library
(name ppx1)
(kind ppx_rewriter))

View file

@ -0,0 +1,3 @@
(library
(name ppx2)
(kind ppx_rewriter))

View file

@ -0,0 +1,60 @@
This test demonstrates that -ppx is no more missing when two stanzas are
in the same dune file, but require different ppx specifications
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
$ dune build @all --profile release
$ dune ocaml merlin dump-config $PWD
Usesppx1: _build/default/usesppx1
((INDEX $TESTCASE_ROOT/_build/default/.usesppx2.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/.usesppx1.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx1/.ppx1.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx2/.ppx2.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.usesppx1.objs/byte)
(S $TESTCASE_ROOT)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/e5a600482cb65dfcb14104c728a9df4a/ppx.exe --as-ppx --cookie 'library-name="usesppx1"'"))
(UNIT_NAME usesppx1))
Usesppx1: _build/default/usesppx1.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/.usesppx2.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/.usesppx1.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx1/.ppx1.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx2/.ppx2.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.usesppx1.objs/byte)
(S $TESTCASE_ROOT)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/e5a600482cb65dfcb14104c728a9df4a/ppx.exe --as-ppx --cookie 'library-name="usesppx1"'"))
(UNIT_NAME usesppx1))
Usesppx2: _build/default/usesppx2
((INDEX $TESTCASE_ROOT/_build/default/.usesppx2.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/.usesppx1.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx1/.ppx1.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx2/.ppx2.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.usesppx2.objs/byte)
(S $TESTCASE_ROOT)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/f455412d08561f269148a48a55f3aef7/ppx.exe --as-ppx --cookie 'library-name="usesppx2"'"))
(UNIT_NAME usesppx2))
Usesppx2: _build/default/usesppx2.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/.usesppx2.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/.usesppx1.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx1/.ppx1.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx2/.ppx2.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.usesppx2.objs/byte)
(S $TESTCASE_ROOT)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/f455412d08561f269148a48a55f3aef7/ppx.exe --as-ppx --cookie 'library-name="usesppx2"'"))
(UNIT_NAME usesppx2))

View file

@ -0,0 +1,2 @@
(library
(name foo))

View file

@ -0,0 +1,28 @@
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
$ unset OPAMCONFIRMLEVEL
We call `$(opam switch show)` so that this test always uses an existing switch
$ cat >dune-workspace <<EOF
> (lang dune 2.0)
> (context (default))
> (context
> (opam
> (name cross)
> (switch $(opam switch show))
> (merlin)))
> EOF
$ dune build
$ ls -a _build/cross/.merlin-conf
.
..
lib-foo
$ dune ocaml merlin dump-config "$PWD"
Foo: _build/cross/foo
((INDEX $TESTCASE_ROOT/_build/cross/.foo.objs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/cross/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g)) (UNIT_NAME foo))
Foo: _build/cross/foo.ml
((INDEX $TESTCASE_ROOT/_build/cross/.foo.objs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/cross/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g)) (UNIT_NAME foo))

View file

@ -0,0 +1,16 @@
We check that the Merlin helper can handle filenames with capital letters in them.
$ cat >dune-project <<EOF
> (lang dune 3.7)
> EOF
$ touch mainFOO.ml
$ cat >dune <<EOF
> (executable (name mainFOO))
> EOF
$ dune build
$ printf '(4:File10:mainFOO.ml)4:Halt' | dune ocaml merlin start-session | grep ERROR
[1]

View file

@ -0,0 +1,2 @@
(library
(name foo))

View file

@ -0,0 +1,25 @@
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
$ dune build foo.cma --profile release
$ dune ocaml merlin dump-config $PWD
Foo: _build/default/foo
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w -40 -g)) (UNIT_NAME foo))
Foo: _build/default/foo.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w -40 -g)) (UNIT_NAME foo))
$ rm -f .merlin
$ dune build foo.cma --profile release
$ dune ocaml merlin dump-config $PWD
Foo: _build/default/foo
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w -40 -g)) (UNIT_NAME foo))
Foo: _build/default/foo.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w -40 -g)) (UNIT_NAME foo))
$ echo toto > .merlin
$ dune build foo.cma --profile release
$ dune ocaml merlin dump-config $PWD
Foo: _build/default/foo
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w -40 -g)) (UNIT_NAME foo))
Foo: _build/default/foo.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index) (STDLIB /OCAMLC_WHERE) (SOURCE_ROOT $TESTCASE_ROOT) (EXCLUDE_QUERY_DIR) (B $TESTCASE_ROOT/_build/default/.foo.objs/byte) (S $TESTCASE_ROOT) (FLG (-w -40 -g)) (UNIT_NAME foo))

View file

@ -0,0 +1,231 @@
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
A utility to query merlin configuration for a file:
$ cat >merlin_conf.sh <<EOF
> #!/bin/sh
> FILE=\$1
> printf "(4:File%d:%s)" \${#FILE} \$FILE | dune ocaml-merlin \
> | sed -E "s/[[:digit:]]+:/\?:/g" | sed -E "s/\)(\(+)/\n\1/g"
> EOF
$ chmod a+x merlin_conf.sh
Project sources
$ cat >dune-project <<EOF
> (lang dune 3.16)
> (using melange 0.1)
>
> (dialect
> (name mlx)
> (implementation
> (extension mlx)
> (preprocess (run cat %{input-file}))
> (merlin_reader mlx)))
> EOF
$ cat >pp.sh <<EOF
> #!/bin/sh
> sed 's/%INT%/42/g' \$1
> EOF
$ chmod a+x pp.sh
$ cat >dune <<EOF
> (executable
> (name test)
> (flags :standard -no-strict-formats)
> (preprocess
> (per_module
> ((action (run ./pp.sh %{input-file})) pped))))
>
> (rule
> (action (copy cppomod.cppo.ml cppomod.ml)))
>
> (rule
> (action (copy wrongext.cppo.cml wrongext.ml)))
>
> (rule
> (target generatedx.mlx)
> (mode promote)
> (action (with-stdout-to %{target} (echo "let x = \"Generatedx!\""))))
>
> (rule
> (target generated.ml)
> (mode promote)
> (action (with-stdout-to %{target} (echo "let x = \"Generated!\""))))
> EOF
$ cat >test.ml <<EOF
> print_endline Pped.x_42;;
> print_endline Mel.x;;
> print_endline Cppomod.x;;
> print_endline Wrongext.x;;
> print_endline Generated.x;;
> EOF
Both Pped's ml and mli files will be preprocessed
$ cat >pped.mli <<EOF
> val x_%INT% : string
> EOF
$ cat >pped.ml <<EOF
> let x_42 = "%INT%"
> EOF
Melange module signature
$ cat >mel.mli <<EOF
> val x : string
> EOF
Melange module implementation in Melange syntax
$ cat >mel.mlx <<EOF
> let x = "43"
> EOF
A pped file with unconventionnal filename
$ cat >cppomod.cppo.ml <<EOF
> let x = "44"
> EOF
$ cat >wrongext.cppo.cml <<EOF
> let x = "45"
> EOF
$ dune build @check
$ dune exec ./test.exe
42
43
44
45
Generated!
We now query Merlin configuration for the various source files:
Some configuration fields are common to all the modules of a same stanza. This
is the case for the stdlib, build and sources directories, flags and suffixes.
Some configuration can be specific to a module like preprocessing.
Dialects are specified by extensions so are specific to a file. This means a
different reader might be used for the signature and the implementation.
Note that Merlin should always be told about dialect-provided suffixes, to make `MerlinLocate` work correctly.
Preprocessing:
Is it expected that the suffix for implementation and interface is the same ?
$ ./merlin_conf.sh pped.ml | tee pped.out
((?:INDEX?:$TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index
(?:STDLIB?:/OCAMLC_WHERE
(?:SOURCE_ROOT?:$TESTCASE_ROOT
(?:EXCLUDE_QUERY_DIR
(?:B?:$TESTCASE_ROOT/_build/default/.test.eobjs/byte
(?:S?:$TESTCASE_ROOT
(?:FLG(?:-w?:@1..3@5..28@31..39@43@46..47@49..57@61..62@67@69-?:-strict-sequence?:-strict-formats?:-short-paths?:-keep-locs?:-no-strict-formats?:-g)
(?:FLG(?:-pp?:$TESTCASE_ROOT/_build/default/pp.sh)
(?:FLG(?:-open?:Dune__exe)
(?:UNIT_NAME?:dune__exe__Pped
(?:SUFFIX?:.mlx .mlx))
$ ./merlin_conf.sh pped.mli | diff pped.out -
Melange:
As expected, the reader is not communicated for the standard mli
$ ./merlin_conf.sh mel.mli | tee mel.out
((?:INDEX?:$TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index
(?:STDLIB?:/OCAMLC_WHERE
(?:SOURCE_ROOT?:$TESTCASE_ROOT
(?:EXCLUDE_QUERY_DIR
(?:B?:$TESTCASE_ROOT/_build/default/.test.eobjs/byte
(?:S?:$TESTCASE_ROOT
(?:FLG(?:-w?:@1..3@5..28@31..39@43@46..47@49..57@61..62@67@69-?:-strict-sequence?:-strict-formats?:-short-paths?:-keep-locs?:-no-strict-formats?:-g)
(?:FLG(?:-open?:Dune__exe)
(?:UNIT_NAME?:dune__exe__Mel
(?:SUFFIX?:.mlx .mlx))
The reader is set for the mlx file
$ ./merlin_conf.sh mel.mlx | diff mel.out -
10c10,11
< (?:SUFFIX?:.mlx .mlx))
\ No newline at end of file
---
> (?:SUFFIX?:.mlx .mlx
> (?:READER(?:mlx)))
\ No newline at end of file
[1]
Unconventional file names:
Users might have preprocessing steps that start with a non-conventional
filename like `mymodule.cppo.ml`.
While Dune first tries to match by the exact filename requested, if nothing is
found, then it'll make a guess that the file was preprocessed into a file with
.ml extension:
$ ./merlin_conf.sh cppomod.cppo.ml | tee cppomod.out
((?:INDEX?:$TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index
(?:STDLIB?:/OCAMLC_WHERE
(?:SOURCE_ROOT?:$TESTCASE_ROOT
(?:EXCLUDE_QUERY_DIR
(?:B?:$TESTCASE_ROOT/_build/default/.test.eobjs/byte
(?:S?:$TESTCASE_ROOT
(?:FLG(?:-w?:@1..3@5..28@31..39@43@46..47@49..57@61..62@67@69-?:-strict-sequence?:-strict-formats?:-short-paths?:-keep-locs?:-no-strict-formats?:-g)
(?:FLG(?:-open?:Dune__exe)
(?:UNIT_NAME?:dune__exe__Cppomod
(?:SUFFIX?:.mlx .mlx))
$ ./merlin_conf.sh cppomod.ml | diff cppomod.out -
Note that this means unrelated files might be given the same configuration:
$ ./merlin_conf.sh cppomod.tralala.ml | diff cppomod.out -
And with unconventional extension:
(note that without appropriate suffix configuration Merlin will never jump to
such files)
We could expect dune to get the wrongext module configuration
$ ./merlin_conf.sh wrongext.cppo.cml | tee wrongext.out
((?:INDEX?:$TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index
(?:STDLIB?:/OCAMLC_WHERE
(?:SOURCE_ROOT?:$TESTCASE_ROOT
(?:EXCLUDE_QUERY_DIR
(?:B?:$TESTCASE_ROOT/_build/default/.test.eobjs/byte
(?:S?:$TESTCASE_ROOT
(?:FLG(?:-w?:@1..3@5..28@31..39@43@46..47@49..57@61..62@67@69-?:-strict-sequence?:-strict-formats?:-short-paths?:-keep-locs?:-no-strict-formats?:-g)
(?:FLG(?:-open?:Dune__exe)
(?:UNIT_NAME?:dune__exe__Wrongext
(?:SUFFIX?:.mlx .mlx))
We also have generated.ml and generatedx.mlx promoted:
$ ls -1 . | grep generated
generated.ml
generatedx.mlx
It should be possible to get its merlin configuration as well:
$ ./merlin_conf.sh generated.ml
((?:INDEX?:$TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index
(?:STDLIB?:/OCAMLC_WHERE
(?:SOURCE_ROOT?:$TESTCASE_ROOT
(?:EXCLUDE_QUERY_DIR
(?:B?:$TESTCASE_ROOT/_build/default/.test.eobjs/byte
(?:S?:$TESTCASE_ROOT
(?:FLG(?:-w?:@1..3@5..28@31..39@43@46..47@49..57@61..62@67@69-?:-strict-sequence?:-strict-formats?:-short-paths?:-keep-locs?:-no-strict-formats?:-g)
(?:FLG(?:-open?:Dune__exe)
(?:UNIT_NAME?:dune__exe__Generated
(?:SUFFIX?:.mlx .mlx))
$ ./merlin_conf.sh generatedx.mlx
((?:INDEX?:$TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index
(?:STDLIB?:/OCAMLC_WHERE
(?:SOURCE_ROOT?:$TESTCASE_ROOT
(?:EXCLUDE_QUERY_DIR
(?:B?:$TESTCASE_ROOT/_build/default/.test.eobjs/byte
(?:S?:$TESTCASE_ROOT
(?:FLG(?:-w?:@1..3@5..28@31..39@43@46..47@49..57@61..62@67@69-?:-strict-sequence?:-strict-formats?:-short-paths?:-keep-locs?:-no-strict-formats?:-g)
(?:FLG(?:-open?:Dune__exe)
(?:UNIT_NAME?:dune__exe__Generatedx
(?:SUFFIX?:.mlx .mlx
(?:READER(?:mlx)))

View file

@ -0,0 +1,4 @@
(executable
(name main)
(flags :standard -w -34)
(libraries lib1))

View file

@ -0,0 +1,2 @@
(lang dune 3.17)
(implicit_transitive_deps false)

View file

@ -0,0 +1,44 @@
$ stdlib="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/STDLIB=$stdlib:$BUILD_PATH_PREFIX_MAP"
$ dune build @check
Merlin must be able to locate the definitions of values coming from an
implicit transitive dependency, even when `implicit-transitive-dependency` is
set to `false`. They should be part of the source path returned by the
configuration.
In this test the dependencies are as follow:
main -> lib1 -> lib2 -> stdlib
When using OCaml >= 5.2 these hidden dependencies are passed to merlin using the
new `*H` directives.
$ FILE=$PWD/bin/main.ml
$ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin |
> sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?"
?:B?:$TESTCASE_ROOT/_build/default/bin/.main.eobjs/byte)
?:B?:$TESTCASE_ROOT/_build/default/src/lib1/.lib1.objs/byte)
?:S?:$TESTCASE_ROOT/bin)
?:S?:$TESTCASE_ROOT/src/lib1)
?:BH?:/STDLIB/unix)
?:BH?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte)
?:SH?:/STDLIB/unix)
?:SH?:$TESTCASE_ROOT/src/lib2)
$ FILE=$PWD/src/lib1/lib1.ml
$ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin |
> sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?"
?:B?:/STDLIB/unix)
?:B?:$TESTCASE_ROOT/_build/default/src/lib1/.lib1.objs/byte)
?:B?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte)
?:S?:/STDLIB/unix)
?:S?:$TESTCASE_ROOT/src/lib1)
?:S?:$TESTCASE_ROOT/src/lib2)
$ FILE=$PWD/src/lib2/lib2.ml
$ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin |
> sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?"
?:B?:/STDLIB/unix)
?:B?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte)
?:S?:/STDLIB/unix)
?:S?:$TESTCASE_ROOT/src/lib2)

View file

@ -0,0 +1,3 @@
(library
(name lib1)
(libraries lib2 unix))

View file

@ -0,0 +1,3 @@
(library
(name lib2)
(libraries unix))

View file

@ -0,0 +1,3 @@
type t = bool
type r = Unix.error

View file

@ -0,0 +1,3 @@
(executable
(name main)
(libraries lib1))

View file

@ -0,0 +1,2 @@
(lang dune 3.17)
(implicit_transitive_deps false)

View file

@ -0,0 +1,38 @@
$ stdlib="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/STDLIB=$stdlib:$BUILD_PATH_PREFIX_MAP"
$ dune build @check
Merlin must be able to locate the definitions of values coming from an
implicit transitive dependency, even when `implicit-transitive-dependency` is
set to `false`. They should be part of the source path returned by the
configuration.
In this test the dependencies are as follow:
main -> lib1 -> lib2 -> stdlib
When using OCaml < 5.2 there is no proper way to provide that information to
Merlin.
$ FILE=$PWD/bin/main.ml
$ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin |
> sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?"
?:B?:$TESTCASE_ROOT/_build/default/bin/.main.eobjs/byte)
?:B?:$TESTCASE_ROOT/_build/default/src/lib1/.lib1.objs/byte)
?:S?:$TESTCASE_ROOT/bin)
?:S?:$TESTCASE_ROOT/src/lib1)
$ FILE=$PWD/src/lib1/lib1.ml
$ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin |
> sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?"
?:B?:$TESTCASE_ROOT/_build/default/src/lib1/.lib1.objs/byte)
?:B?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte)
?:S?:$TESTCASE_ROOT/src/lib1)
?:S?:$TESTCASE_ROOT/src/lib2)
$ FILE=$PWD/src/lib2/lib2.ml
$ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin |
> sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?"
?:B?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte)
?:B?:$TESTCASE_ROOT/_build/default/src/lib_dep/.dep.objs/byte)
?:S?:$TESTCASE_ROOT/src/lib2)
?:S?:$TESTCASE_ROOT/src/lib_dep)

View file

@ -0,0 +1,3 @@
(library
(name lib1)
(libraries lib2))

View file

@ -0,0 +1,3 @@
(library
(name lib2)
(libraries dep))

View file

@ -0,0 +1,186 @@
$ cat >dune-project <<EOF
> (lang dune 3.12)
> EOF
$ cat >dune <<EOF
> (include_subdirs qualified)
> (library
> (name foo))
> EOF
$ touch main.ml
$ mkdir utils
$ touch utils/calc.ml
$ mkdir groupintf
$ touch groupintf/groupintf.ml
$ touch groupintf/calc.ml
$ opam_prefix="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OPAM_PREFIX=$opam_prefix:$BUILD_PATH_PREFIX_MAP"
$ dune build .merlin-conf/lib-foo
$ dune ocaml merlin dump-config .
Foo: _build/default/foo
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME foo))
Foo: _build/default/foo.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME foo))
Foo__Groupintf__: _build/default/foo__Groupintf__
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME foo__Groupintf__))
Foo__Groupintf__: _build/default/foo__Groupintf__.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME foo__Groupintf__))
Utils: _build/default/foo__Utils
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME foo__Utils))
Utils: _build/default/foo__Utils.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME foo__Utils))
Calc: _build/default/groupintf/calc
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-open Foo__Groupintf__ -open Foo))
(UNIT_NAME foo__Groupintf__Calc))
Calc: _build/default/groupintf/calc.ml
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-open Foo__Groupintf__ -open Foo))
(UNIT_NAME foo__Groupintf__Calc))
Groupintf: _build/default/groupintf/groupintf
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-open Foo__Groupintf__ -open Foo))
(UNIT_NAME foo__Groupintf))
Groupintf: _build/default/groupintf/groupintf.ml
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-open Foo__Groupintf__ -open Foo))
(UNIT_NAME foo__Groupintf))
Main: _build/default/main
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-open Foo))
(UNIT_NAME foo__Main))
Main: _build/default/main.ml
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-open Foo))
(UNIT_NAME foo__Main))
Calc: _build/default/utils/calc
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-open Foo__Utils -open Foo))
(UNIT_NAME foo__Utils__Calc))
Calc: _build/default/utils/calc.ml
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OPAM_PREFIX)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/groupintf)
(S $TESTCASE_ROOT/utils)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-open Foo__Utils -open Foo))
(UNIT_NAME foo__Utils__Calc))
$ dune ocaml merlin dump-config utils

View file

@ -0,0 +1,4 @@
(lang dune 3.8)
(package
(name hello))

View file

@ -0,0 +1,3 @@
(executable
(name x)
(libraries foo))

View file

@ -0,0 +1,14 @@
(library
(name foo)
(private_modules privmod)
(modules privmod)
(instrumentation
(backend hello)))
(library
(name bar)
(modules file)
(instrumentation
(backend hello)))
(include_subdirs unqualified)

View file

@ -0,0 +1,13 @@
(library
(name hello_ppx)
(public_name hello.ppx)
(kind ppx_rewriter)
(ppx_runtime_libraries hello)
(libraries ppxlib)
(modules hello_ppx))
(library
(public_name hello)
(modules hello)
(instrumentation.backend
(ppx hello.ppx)))

View file

@ -0,0 +1 @@
let hello s = print_endline (Printf.sprintf "Hello from %s!" s)

View file

@ -0,0 +1,41 @@
open Ast_helper
open Longident
let place = ref None
let file = ref None
let read_file () =
match !file with
| None -> "<none>"
| Some s ->
let ic = open_in s in
begin match input_line ic with
| exception End_of_file ->
close_in ic;
"<none>"
| s ->
close_in ic;
s
end
let impl str =
let arg =
match !place with
| None -> Exp.ident (Location.mknoloc (Lident "__MODULE__"))
| Some s -> Exp.constant (Const.string (Printf.sprintf "%s (%s)" s (read_file ())))
in
Str.eval
(Exp.apply (Exp.ident (Location.mknoloc (Ldot (Lident "Hello", "hello"))))
[Nolabel, arg]) :: str
open Ppxlib
let () =
Driver.add_arg "-place" (Arg.String (fun s -> place := Some s))
~doc:"PLACE where to say hello from";
Driver.add_arg "-file" (Arg.String (fun s -> file := Some s))
~doc:"Add info from file"
let () =
Driver.register_transformation_using_ocaml_current_ast ~impl "hello"

View file

@ -0,0 +1,142 @@
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
$ ocamlfind_libs="$(ocamlfind printconf path | while read line; do printf lib=${line}:; done)"
$ export BUILD_PATH_PREFIX_MAP="$ocamlfind_libs:$BUILD_PATH_PREFIX_MAP"
Here we test that instrumentation processing is not passed to merlin by setting
up a project with instrumentation and testing checking the merlin config.
$ dune build --instrument-with hello ./lib/.merlin-conf/lib-foo ./lib/.merlin-conf/lib-bar --profile release
$ dune ocaml merlin dump-config $PWD/lib
Bar: _build/default/lib/bar
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello_ppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.bar.objs/byte)
(B $TESTCASE_ROOT/_build/default/ppx/.hello.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(S $TESTCASE_ROOT/ppx)
(FLG (-w -40 -g))
(UNIT_NAME bar))
Bar: _build/default/lib/bar.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello_ppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.bar.objs/byte)
(B $TESTCASE_ROOT/_build/default/ppx/.hello.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(S $TESTCASE_ROOT/ppx)
(FLG (-w -40 -g))
(UNIT_NAME bar))
File: _build/default/lib/subdir/file
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello_ppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.bar.objs/byte)
(B $TESTCASE_ROOT/_build/default/ppx/.hello.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(S $TESTCASE_ROOT/ppx)
(FLG (-w -40 -g))
(FLG (-open Bar))
(UNIT_NAME bar__File))
File: _build/default/lib/subdir/file.ml
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello_ppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.bar.objs/byte)
(B $TESTCASE_ROOT/_build/default/ppx/.hello.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(S $TESTCASE_ROOT/ppx)
(FLG (-w -40 -g))
(FLG (-open Bar))
(UNIT_NAME bar__File))
Foo: _build/default/lib/foo
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello_ppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/byte)
(B $TESTCASE_ROOT/_build/default/ppx/.hello.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(S $TESTCASE_ROOT/ppx)
(FLG (-w -40 -g))
(UNIT_NAME foo))
Foo: _build/default/lib/foo.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello_ppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/byte)
(B $TESTCASE_ROOT/_build/default/ppx/.hello.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(S $TESTCASE_ROOT/ppx)
(FLG (-w -40 -g))
(UNIT_NAME foo))
Privmod: _build/default/lib/privmod
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello_ppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/byte)
(B $TESTCASE_ROOT/_build/default/ppx/.hello.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(S $TESTCASE_ROOT/ppx)
(FLG (-w -40 -g))
(FLG (-open Foo))
(UNIT_NAME foo__Privmod))
Privmod: _build/default/lib/privmod.ml
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.hello_ppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/byte)
(B $TESTCASE_ROOT/_build/default/ppx/.hello.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(S $TESTCASE_ROOT/ppx)
(FLG (-w -40 -g))
(FLG (-open Foo))
(UNIT_NAME foo__Privmod))

View file

@ -0,0 +1,10 @@
(library
(name foo)
(modules foo))
(executable
(name test)
(modules test)
(libraries foo))
(copy_files# 411/test.ml)

View file

@ -0,0 +1,68 @@
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
We build the project
$ dune exec ./test.exe
bar
Verify that merlin configuration was generated...
$ dune ocaml merlin dump-config $PWD
Test: _build/default/test
((INDEX $TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(B $TESTCASE_ROOT/_build/default/.test.eobjs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/411)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME dune__exe__Test))
Test: _build/default/test.ml
((INDEX $TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(B $TESTCASE_ROOT/_build/default/.test.eobjs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/411)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME dune__exe__Test))
Foo: _build/default/foo
((INDEX $TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/411)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME foo))
Foo: _build/default/foo.ml
((INDEX $TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(S $TESTCASE_ROOT/411)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME foo))
...but not in the sub-folder whose content was copied
$ dune ocaml merlin dump-config $PWD/411
Now we check that both querying from the root and the subfolder works
$ FILE=$PWD/foo.ml
$ FILE411=$PWD/411/test.ml
$ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin | sed -E "s/[[:digit:]]+:/\?:/g"
((?:INDEX?:$TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index)(?:INDEX?:$TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)(?:STDLIB?:/OCAMLC_WHERE)(?:SOURCE_ROOT?:$TESTCASE_ROOT)(?:EXCLUDE_QUERY_DIR)(?:B?:$TESTCASE_ROOT/_build/default/.foo.objs/byte)(?:S?:$TESTCASE_ROOT)(?:S?:$TESTCASE_ROOT/411)(?:FLG(?:-w?:@1..3@5..28@30..39@43@46..47@49..57@61..62-?:-strict-sequence?:-strict-formats?:-short-paths?:-keep-locs?:-g))(?:UNIT_NAME?:foo))
$ printf "(4:File%d:%s)" ${#FILE411} $FILE411 | dune ocaml-merlin | sed -E "s/[[:digit:]]+:/\?:/g"
((?:INDEX?:$TESTCASE_ROOT/_build/default/.test.eobjs/cctx.ocaml-index)(?:INDEX?:$TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)(?:STDLIB?:/OCAMLC_WHERE)(?:SOURCE_ROOT?:$TESTCASE_ROOT)(?:EXCLUDE_QUERY_DIR)(?:B?:$TESTCASE_ROOT/_build/default/.foo.objs/byte)(?:B?:$TESTCASE_ROOT/_build/default/.test.eobjs/byte)(?:S?:$TESTCASE_ROOT)(?:S?:$TESTCASE_ROOT/411)(?:FLG(?:-w?:@1..3@5..28@30..39@43@46..47@49..57@61..62-?:-strict-sequence?:-strict-formats?:-short-paths?:-keep-locs?:-g))(?:UNIT_NAME?:dune__exe__Test))

View file

@ -0,0 +1,4 @@
(executable
(name x)
(preprocess (action (run pp/pp.exe %{input-file})))
(libraries foo))

View file

@ -0,0 +1,2 @@
(executables
(names x y))

View file

@ -0,0 +1,13 @@
(library
(name foo)
(libraries publicfoo)
(private_modules privmod)
(modules privmod)
(preprocess (pps fooppx)))
(library
(name bar)
(modules file)
(preprocess (pps fooppx)))
(include_subdirs unqualified)

View file

@ -0,0 +1,5 @@
(rule (with-stdout-to dummy (echo "-nothing")))
(executable
(name foobar)
(preprocess (action (run %{exe:../pp/pp.exe} %{read:dummy} %{input-file}))))

View file

@ -0,0 +1,2 @@
(executable
(name pp))

View file

@ -0,0 +1,3 @@
(library
(name fooppx)
(kind ppx_rewriter))

View file

@ -0,0 +1,310 @@
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
$ ocamlfind_libs="$(ocamlfind printconf path | while read line; do printf lib=${line}:; done)"
$ export BUILD_PATH_PREFIX_MAP="$ocamlfind_libs:$BUILD_PATH_PREFIX_MAP"
We're going create a fake findlib library for use:
$ mkdir -p _findlib/publicfoo
$ cat >_findlib/publicfoo/META <<EOF
> EOF
$ export OCAMLPATH="$PWD/_findlib:$OCAMLPATH"
CRAM sanitization
$ dune build ./exe/.merlin-conf/exe-x --profile release
$ dune ocaml merlin dump-config $PWD/exe
X: _build/default/exe/x
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_findlib/publicfoo)
(B $TESTCASE_ROOT/_build/default/exe/.x.eobjs/byte)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/public_cmi)
(S $TESTCASE_ROOT/_findlib/publicfoo)
(S $TESTCASE_ROOT/exe)
(S $TESTCASE_ROOT/lib)
(FLG (-w -40 -g))
(FLG (-pp $TESTCASE_ROOT/_build/default/pp/pp.exe))
(UNIT_NAME x))
X: _build/default/exe/x.ml
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_findlib/publicfoo)
(B $TESTCASE_ROOT/_build/default/exe/.x.eobjs/byte)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/public_cmi)
(S $TESTCASE_ROOT/_findlib/publicfoo)
(S $TESTCASE_ROOT/exe)
(S $TESTCASE_ROOT/lib)
(FLG (-w -40 -g))
(FLG (-pp $TESTCASE_ROOT/_build/default/pp/pp.exe))
(UNIT_NAME x))
$ dune build ./lib/.merlin-conf/lib-foo ./lib/.merlin-conf/lib-bar --profile release
$ dune ocaml merlin dump-config $PWD/lib
Bar: _build/default/lib/bar
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.bar.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/3a8685470d9b5edd99690707a29a2b1a/ppx.exe --as-ppx --cookie 'library-name="bar"'"))
(UNIT_NAME bar))
Bar: _build/default/lib/bar.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.bar.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/3a8685470d9b5edd99690707a29a2b1a/ppx.exe --as-ppx --cookie 'library-name="bar"'"))
(UNIT_NAME bar))
File: _build/default/lib/subdir/file
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.bar.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/3a8685470d9b5edd99690707a29a2b1a/ppx.exe --as-ppx --cookie 'library-name="bar"'"))
(FLG (-open Bar))
(UNIT_NAME bar__File))
File: _build/default/lib/subdir/file.ml
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/lib/.bar.objs/byte)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/3a8685470d9b5edd99690707a29a2b1a/ppx.exe --as-ppx --cookie 'library-name="bar"'"))
(FLG (-open Bar))
(UNIT_NAME bar__File))
Foo: _build/default/lib/foo
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_findlib/publicfoo)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/byte)
(S $TESTCASE_ROOT/_findlib/publicfoo)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/3a8685470d9b5edd99690707a29a2b1a/ppx.exe --as-ppx --cookie 'library-name="foo"'"))
(UNIT_NAME foo))
Foo: _build/default/lib/foo.ml-gen
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_findlib/publicfoo)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/byte)
(S $TESTCASE_ROOT/_findlib/publicfoo)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/3a8685470d9b5edd99690707a29a2b1a/ppx.exe --as-ppx --cookie 'library-name="foo"'"))
(UNIT_NAME foo))
Privmod: _build/default/lib/privmod
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_findlib/publicfoo)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/byte)
(S $TESTCASE_ROOT/_findlib/publicfoo)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/3a8685470d9b5edd99690707a29a2b1a/ppx.exe --as-ppx --cookie 'library-name="foo"'"))
(FLG (-open Foo))
(UNIT_NAME foo__Privmod))
Privmod: _build/default/lib/privmod.ml
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_findlib/publicfoo)
(B $TESTCASE_ROOT/_build/default/lib/.foo.objs/byte)
(S $TESTCASE_ROOT/_findlib/publicfoo)
(S $TESTCASE_ROOT/lib)
(S $TESTCASE_ROOT/lib/subdir)
(FLG (-w -40 -g))
(FLG (-ppx "$TESTCASE_ROOT/_build/default/.ppx/3a8685470d9b5edd99690707a29a2b1a/ppx.exe --as-ppx --cookie 'library-name="foo"'"))
(FLG (-open Foo))
(UNIT_NAME foo__Privmod))
Make sure a ppx directive is generated (if not, the [grep ppx] step fails)
$ dune ocaml merlin dump-config $PWD/lib | grep ppx > /dev/null
Make sure pp flag is correct and variables are expanded
$ dune build ./pp-with-expand/.merlin-conf/exe-foobar --profile release
$ dune ocaml merlin dump-config $PWD/pp-with-expand
Foobar: _build/default/pp-with-expand/foobar
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/byte)
(S $TESTCASE_ROOT/pp-with-expand)
(FLG (-w -40 -g))
(FLG (-pp "$TESTCASE_ROOT/_build/default/pp/pp.exe -nothing"))
(UNIT_NAME foobar))
Foobar: _build/default/pp-with-expand/foobar.ml
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/byte)
(S $TESTCASE_ROOT/pp-with-expand)
(FLG (-w -40 -g))
(FLG (-pp "$TESTCASE_ROOT/_build/default/pp/pp.exe -nothing"))
(UNIT_NAME foobar))
Check hash of executables names if more than one
$ dune build ./exes/.merlin-conf/exe-x-e0b998aff107b214969cbb2e501dd255
$ dune ocaml merlin dump-config $PWD/exes
X: _build/default/exes/x
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/exes/.x.eobjs/byte)
(S $TESTCASE_ROOT/exes)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME x))
X: _build/default/exes/x.ml
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/exes/.x.eobjs/byte)
(S $TESTCASE_ROOT/exes)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME x))
Y: _build/default/exes/y
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/exes/.x.eobjs/byte)
(S $TESTCASE_ROOT/exes)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME y))
Y: _build/default/exes/y.ml
((INDEX $TESTCASE_ROOT/_build/default/exe/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/exes/.x.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.bar.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/lib/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp-with-expand/.foobar.eobjs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/ppx/.fooppx.objs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/exes/.x.eobjs/byte)
(S $TESTCASE_ROOT/exes)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME y))

View file

@ -0,0 +1,6 @@
(library
(name foo)
(modules foo bar)
(wrapped false)
(preprocess (per_module
((action (run pp/pp.exe %{input-file})) foo))))

View file

@ -0,0 +1,2 @@
(executable
(name pp))

View file

@ -0,0 +1,51 @@
$ dune build @check
$ ocamlc_where="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/OCAMLC_WHERE=$ocamlc_where:$BUILD_PATH_PREFIX_MAP"
We dump the config for Foo and Bar modules but the pp.exe preprocessor
should appear only once since only Foo is using it.
$ dune ocaml merlin dump-config $PWD
Bar: _build/default/bar
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME bar))
Bar: _build/default/bar.ml
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(UNIT_NAME bar))
Foo: _build/default/foo
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-pp $TESTCASE_ROOT/_build/default/pp/pp.exe))
(UNIT_NAME foo))
Foo: _build/default/foo.ml
((INDEX $TESTCASE_ROOT/_build/default/.foo.objs/cctx.ocaml-index)
(INDEX $TESTCASE_ROOT/_build/default/pp/.pp.eobjs/cctx.ocaml-index)
(STDLIB /OCAMLC_WHERE)
(SOURCE_ROOT $TESTCASE_ROOT)
(EXCLUDE_QUERY_DIR)
(B $TESTCASE_ROOT/_build/default/.foo.objs/byte)
(S $TESTCASE_ROOT)
(FLG (-w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g))
(FLG (-pp $TESTCASE_ROOT/_build/default/pp/pp.exe))
(UNIT_NAME foo))

View file

@ -0,0 +1,20 @@
(rule (copy# foobar/lib3.foobar.ml lib3.ml))
(library
(name mylib)
(modules lib))
(library
(name mylib3)
(modules lib3)
(libraries mylib))
(executable
(name main)
(modules main lib2)
(libraries mylib mylib3))
(executable
(name not-a-module-name)
(modules not-a-module-name)
(flags :standard -w -24))

View file

@ -0,0 +1 @@
let foo ="bar"

Some files were not shown because too many files have changed in this diff Show more