-
Notifications
You must be signed in to change notification settings - Fork 392
/
ppx-runtime-libraries.t
60 lines (51 loc) · 1.43 KB
/
ppx-runtime-libraries.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Demonstrate a bad interaction between cross-compilation and
ppx_runtime_libraries
$ mkdir -p etc/findlib.conf.d
$ export OCAMLFIND_CONF=$PWD/etc/findlib.conf
$ touch etc/findlib.conf etc/findlib.conf.d/foo.conf
Create lib1, ppx and lib2:
- lib1 is a regular library
- ppx has a runtime dep on lib1 (via `ppx_runtime_libraries`)
- lib2 is a regular library pre-processed by `ppx`
$ mkdir lib1 ppx lib2
$ cat > dune-project <<EOF
> (lang dune 3.7)
> (package (name ppx-cross))
> EOF
$ cat > lib1/dune <<EOF
> (library
> (name lib1)
> (public_name ppx-cross.lib1))
> EOF
In the ppx, removing `ppx_runtime_libraries` makes the test pass
$ cat > ppx/dune <<EOF
> (library
> (name ppx)
> (public_name ppx-cross.ppx)
> (kind ppx_rewriter)
> (ppx.driver (main Ppx.main))
> (ppx_runtime_libraries lib1))
> EOF
$ cat > ppx/ppx.ml <<EOF
> let main () =
> let out = ref "" in
> let args =
> [ ("-o", Arg.Set_string out, "")
> ; ("--impl", Arg.Set_string (ref ""), "")
> ; ("--as-ppx", Arg.Set (ref false), "")
> ; ("--cookie", Arg.Set (ref false), "")
> ]
> in
> let anon _ = () in
> Arg.parse (Arg.align args) anon "";
> let out = open_out !out in
> close_out out;
> EOF
$ cat > lib2/dune <<EOF
> (library
> (name lib2)
> (public_name ppx-cross.lib2)
> (preprocess (pps ppx)))
> EOF
$ touch lib2/lib2.ml
$ dune build @install -x foo