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,3 @@
(executable
(name main)
(libraries otherlib vendored_lib pmodlib))

View file

@ -0,0 +1,3 @@
(lang dune 3.5)
(implicit_transitive_deps false)

View file

@ -0,0 +1,3 @@
(library
(name otherlib)
(libraries imp_lib))

View file

@ -0,0 +1,6 @@
type u = Imp_lib.t
let fromotherlib = 36
let do_something () = ignore fromotherlib
include Imp_lib

View file

@ -0,0 +1,6 @@
val do_something : unit -> unit
val fromotherlib : int
include (module type of Imp_lib)
type u = Imp_lib.t

View file

@ -0,0 +1,3 @@
print_int Othermod.(other + Otherlib.fromotherlib + Otherlib.imp_x);;
print_int Vendored_lib.value;;
print_int Pmodlib.x;;

View file

@ -0,0 +1,2 @@
let y = 36
let other = 42 + y

View file

@ -0,0 +1,3 @@
(library
(name pmodlib)
(private_modules pmod ))

View file

@ -0,0 +1,39 @@
$ mkdir bin
$ cp $(which ocaml_index) bin/ocaml-index
$ export PATH=bin:$PATH
$ dune exec ./main.exe
1564242
The @check alias does not build indexes:
(it might at some point if the process becomes fast-enough)
$ dune build @check
$ find . -name '*.ocaml-index' | sort
The @ocaml-index indexes the entire workspace, including librairies that might
not be directly used and thus usually not built by @check:
$ dune build @ocaml-index
$ find . -name '*.ocaml-index' | sort
./_build/default/.main.eobjs/cctx.ocaml-index
./_build/default/implicit-lib/.imp_lib.objs/cctx.ocaml-index
./_build/default/lib/.otherlib.objs/cctx.ocaml-index
./_build/default/private-module/.pmodlib.objs/cctx.ocaml-index
./_build/default/sub-project/.subprojectlib.objs/cctx.ocaml-index
./_build/default/vendor/otherproject/.private_lib.objs/cctx.ocaml-index
./_build/default/vendor/otherproject/.vendored_lib.objs/cctx.ocaml-index
$ FILE=$PWD/main.ml
$ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin |
> sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep ":INDEX?"
?:INDEX?:$TESTCASE_ROOT/_build/default/.main.eobjs/cctx.ocaml-index)
?:INDEX?:$TESTCASE_ROOT/_build/default/implicit-lib/.imp_lib.objs/cctx.ocaml-index)
?:INDEX?:$TESTCASE_ROOT/_build/default/lib/.otherlib.objs/cctx.ocaml-index)
?:INDEX?:$TESTCASE_ROOT/_build/default/private-module/.pmodlib.objs/cctx.ocaml-index)
?:INDEX?:$TESTCASE_ROOT/_build/default/sub-project/.subprojectlib.objs/cctx.ocaml-index)
?:INDEX?:$TESTCASE_ROOT/_build/default/vendor/otherproject/.private_lib.objs/cctx.ocaml-index)
?:INDEX?:$TESTCASE_ROOT/_build/default/vendor/otherproject/.vendored_lib.objs/cctx.ocaml-index)

View file

@ -0,0 +1,3 @@
(library
(name subprojectlib)
(public_name subprojectlib))

View file

@ -0,0 +1,2 @@
let subproject_value = 42
let () = print_int subproject_value

View file

@ -0,0 +1,8 @@
(library
(name vendored_lib)
(public_name vendored_lib)
(modules vendored_lib))
(library
(name private_lib) ; This private lib is not built when vendored
(modules private_lib))