Get rid of compatibility symlinks for Dune directories

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jeremie Dimino 2018-06-12 18:47:30 +01:00 committed by Jérémie Dimino
parent 6abe76c4e7
commit de26077d28
5 changed files with 22 additions and 8 deletions

View File

@ -37,6 +37,7 @@ type t =
{ super_context : Super_context.t { super_context : Super_context.t
; scope : Scope.t ; scope : Scope.t
; dir : Path.t ; dir : Path.t
; dir_kind : File_tree.Dune_file.Kind.t
; obj_dir : Path.t ; obj_dir : Path.t
; modules : Module.t Module.Name.Map.t ; modules : Module.t Module.Name.Map.t
; alias_module : Module.t option ; alias_module : Module.t option
@ -50,6 +51,7 @@ type t =
let super_context t = t.super_context let super_context t = t.super_context
let scope t = t.scope let scope t = t.scope
let dir t = t.dir let dir t = t.dir
let dir_kind t = t.dir_kind
let obj_dir t = t.obj_dir let obj_dir t = t.obj_dir
let modules t = t.modules let modules t = t.modules
let alias_module t = t.alias_module let alias_module t = t.alias_module
@ -59,12 +61,13 @@ let requires t = t.requires
let includes t = t.includes let includes t = t.includes
let preprocessing t = t.preprocessing let preprocessing t = t.preprocessing
let create ~super_context ~scope ~dir ?(obj_dir=dir) ~modules ?alias_module let create ~super_context ~scope ~dir ?(dir_kind=File_tree.Dune_file.Kind.Dune)
?lib_interface_module ~flags ~requires ?(obj_dir=dir) ~modules ?alias_module ?lib_interface_module ~flags
?(preprocessing=Preprocessing.dummy) () = ~requires ?(preprocessing=Preprocessing.dummy) () =
{ super_context { super_context
; scope ; scope
; dir ; dir
; dir_kind
; obj_dir ; obj_dir
; modules ; modules
; alias_module ; alias_module

View File

@ -16,6 +16,7 @@ val create
: super_context : Super_context.t : super_context : Super_context.t
-> scope : Scope.t -> scope : Scope.t
-> dir : Path.t -> dir : Path.t
-> ?dir_kind : File_tree.Dune_file.Kind.t
-> ?obj_dir : Path.t -> ?obj_dir : Path.t
-> modules : Module.t Module.Name.Map.t -> modules : Module.t Module.Name.Map.t
-> ?alias_module : Module.t -> ?alias_module : Module.t
@ -32,6 +33,7 @@ val for_alias_module : t -> t
val super_context : t -> Super_context.t val super_context : t -> Super_context.t
val scope : t -> Scope.t val scope : t -> Scope.t
val dir : t -> Path.t val dir : t -> Path.t
val dir_kind : t -> File_tree.Dune_file.Kind.t
val obj_dir : t -> Path.t val obj_dir : t -> Path.t
val modules : t -> Module.t Module.Name.Map.t val modules : t -> Module.t Module.Name.Map.t
val alias_module : t -> Module.t option val alias_module : t -> Module.t option

View File

@ -569,6 +569,7 @@ module Gen(P : Install_rules.Params) = struct
~super_context:sctx ~super_context:sctx
~scope ~scope
~dir ~dir
~dir_kind
~obj_dir ~obj_dir
~modules ~modules
?alias_module ?alias_module
@ -874,6 +875,7 @@ module Gen(P : Install_rules.Params) = struct
~super_context:sctx ~super_context:sctx
~scope ~scope
~dir ~dir
~dir_kind
~obj_dir ~obj_dir
~modules ~modules
~flags ~flags

View File

@ -74,7 +74,7 @@ let build_cm cctx ?sandbox ?(dynlink=true) ~dep_graphs ~cm_kind (m : Module.t) =
(fn :: other_targets, A "-bin-annot") (fn :: other_targets, A "-bin-annot")
in in
let hidden_targets = List.map other_targets ~f:(Target.file obj_dir) in let hidden_targets = List.map other_targets ~f:(Target.file obj_dir) in
if obj_dir <> dir then begin if CC.dir_kind cctx = Jbuild && obj_dir <> dir then begin
(* Symlink the object files in the original directory for (* Symlink the object files in the original directory for
backward compatibility *) backward compatibility *)
let old_dst = Module.cm_file_unsafe m ~obj_dir:dir cm_kind in let old_dst = Module.cm_file_unsafe m ~obj_dir:dir cm_kind in

View File

@ -8,10 +8,17 @@
each module cannot appear in more than one "modules" field - it must belong each module cannot appear in more than one "modules" field - it must belong
to a single library or executable. to a single library or executable.
This warning will become an error in the future. This warning will become an error in the future.
Multiple rules generated for _build/default/lib$ext_obj: ocamldep lib.ml.d
- <internal location> ocamlc .lib.objs/lib.{cmi,cmo,cmt}
- <internal location> ocamlopt .lib.objs/lib.{cmx,o}
[1] ocamlopt lib.{a,cmxa}
ocamldep test.ml.d
ocamlc .test.eobjs/lib.{cmi,cmo,cmt}
ocamlopt .test.eobjs/lib.{cmx,o}
ocamlc .test.eobjs/test.{cmi,cmo,cmt}
ocamlopt .test.eobjs/test.{cmx,o}
ocamlopt test.exe
foo bar
$ dune build src/a.cma --debug-dep --display short $ dune build src/a.cma --debug-dep --display short
File "src/dune", line 1, characters 0-0: File "src/dune", line 1, characters 0-0: