Skip to content

Commit a576521

Browse files
authored
Merge pull request #4847 from rescript-lang/install_fix_for_windows
work around windows path escaping rules
2 parents 2a2cb27 + e885c10 commit a576521

File tree

15 files changed

+65
-61
lines changed

15 files changed

+65
-61
lines changed

darwin/ninja.exe

0 Bytes
Binary file not shown.

jscomp/bsb/bsb_ninja_gen.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,6 @@ let output_ninja_and_namespace_map
179179

180180
let warnings = Bsb_warning.to_bsb_string ~package_kind warning in
181181
let bsc_flags = (get_bsc_flags bsc_flags) in
182-
let bsc_path = (Ext_filename.maybe_quote Bsb_global_paths.vendor_bsc) in
183-
let bs_dep = (Ext_filename.maybe_quote Bsb_global_paths.vendor_bsdep) in
184182
let dpkg_incls = (Bsb_build_util.include_dirs_by
185183
bs_dev_dependencies
186184
(fun x -> x.package_install_path)) in
@@ -228,27 +226,29 @@ let output_ninja_and_namespace_map
228226
~namespace
229227
~digest
230228
~package_name
231-
~bsc:bsc_path
232-
~warnings
233-
~bs_dep
229+
~warnings
234230
~ppx_files
235231
~bsc_flags
236232
~dpkg_incls (* dev dependencies *)
237233
~lib_incls (* its own libs *)
238234
~dev_incls (* its own devs *)
235+
~bs_dependencies
236+
~bs_dev_dependencies
239237
generators in
240238

241239
let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in
242240
mark_rescript oc;
243241
let finger_file =
244242
fun (x : Bsb_config_types.dependency) -> x.package_install_path //".ninja_log"
245243
in
246-
Bsb_ninja_targets.output_finger
247-
Bsb_ninja_global_vars.g_finger
248-
(String.concat " "
249-
(Ext_list.map_append bs_dependencies
250-
(Ext_list.map bs_dev_dependencies finger_file) finger_file))
251-
oc ;
244+
Ext_list.iter bs_dependencies (fun x ->
245+
Bsb_ninja_targets.output_finger Bsb_ninja_global_vars.g_finger
246+
(finger_file x) oc
247+
);
248+
Ext_list.iter bs_dev_dependencies (fun x ->
249+
Bsb_ninja_targets.output_finger Bsb_ninja_global_vars.g_finger
250+
(finger_file x) oc
251+
);
252252
(match gentype_config with
253253
| None -> ()
254254
| Some x -> output_string oc ("cleaner = " ^ x.path ^ "\n"));

jscomp/bsb/bsb_ninja_rule.ml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,18 @@ let make_custom_rules
123123
~(package_specs: Bsb_package_specs.t)
124124
~(namespace : string option)
125125
~package_name
126-
~bsc
127-
~warnings
128-
~(bs_dep : string)
126+
~warnings
129127
~(ppx_files : Bsb_config_types.ppx list)
130128
~bsc_flags
131129
~(dpkg_incls : string)
132130
~(lib_incls : string)
133131
~(dev_incls : string)
132+
~bs_dependencies
133+
~bs_dev_dependencies
134134
(custom_rules : command Map_string.t) :
135135
builtin =
136+
let bs_dep = Ext_filename.maybe_quote Bsb_global_paths.vendor_bsdep in
137+
let bsc = Ext_filename.maybe_quote Bsb_global_paths.vendor_bsc in
136138
(** FIXME: We don't need set [-o ${out}] when building ast
137139
since the default is already good -- it does not*)
138140
let buf = Ext_buffer.create 100 in
@@ -172,8 +174,12 @@ let make_custom_rules
172174
Ext_buffer.add_string buf package_name;
173175
Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs "$in_d")
174176
end;
175-
Ext_buffer.add_string buf " -bs-v ";
176-
Ext_buffer.add_ninja_prefix_var buf '-' Bsb_ninja_global_vars.g_finger;
177+
begin match bs_dependencies, bs_dev_dependencies with
178+
| [], [] -> ()
179+
| _, _ ->
180+
Ext_buffer.add_string buf " -bs-v";
181+
Ext_buffer.add_ninja_prefix_var buf Bsb_ninja_global_vars.g_finger;
182+
end;
177183
Ext_buffer.add_string buf " $i";
178184
begin match postbuild with
179185
| None -> ()

jscomp/bsb/bsb_ninja_rule.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ val make_custom_rules :
7979
package_specs:Bsb_package_specs.t ->
8080
namespace:string option ->
8181
package_name:string ->
82-
bsc:string ->
8382
warnings:string ->
84-
bs_dep:string ->
8583
ppx_files:Bsb_config_types.ppx list ->
8684
bsc_flags:string ->
8785
dpkg_incls:string ->
8886
lib_incls:string ->
8987
dev_incls:string ->
88+
bs_dependencies:Bsb_config_types.dependencies ->
89+
bs_dev_dependencies:Bsb_config_types.dependencies ->
9090
command Map_string.t ->
9191
builtin
9292

