File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
test/blackbox-tests/test-cases/root-module Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ Demonstrate if we're running ocamldep for the root module. There should be no
2+ need to do so since this module cannot depend on any other module in the same
3+ compilation unit.
4+
5+ $ cat > dune-project << EOF
6+ > (lang dune 3.20 )
7+ > EOF
8+
9+ $ mkdir lib /
10+ $ cat > lib / dune << EOF
11+ > (library
12+ > (name bar))
13+ > EOF
14+ $ touch lib / bar. ml
15+
16+ $ cat > dune << EOF
17+ > (library
18+ > (name foo)
19+ > (libraries bar)
20+ > (root_module root))
21+ > EOF
22+
23+ $ dune build foo. cma
24+
25+ $ find _build/ default /. foo. objs | grep -i root | sort -u
26+ _build/ default /. foo. objs/ byte/ foo__Root. cmi
27+ _build/ default /. foo. objs/ byte/ foo__Root. cmo
28+ _build/ default /. foo. objs/ byte/ foo__Root. cmt
29+ _build/ default /. foo. objs/ foo__Root. impl. all-deps
30+ _build/ default /. foo. objs/ foo__Root. impl. d
31+
32+ Not only is running ocamldep wasteful, but it can also lead to cycles:
33+
34+ $ cat > bar. ml << EOF
35+ > module X = Root. Bar
36+ > EOF
37+
38+ $ dune build foo. cma
39+ Error: Dependency cycle between:
40+ _build/ default /. foo. objs/ foo__Bar. impl. all-deps
41+ -> _build/ default /. foo. objs/ foo__Root. impl. all-deps
42+ -> _build/ default /. foo. objs/ foo__Bar. impl. all-deps
43+ -> required by _build/ default /. foo. objs/ byte/ foo__Bar. cmo
44+ -> required by _build/ default / foo. cma
45+ [1 ]
You can’t perform that action at this time.
0 commit comments