Skip to content

Commit

Permalink
Compile stubs for @check (#2530)
Browse files Browse the repository at this point in the history
Compile stubs for @check
  • Loading branch information
rgrinberg authored Aug 9, 2019
2 parents 54359d8 + a44dba5 commit fe4dda9
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
presence of directories with only sub-directories and no files
(#2514, fixes #2499, @diml)

- Include building stubs in `@check` rules. (@rgrinberg, #2530)

1.11.0 (23/07/2019)
-------------------

Expand Down
6 changes: 6 additions & 0 deletions src/check_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ let add_obj_dir sctx ~obj_dir =
(Alias.check ~dir:(Obj_dir.dir obj_dir))
~dyn_deps
Path.Set.empty

let add_files sctx ~dir files =
if (Super_context.context sctx).merlin then
let alias = Alias.check ~dir in
let files = Path.Set.of_list files in
Rules.Produce.Alias.add_deps alias files
6 changes: 6 additions & 0 deletions src/check_rules.mli
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
open Stdune

val add_obj_dir : Super_context.t -> obj_dir:Path.Build.t Obj_dir.t -> unit

val add_files
: Super_context.t
-> dir:Path.Build.t
-> Path.t list
-> unit
1 change: 1 addition & 0 deletions src/lib_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ let build_stubs lib ~sctx ~dir ~expander ~requires ~dir_contents
else
[]
in
Check_rules.add_files sctx ~dir lib_o_files;
match vlib_stubs_o_files @ lib_o_files with
| [] -> ()
| o_files -> build_self_stubs lib ~sctx ~dir ~expander ~o_files
Expand Down
3 changes: 3 additions & 0 deletions test/blackbox-tests/test-cases/check-alias/lib/bar.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int bla () {
return 0;
}
3 changes: 2 additions & 1 deletion test/blackbox-tests/test-cases/check-alias/lib/dune
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
(library
(name foo))
(name foo)
(c_names bar))
1 change: 1 addition & 0 deletions test/blackbox-tests/test-cases/check-alias/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

$ dune build --root lib @check --display short && ls lib/.merlin
Entering directory 'lib'
ocamlc bar$ext_obj
ocamldep .foo.objs/foo.ml.d
ocamlc .foo.objs/byte/foo.{cmi,cmo,cmt}
lib/.merlin

0 comments on commit fe4dda9

Please sign in to comment.