jscomp/ext/ext_buffer.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ let add_char_string b c s =
110110
b.position <- new_position
111111

112112
(* equivalent to add_char " "; add_char "$"; add_string s *)
113-
let add_ninja_prefix_var b char s =
113+
let add_ninja_prefix_var b s =
114114
let s_len = String.length s in
115115
let len = s_len + 2 in
116116
let new_position = b.position + len in
117117
if new_position > b.length then resize b len;
118118
let b_buffer = b.buffer in
119119
let b_position = b.position in
120-
Bytes.unsafe_set b_buffer b_position char ;
120+
Bytes.unsafe_set b_buffer b_position ' ' ;
121121
Bytes.unsafe_set b_buffer (b_position + 1) '$' ;
122122
Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len;
123123
b.position <- new_position

jscomp/ext/ext_buffer.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ val add_string_char :
111111

112112
val add_ninja_prefix_var :
113113
t ->
114-
char ->
115114
string ->
116115
unit
117116

lib/4.06.1/bsb.ml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,6 @@ val add_string_char :
648648

649649
val add_ninja_prefix_var :
650650
t ->
651-
char ->
652651
string ->
653652
unit
654653

@@ -772,14 +771,14 @@ let add_char_string b c s =
772771
b.position <- new_position
773772

774773
(* equivalent to add_char " "; add_char "$"; add_string s *)
775-
let add_ninja_prefix_var b char s =
774+
let add_ninja_prefix_var b s =
776775
let s_len = String.length s in
777776
let len = s_len + 2 in
778777
let new_position = b.position + len in
779778
if new_position > b.length then resize b len;
780779
let b_buffer = b.buffer in
781780
let b_position = b.position in
782-
Bytes.unsafe_set b_buffer b_position char ;
781+
Bytes.unsafe_set b_buffer b_position ' ' ;
783782
Bytes.unsafe_set b_buffer (b_position + 1) '$' ;
784783
Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len;
785784
b.position <- new_position
@@ -12741,14 +12740,14 @@ val make_custom_rules :
1274112740
package_specs:Bsb_package_specs.t ->
1274212741
namespace:string option ->
1274312742
package_name:string ->
12744-
bsc:string ->
1274512743
warnings:string ->
12746-
bs_dep:string ->
1274712744
ppx_files:Bsb_config_types.ppx list ->
1274812745
bsc_flags:string ->
1274912746
dpkg_incls:string ->
1275012747
lib_incls:string ->
1275112748
dev_incls:string ->
12749+
bs_dependencies:Bsb_config_types.dependencies ->
12750+
bs_dev_dependencies:Bsb_config_types.dependencies ->
1275212751
command Map_string.t ->
1275312752
builtin
1275412753

@@ -12880,16 +12879,18 @@ let make_custom_rules
1288012879
~(package_specs: Bsb_package_specs.t)
1288112880
~(namespace : string option)
1288212881
~package_name
12883-
~bsc
12884-
~warnings
12885-
~(bs_dep : string)
12882+
~warnings
1288612883
~(ppx_files : Bsb_config_types.ppx list)
1288712884
~bsc_flags
1288812885
~(dpkg_incls : string)
1288912886
~(lib_incls : string)
1289012887
~(dev_incls : string)
12888+
~bs_dependencies
12889+
~bs_dev_dependencies
1289112890
(custom_rules : command Map_string.t) :
1289212891
builtin =
12892+
let bs_dep = Ext_filename.maybe_quote Bsb_global_paths.vendor_bsdep in
12893+
let bsc = Ext_filename.maybe_quote Bsb_global_paths.vendor_bsc in
1289312894
(** FIXME: We don't need set [-o ${out}] when building ast
1289412895
since the default is already good -- it does not*)
1289512896
let buf = Ext_buffer.create 100 in
@@ -12929,8 +12930,12 @@ let make_custom_rules
1292912930
Ext_buffer.add_string buf package_name;
1293012931
Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs "$in_d")
1293112932
end;
12932-
Ext_buffer.add_string buf " -bs-v ";
12933-
Ext_buffer.add_ninja_prefix_var buf '-' Bsb_ninja_global_vars.g_finger;
12933+
begin match bs_dependencies, bs_dev_dependencies with
12934+
| [], [] -> ()
12935+
| _, _ ->
12936+
Ext_buffer.add_string buf " -bs-v";
12937+
Ext_buffer.add_ninja_prefix_var buf Bsb_ninja_global_vars.g_finger;
12938+
end;
1293412939
Ext_buffer.add_string buf " $i";
1293512940
begin match postbuild with
1293612941
| None -> ()
@@ -13682,8 +13687,6 @@ let output_ninja_and_namespace_map
1368213687

