Skip to content

Commit c2cdbb3

Browse files
committed
Guard META generation of exports with version >= (3, 17)
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
1 parent c90f9f0 commit c2cdbb3

File tree

3 files changed

+91
-2
lines changed

3 files changed

+91
-2
lines changed

src/dune_rules/gen_meta.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ let gen_lib pub_name lib ~version =
111111
List.concat
112112
[ version
113113
; [ description desc; requires ~preds lib_deps ]
114-
; (if Lib_name.Set.is_empty lib_re_exports then [] else [ exports lib_re_exports ])
114+
; (if (match Lib.project lib with
115+
| None -> true
116+
| Some project -> Dune_project.dune_version project < (3, 17))
117+
|| Lib_name.Set.is_empty lib_re_exports
118+
then []
119+
else [ exports lib_re_exports ])
115120
; archives ~preds lib
116121
; (if Lib_name.Set.is_empty ppx_rt_deps
117122
then []

test/blackbox-tests/test-cases/meta-gen.t/dune-project

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/blackbox-tests/test-cases/meta-gen.t/run.t

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,88 @@
1+
$ echo '(lang dune 2.0)' > dune-project
2+
$ dune runtest --force
3+
description = "contains \"quotes\""
4+
requires = "bytes"
5+
archive(byte) = "foobar.cma"
6+
archive(native) = "foobar.cmxa"
7+
plugin(byte) = "foobar.cma"
8+
plugin(native) = "foobar.cmxs"
9+
package "baz" (
10+
directory = "baz"
11+
description = "sub library with modes set to byte"
12+
requires = "bytes"
13+
archive(byte) = "foobar_baz.cma"
14+
archive(native) = ""
15+
plugin(byte) = "foobar_baz.cma"
16+
plugin(native) = ""
17+
)
18+
package "foobar2" (
19+
directory = "foobar2"
20+
description = ""
21+
requires = "foobar foobar.ppd foobar.rewriter2"
22+
archive(byte) = "foobar2.cma"
23+
archive(native) = "foobar2.cmxa"
24+
plugin(byte) = "foobar2.cma"
25+
plugin(native) = "foobar2.cmxs"
26+
)
27+
package "ppd" (
28+
directory = "ppd"
29+
description = "pp'd with a rewriter"
30+
requires = "foobar foobar.baz foobar.runtime-lib2"
31+
archive(byte) = "foobar_ppd.cma"
32+
archive(native) = "foobar_ppd.cmxa"
33+
plugin(byte) = "foobar_ppd.cma"
34+
plugin(native) = "foobar_ppd.cmxs"
35+
)
36+
package "rewriter" (
37+
directory = "rewriter"
38+
description = "ppx rewriter"
39+
requires(ppx_driver) = "foobar foobar.rewriter2"
40+
archive(ppx_driver,byte) = "foobar_rewriter.cma"
41+
archive(ppx_driver,native) = "foobar_rewriter.cmxa"
42+
plugin(ppx_driver,byte) = "foobar_rewriter.cma"
43+
plugin(ppx_driver,native) = "foobar_rewriter.cmxs"
44+
# This is what dune uses to find out the runtime dependencies of
45+
# a preprocessor
46+
ppx_runtime_deps = "foobar.baz"
47+
# This line makes things transparent for people mixing preprocessors
48+
# and normal dependencies
49+
requires(-ppx_driver) = "foobar.baz foobar.runtime-lib2"
50+
ppx(-ppx_driver,-custom_ppx) = "./ppx.exe --as-ppx"
51+
library_kind = "ppx_rewriter"
52+
)
53+
package "rewriter2" (
54+
directory = "rewriter2"
55+
description = "ppx rewriter expander"
56+
requires = "foobar"
57+
archive(byte) = "foobar_rewriter2.cma"
58+
archive(native) = "foobar_rewriter2.cmxa"
59+
plugin(byte) = "foobar_rewriter2.cma"
60+
plugin(native) = "foobar_rewriter2.cmxs"
61+
# This is what dune uses to find out the runtime dependencies of
62+
# a preprocessor
63+
ppx_runtime_deps = "foobar.runtime-lib2"
64+
)
65+
package "runtime-lib2" (
66+
directory = "runtime-lib2"
67+
description = "runtime library for foobar.rewriter2"
68+
requires = ""
69+
archive(byte) = "foobar_runtime_lib2.cma"
70+
archive(native) = "foobar_runtime_lib2.cmxa"
71+
plugin(byte) = "foobar_runtime_lib2.cma"
72+
plugin(native) = "foobar_runtime_lib2.cmxs"
73+
jsoo_runtime = "foobar_runtime.js foobar_runtime2.js"
74+
)
75+
package "sub" (
76+
directory = "sub"
77+
description = "sub library in a sub dir"
78+
requires = "bytes"
79+
archive(byte) = "foobar_sub.cma"
80+
archive(native) = ""
81+
plugin(byte) = "foobar_sub.cma"
82+
plugin(native) = ""
83+
)
84+
85+
$ echo '(lang dune 3.17)' > dune-project
186
$ dune runtest --force
287
description = "contains \"quotes\""
388
requires = "bytes"

0 commit comments

Comments
 (0)