Skip to content

Commit

Permalink
sandbox root module
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Nov 16, 2020
1 parent d21d8a9 commit d7356c0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/dune_rules/module_compilation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ let build_cm cctx ~dep_graphs ~precompiled_cmi ~cm_kind (m : Module.t) ~phase =
let stdlib = CC.stdlib cctx in
let mode = Mode.of_cm_kind cm_kind in
let dynlink = CC.dynlink cctx in
let sandbox = CC.sandbox cctx in
let sandbox =
let default = CC.sandbox cctx in
match Module.kind m with
| Root -> Sandbox_config.needs_sandboxing
| _ -> default
in
(let open Option.O in
let* compiler = Result.to_option (Context.compiler ctx mode) in
let ml_kind = Cm_kind.source cm_kind in
Expand Down Expand Up @@ -165,12 +170,9 @@ let build_cm cctx ~dep_graphs ~precompiled_cmi ~cm_kind (m : Module.t) ~phase =
in
let modules = Compilation_context.modules cctx in
let obj_dirs =
match Module.kind m with
| Root -> []
| _ ->
Obj_dir.all_obj_dirs obj_dir ~mode
|> List.concat_map ~f:(fun p ->
[ Command.Args.A "-I"; Path (Path.build p) ])
Obj_dir.all_obj_dirs obj_dir ~mode
|> List.concat_map ~f:(fun p ->
[ Command.Args.A "-I"; Path (Path.build p) ])
in
SC.add_rule sctx ~sandbox ~dir
(let open Build.With_targets.O in
Expand Down

0 comments on commit d7356c0

Please sign in to comment.