1368313688
let warnings = Bsb_warning.to_bsb_string ~package_kind warning in
1368413689
let bsc_flags = (get_bsc_flags bsc_flags) in
13685-
let bsc_path = (Ext_filename.maybe_quote Bsb_global_paths.vendor_bsc) in
13686-
let bs_dep = (Ext_filename.maybe_quote Bsb_global_paths.vendor_bsdep) in
1368713690
let dpkg_incls = (Bsb_build_util.include_dirs_by
1368813691
bs_dev_dependencies
1368913692
(fun x -> x.package_install_path)) in
@@ -13731,27 +13734,29 @@ let output_ninja_and_namespace_map
1373113734
~namespace
1373213735
~digest
1373313736
~package_name
13734-
~bsc:bsc_path
13735-
~warnings
13736-
~bs_dep
13737+
~warnings
1373713738
~ppx_files
1373813739
~bsc_flags
1373913740
~dpkg_incls (* dev dependencies *)
1374013741
~lib_incls (* its own libs *)
1374113742
~dev_incls (* its own devs *)
13743+
~bs_dependencies
13744+
~bs_dev_dependencies
1374213745
generators in
1374313746

1374413747
let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in
1374513748
mark_rescript oc;
1374613749
let finger_file =
1374713750
fun (x : Bsb_config_types.dependency) -> x.package_install_path //".ninja_log"
1374813751
in
13749-
Bsb_ninja_targets.output_finger
13750-
Bsb_ninja_global_vars.g_finger
13751-
(String.concat " "
13752-
(Ext_list.map_append bs_dependencies
13753-
(Ext_list.map bs_dev_dependencies finger_file) finger_file))
13754-
oc ;
13752+
Ext_list.iter bs_dependencies (fun x ->
13753+
Bsb_ninja_targets.output_finger Bsb_ninja_global_vars.g_finger
13754+
(finger_file x) oc
13755+
);
13756+
Ext_list.iter bs_dev_dependencies (fun x ->
13757+
Bsb_ninja_targets.output_finger Bsb_ninja_global_vars.g_finger
13758+
(finger_file x) oc
13759+
);
1375513760
(match gentype_config with
1375613761
| None -> ()
1375713762
| Some x -> output_string oc ("cleaner = " ^ x.path ^ "\n"));

lib/4.06.1/bsb_helper.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,6 @@ val add_string_char :
16671667

16681668
val add_ninja_prefix_var :
16691669
t ->
1670-
char ->
16711670
string ->
16721671
unit
16731672

@@ -1791,14 +1790,14 @@ let add_char_string b c s =
17911790
b.position <- new_position
17921791

17931792
(* equivalent to add_char " "; add_char "$"; add_string s *)
1794-
let add_ninja_prefix_var b char s =
1793+
let add_ninja_prefix_var b s =
17951794
let s_len = String.length s in
17961795
let len = s_len + 2 in
17971796
let new_position = b.position + len in
17981797
if new_position > b.length then resize b len;
17991798
let b_buffer = b.buffer in
18001799
let b_position = b.position in
1801-
Bytes.unsafe_set b_buffer b_position char ;
1800+
Bytes.unsafe_set b_buffer b_position ' ' ;
18021801
Bytes.unsafe_set b_buffer (b_position + 1) '$' ;
18031802
Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len;
18041803
b.position <- new_position

lib/4.06.1/unstable/all_ounit_tests.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6463,7 +6463,6 @@ val add_string_char :
64636463

64646464
val add_ninja_prefix_var :
64656465
t ->
6466-
char ->
64676466
string ->
64686467
unit
64696468

@@ -6587,14 +6586,14 @@ let add_char_string b c s =
65876586
b.position <- new_position
65886587

65896588
(* equivalent to add_char " "; add_char "$"; add_string s *)
6590-
let add_ninja_prefix_var b char s =
6589+
let add_ninja_prefix_var b s =
65916590
let s_len = String.length s in
65926591
let len = s_len + 2 in
65936592
let new_position = b.position + len in
65946593
if new_position > b.length then resize b len;
65956594
let b_buffer = b.buffer in
65966595
let b_position = b.position in
6597-
Bytes.unsafe_set b_buffer b_position char ;
6596+
Bytes.unsafe_set b_buffer b_position ' ' ;
65986597
Bytes.unsafe_set b_buffer (b_position + 1) '$' ;
65996598
Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len;
66006599
b.position <- new_position

lib/4.06.1/unstable/bspack.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8811,7 +8811,6 @@ val add_string_char :
88118811

88128812
val add_ninja_prefix_var :
88138813
t ->
8814-
char ->
88158814
string ->
88168815
unit
88178816

@@ -8935,14 +8934,14 @@ let add_char_string b c s =
89358934
b.position <- new_position
89368935

89378936
(* equivalent to add_char " "; add_char "$"; add_string s *)
8938-
let add_ninja_prefix_var b char s =
8937+
let add_ninja_prefix_var b s =
89398938
let s_len = String.length s in
89408939
let len = s_len + 2 in
89418940
let new_position = b.position + len in
89428941
if new_position > b.length then resize b len;
89438942
let b_buffer = b.buffer in
89448943
let b_position = b.position in
8945-
Bytes.unsafe_set b_buffer b_position char ;
8944+
Bytes.unsafe_set b_buffer b_position ' ' ;
89468945
Bytes.unsafe_set b_buffer (b_position + 1) '$' ;
89478946
Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len;
89488947
b.position <- new_position

0 commit comments

Comments
 (0)