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,9 @@
(library
(name privatelib)
(modules privatelib))
(executable
(name publicbin)
(modules publicbin)
(public_name publicbin)
(package publicbin))

View file

@ -0,0 +1,2 @@
However, public binaries may accept private dependencies
$ dune exec ./publicbin.exe

View file

@ -0,0 +1,10 @@
(library
(name privatelib)
(modules privatelib))
(library
(name publiclib)
(public_name publiclib)
(modules publiclib)
(libraries privatelib)
(optional))

View file

@ -0,0 +1,2 @@
Private dependencies shouldn't make the library optional
$ dune build @install

View file

@ -0,0 +1,9 @@
(library
(name privatelib)
(modules privatelib))
(library
(name publiclib)
(public_name publiclib)
(libraries privatelib)
(modules publiclib))

View file

@ -0,0 +1,9 @@
public libraries may not have private dependencies
$ dune build
File "dune", line 8, characters 12-22:
8 | (libraries privatelib)
^^^^^^^^^^
Error: Library "privatelib" is private, it cannot be a dependency of a public
library. You need to give "privatelib" a public name.
[1]

View file

@ -0,0 +1,12 @@
(library
(name ppx_internal)
(modules :standard \ mylib)
(kind ppx_rewriter)
(libraries ppxlib))
(library
(name mylib)
(public_name mylib)
(preprocess
(pps ppx_internal))
(modules mylib))

View file

@ -0,0 +1,2 @@
On the other hand, public libraries may have private preprocessors
$ dune build mylib.cma

View file

@ -0,0 +1,17 @@
(library
(name private_runtime_dep)
(modules private_runtime_dep))
(library
(name private_ppx)
(kind ppx_rewriter)
(ppx_runtime_libraries private_runtime_dep)
(modules :standard \ mylib private_runtime_dep)
(libraries ppxlib))
(library
(name mylib)
(public_name mylib)
(preprocess
(pps private_ppx))
(modules mylib))

View file

@ -0,0 +1,8 @@
Unless they introduce private runtime dependencies:
$ dune build
File "dune", line 16, characters 7-18:
16 | (pps private_ppx))
^^^^^^^^^^^
Error: Library "private_runtime_dep" is private, it cannot be a dependency of
a public library. You need to give "private_runtime_dep" a public name.
[1]