@@ -531,6 +531,12 @@ let jsoo_archives ~mode ctx config lib =
531
531
]))
532
532
;;
533
533
534
+ let cmo_js_of_module ~mode m =
535
+ Module_name.Unique. artifact_filename
536
+ (Module. obj_name m)
537
+ ~ext: (Js_of_ocaml.Ext. cmo ~mode )
538
+ ;;
539
+
534
540
let link_rule
535
541
~mode
536
542
cc
@@ -546,11 +552,6 @@ let link_rule
546
552
=
547
553
let sctx = Compilation_context. super_context cc in
548
554
let dir = Compilation_context. dir cc in
549
- let mod_name m =
550
- Module_name.Unique. artifact_filename
551
- (Module. obj_name m)
552
- ~ext: (Js_of_ocaml.Ext. cmo ~mode )
553
- in
554
555
let ctx = Super_context. context sctx |> Context. build_context in
555
556
let get_all =
556
557
let open Action_builder.O in
@@ -576,12 +577,13 @@ let link_rule
576
577
let special_units =
577
578
List. concat_map to_link ~f: (function
578
579
| Lib_flags.Lib_and_module. Lib _lib -> []
579
- | Module (obj_dir , m ) -> [ in_obj_dir' ~obj_dir ~config: None [ mod_name m ] ])
580
+ | Module (obj_dir , m ) ->
581
+ [ in_obj_dir' ~obj_dir ~config: None [ cmo_js_of_module ~mode m ] ])
580
582
in
581
583
let all_libs = List. concat_map libs ~f: (jsoo_archives ~mode ctx config) in
582
584
let all_other_modules =
583
585
List. map cm ~f: (fun m ->
584
- Path. build (in_obj_dir ~obj_dir ~config: None [ mod_name m ]))
586
+ Path. build (in_obj_dir ~obj_dir ~config: None [ cmo_js_of_module ~mode m ]))
585
587
in
586
588
let std_exit =
587
589
Path. build
@@ -648,14 +650,15 @@ let build_cm' sctx ~dir ~in_context ~mode ~src ~target ~config ~shapes ~sourcema
648
650
~sourcemap
649
651
;;
650
652
651
- let build_cm cctx ~dir ~in_context ~mode ~src ~obj_dir ~config :config_opt =
653
+ let build_cm cctx ~dir ~in_context ~mode ~src ~obj_dir ~deps ~ config :config_opt =
652
654
let name = with_js_ext ~mode (Path. basename src) in
653
655
let target = in_obj_dir ~obj_dir ~config: config_opt [ name ] in
654
656
let sctx = Compilation_context. super_context cctx in
655
657
let ctx = Super_context. context sctx |> Context. build_context in
656
658
let shapes =
657
659
let open Action_builder.O in
658
660
let + libs = Resolve.Memo. read (Compilation_context. requires_link cctx)
661
+ and + deps = deps
659
662
and + config =
660
663
match config_opt with
661
664
| None ->
@@ -665,8 +668,10 @@ let build_cm cctx ~dir ~in_context ~mode ~src ~obj_dir ~config:config_opt =
665
668
|> Action_builder. map ~f: Config. of_flags
666
669
| Some config -> Action_builder. return config
667
670
in
668
- Path. build (in_build_dir ctx ~config [ " stdlib" ; with_js_ext ~mode " stdlib.cma" ])
669
- :: List. concat_map libs ~f: (fun lib -> jsoo_archives ~mode ctx config lib)
671
+ (Path. build (in_build_dir ctx ~config [ " stdlib" ; with_js_ext ~mode " stdlib.cma" ])
672
+ :: List. concat_map libs ~f: (fun lib -> jsoo_archives ~mode ctx config lib))
673
+ @ List. map deps ~f: (fun m ->
674
+ Path. build (in_obj_dir ~obj_dir ~config: config_opt [ cmo_js_of_module ~mode m ]))
670
675
in
671
676
build_cm'
672
677
sctx
0 commit comments