This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
let run () = print_endline "private module bar"
|
||||
|
|
@ -0,0 +1 @@
|
|||
val run : unit -> unit
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
(library
|
||||
(name foo)
|
||||
(modules foo bar)
|
||||
(wrapped false)
|
||||
(private_modules bar))
|
||||
|
||||
(executable
|
||||
(name runfoo)
|
||||
(modules runfoo)
|
||||
(libraries foo))
|
||||
|
||||
(alias
|
||||
(name default)
|
||||
(action (run ./runfoo.exe)))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.2)
|
||||
|
|
@ -0,0 +1 @@
|
|||
let linkme = Bar.run ()
|
||||
|
|
@ -0,0 +1 @@
|
|||
val linkme : unit
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
$ dune build
|
||||
private module bar
|
||||
|
|
@ -0,0 +1 @@
|
|||
ignore Foo.linkme
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
(executable
|
||||
(name foo)
|
||||
(libraries lib))
|
||||
|
||||
(alias
|
||||
(name default)
|
||||
(action (run ./foo.exe)))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.2)
|
||||
|
|
@ -0,0 +1 @@
|
|||
X.run ();;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
$ dune build
|
||||
File "foo.ml", line 1, characters 0-5:
|
||||
1 | X.run ();;
|
||||
^^^^^
|
||||
Error: Unbound module X
|
||||
[1]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(library
|
||||
(name lib)
|
||||
(wrapped false)
|
||||
(private_modules x))
|
||||
|
|
@ -0,0 +1 @@
|
|||
let run () = print_endline "private"
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
Demonstrate the behavior when a module is listed by private_modules by not by
|
||||
modules:
|
||||
|
||||
$ cat > dune-project << EOF
|
||||
> (lang dune 3.7)
|
||||
> EOF
|
||||
|
||||
$ mkdir src
|
||||
$ cat > src/dune << EOF
|
||||
> (library
|
||||
> (name foo)
|
||||
> (wrapped false)
|
||||
> (modules y)
|
||||
> (private_modules x))
|
||||
> EOF
|
||||
|
||||
$ cat > src/x.ml << EOF
|
||||
> let foo = ()
|
||||
> EOF
|
||||
|
||||
$ cat > src/y.ml << EOF
|
||||
> let () = X.foo ()
|
||||
> EOF
|
||||
|
||||
X is warned about:
|
||||
|
||||
$ dune build
|
||||
File "src/dune", line 5, characters 18-19:
|
||||
5 | (private_modules x))
|
||||
^
|
||||
Warning: These modules appear in the private_modules field:
|
||||
- X
|
||||
They must also appear in the modules field.
|
||||
File "src/y.ml", line 1, characters 9-14:
|
||||
1 | let () = X.foo ()
|
||||
^^^^^
|
||||
Error: Unbound module X
|
||||
[1]
|
||||
|
||||
In 3.11 onwards this warning becomes an error
|
||||
|
||||
$ cat > dune-project << EOF
|
||||
> (lang dune 3.11)
|
||||
> EOF
|
||||
|
||||
$ dune build
|
||||
File "src/dune", line 5, characters 18-19:
|
||||
5 | (private_modules x))
|
||||
^
|
||||
Error: These modules appear in the private_modules field:
|
||||
- X
|
||||
They must also appear in the modules field.
|
||||
[1]
|
||||
|
||||
This warning should be ignored if we are in vendored_dirs
|
||||
|
||||
$ cat > dune << EOF
|
||||
> (vendored_dirs src)
|
||||
> (executable
|
||||
> (name bar)
|
||||
> (libraries foo))
|
||||
> EOF
|
||||
$ cat > bar.ml
|
||||
|
||||
$ dune build ./bar.exe
|
||||
File "src/y.ml", line 1, characters 9-14:
|
||||
1 | let () = X.foo ()
|
||||
^^^^^
|
||||
Error: Unbound module X
|
||||
[1]
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
(library
|
||||
(public_name lib)
|
||||
(modules foo priv)
|
||||
(private_modules priv))
|
||||
|
||||
(library
|
||||
(name lib_foo)
|
||||
(public_name lib.foo)
|
||||
(wrapped false)
|
||||
(modules bar priv2)
|
||||
(private_modules priv2))
|
||||
|
||||
(alias
|
||||
(name default)
|
||||
(action (echo "%{read:lib.install}")))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.2)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
Private modules are not excluded from the install file, but installed in the
|
||||
.private subdir
|
||||
|
||||
$ dune build | grep -i priv
|
||||
"_build/install/default/lib/lib/.private/lib__Priv.cmi" {".private/lib__Priv.cmi"}
|
||||
"_build/install/default/lib/lib/.private/lib__Priv.cmt" {".private/lib__Priv.cmt"}
|
||||
"_build/install/default/lib/lib/foo/.private/priv2.cmi" {"foo/.private/priv2.cmi"}
|
||||
"_build/install/default/lib/lib/foo/.private/priv2.cmt" {"foo/.private/priv2.cmt"}
|
||||
"_build/install/default/lib/lib/foo/priv2.cmx" {"foo/priv2.cmx"}
|
||||
"_build/install/default/lib/lib/foo/priv2.ml" {"foo/priv2.ml"}
|
||||
"_build/install/default/lib/lib/lib__Priv.cmx"
|
||||
"_build/install/default/lib/lib/priv.ml"
|
||||
Loading…
Add table
Add a link
Reference in a new issue