@@ -13550,6 +13550,13 @@ let output_static_resources
13550
13550
let output_installation_file cwd_lib_bs namespace files_to_install =
13551
13551
let install_oc = open_out_bin (cwd_lib_bs // "install.ninja") in
13552
13552
let o s = output_string install_oc s in
13553
+ let[@inline] oo suffix ~dest ~src =
13554
+ o "o " ;
13555
+ o dest ;
13556
+ o suffix;
13557
+ o " : cp ";
13558
+ o src;
13559
+ o suffix; o "\n" in
13553
13560
let bs = ".."//"bs" in
13554
13561
let sb = ".."//".." in
13555
13562
o "rule cp\n command = cp $i $out\n";
@@ -13558,36 +13565,34 @@ let output_installation_file cwd_lib_bs namespace files_to_install =
13558
13565
let base = Filename.basename name_sans_extension in
13559
13566
let ns_base = Ext_namespace_encode.make ?ns:namespace base in
13560
13567
let ns_origin = Ext_namespace_encode.make ?ns:namespace name_sans_extension in
13561
- let sources =
13562
- match info, syntax_kind with
13563
- | Intf , _ -> assert false
13564
- | Impl, Ml -> [".ml" ]
13565
- | Impl, Reason -> [".re" ]
13566
- | Impl, Res -> [".res" ]
13567
- | Impl_intf, Ml -> [".ml" ; ".mli"]
13568
- | Impl_intf, Reason -> [".re" ; ".rei"]
13569
- | Impl_intf, Res -> [".res" ; ".resi"]
13570
- in
13571
- let binaries =
13572
- match info with
13573
- | Intf -> assert false
13574
- | Impl -> [".cmi"; ".cmt"; ".cmj"]
13575
- | Impl_intf -> [".cmi"; ".cmt"; ".cmti" ; ".cmj"] in
13576
- (* install source files *)
13577
- Ext_list.iter sources (fun s ->
13578
- o @@ Printf.sprintf "o %s : cp %s \n" (base ^ s) (sb // name_sans_extension ^s)
13579
-
13580
- );
13581
- (* install binary artifacts *)
13582
- Ext_list.iter binaries (fun s ->
13583
- o @@ Printf.sprintf "o %s : cp %s \n" (ns_base ^ s) (bs // ns_origin ^s)
13584
- ) );
13568
+ oo Literals.suffix_cmi ~dest:ns_base ~src:(bs//ns_origin);
13569
+ oo Literals.suffix_cmj ~dest:ns_base ~src:(bs//ns_origin);
13570
+ oo Literals.suffix_cmt ~dest:ns_base ~src:(bs//ns_origin);
13571
+ let suffix =
13572
+ match syntax_kind with
13573
+ | Ml -> Literals.suffix_ml
13574
+ | Reason -> Literals.suffix_re
13575
+ | Res -> Literals.suffix_res
13576
+ in oo suffix ~dest:base ~src:(sb//name_sans_extension);
13577
+ match info with
13578
+ | Intf -> assert false
13579
+ | Impl -> ()
13580
+ | Impl_intf ->
13581
+ let suffix_b =
13582
+ match syntax_kind with
13583
+ | Ml -> Literals.suffix_mli
13584
+ | Reason -> Literals.suffix_rei
13585
+ | Res -> Literals.suffix_resi in
13586
+ oo suffix_b ~dest:base ~src:(sb//name_sans_extension);
13587
+ oo Literals.suffix_cmti ~dest:ns_base ~src:(bs//ns_origin)
13588
+ );
13585
13589
begin match namespace with
13586
13590
| None -> ()
13587
13591
| Some x ->
13588
- o @@ Printf.sprintf "o %s.cmi : cp %s.cmi\n" x (bs//x);
13589
- o @@ Printf.sprintf "o %s.cmj : cp %s.cmj\n" x (bs//x);
13590
- o @@ Printf.sprintf "o %s.cmt : cp %s.cmt\n" x (bs//x)
13592
+ let src = bs // x in
13593
+ oo Literals.suffix_cmi ~dest:x ~src;
13594
+ oo Literals.suffix_cmj ~dest:x ~src;
13595
+ oo Literals.suffix_cmt ~dest:x ~src
13591
13596
end;
13592
13597
close_out install_oc
13593
13598
0 commit comments