Skip to content

Commit ac4d022

Browse files
committed
windows support
1 parent 4908a70 commit ac4d022

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

jscomp/bsb/bsb_ninja_gen.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ let output_installation_file cwd_lib_bs namespace files_to_install =
108108
let bs = ".."//"bs" in
109109
let sb = ".."//".." in
110110
o (if Ext_sys.is_windows_or_cygwin then
111-
"rule cp\n command = cmd.exe /C copy /Y $i $out >NUL\n"
111+
"rule cp\n command = cmd.exe /C copy /Y $i $out >NUL\n\
112+
rule touch\n command = cmd.exe /C type nul >>$out & copy $out+,, >NUL\n"
112113
else
113114
"rule cp\n command = cp $i $out\n\
114115
rule touch\n command = touch $out\n"

lib/4.06.1/bsb.ml

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13627,7 +13627,8 @@ let output_installation_file cwd_lib_bs namespace files_to_install =
1362713627
let bs = ".."//"bs" in
1362813628
let sb = ".."//".." in
1362913629
o (if Ext_sys.is_windows_or_cygwin then
13630-
"rule cp\n command = cmd.exe /C copy /Y $i $out >NUL\n"
13630+
"rule cp\n command = cmd.exe /C copy /Y $i $out >NUL\n\
13631+
rule touch\n command = cmd.exe /C type nul >>$out & copy $out+,, >NUL\n"
1363113632
else
1363213633
"rule cp\n command = cp $i $out\n\
1363313634
rule touch\n command = touch $out\n"
@@ -13636,17 +13637,18 @@ let output_installation_file cwd_lib_bs namespace files_to_install =
1363613637
files_to_install
1363713638
|> Queue.iter (fun ({name_sans_extension;syntax_kind; info} : Bsb_db.module_info) ->
1363813639
let base = Filename.basename name_sans_extension in
13639-
let ns_base = Ext_namespace_encode.make ?ns:namespace base in
13640+
let dest = Ext_namespace_encode.make ?ns:namespace base in
1364013641
let ns_origin = Ext_namespace_encode.make ?ns:namespace name_sans_extension in
13641-
oo Literals.suffix_cmi ~dest:ns_base ~src:(bs//ns_origin);
13642-
oo Literals.suffix_cmj ~dest:ns_base ~src:(bs//ns_origin);
13643-
oo Literals.suffix_cmt ~dest:ns_base ~src:(bs//ns_origin);
13644-
Ext_buffer.add_string essentials ns_base ;
13645-
Ext_buffer.add_string essentials Literals.suffix_cmi;
13646-
Ext_buffer.add_string essentials " ";
13647-
Ext_buffer.add_string essentials ns_base ;
13648-
Ext_buffer.add_string essentials Literals.suffix_cmj;
13649-
Ext_buffer.add_string essentials " ";
13642+
let src = bs//ns_origin in
13643+
oo Literals.suffix_cmi ~dest ~src;
13644+
oo Literals.suffix_cmj ~dest ~src;
13645+
oo Literals.suffix_cmt ~dest ~src;
13646+
13647+
Ext_buffer.add_string essentials dest ;
13648+
Ext_buffer.add_string_char essentials Literals.suffix_cmi ' ';
13649+
Ext_buffer.add_string essentials dest ;
13650+
Ext_buffer.add_string_char essentials Literals.suffix_cmj ' ';
13651+
1365013652
let suffix =
1365113653
match syntax_kind with
1365213654
| Ml -> Literals.suffix_ml
@@ -13663,22 +13665,21 @@ let output_installation_file cwd_lib_bs namespace files_to_install =
1366313665
| Reason -> Literals.suffix_rei
1366413666
| Res -> Literals.suffix_resi in
1366513667
oo suffix_b ~dest:base ~src:(sb//name_sans_extension);
13666-
oo Literals.suffix_cmti ~dest:ns_base ~src:(bs//ns_origin)
13668+
oo Literals.suffix_cmti ~dest ~src
1366713669
);
1366813670
begin match namespace with
1366913671
| None -> ()
13670-
| Some x ->
13671-
let src = bs // x in
13672-
oo Literals.suffix_cmi ~dest:x ~src;
13673-
oo Literals.suffix_cmj ~dest:x ~src;
13674-
oo Literals.suffix_cmt ~dest:x ~src;
13675-
Ext_buffer.add_string essentials x ;
13676-
Ext_buffer.add_string essentials Literals.suffix_cmi;
13677-
Ext_buffer.add_string essentials " ";
13678-
Ext_buffer.add_string essentials x ;
13679-
Ext_buffer.add_string essentials Literals.suffix_cmj;
13672+
| Some dest ->
13673+
let src = bs // dest in
13674+
oo Literals.suffix_cmi ~dest ~src;
13675+
oo Literals.suffix_cmj ~dest ~src;
13676+
oo Literals.suffix_cmt ~dest ~src;
13677+
Ext_buffer.add_string essentials dest ;
13678+
Ext_buffer.add_string_char essentials Literals.suffix_cmi ' ';
13679+
Ext_buffer.add_string essentials dest ;
13680+
Ext_buffer.add_string essentials Literals.suffix_cmj
1368013681
end;
13681-
Ext_buffer.add_string essentials "\n";
13682+
Ext_buffer.add_char essentials '\n';
1368213683
o "build install.stamp : touch ";
1368313684
Ext_buffer.output_buffer install_oc essentials;
1368413685
close_out install_oc

0 commit comments

Comments
 (0)