Skip to content

Commit 8bd625a

Browse files
authored
provide make-world option (#1053)
1 parent bd6a244 commit 8bd625a

25 files changed

+1824
-1329
lines changed

jscomp/Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ CORE_CMXS=$(addprefix core/, $(addsuffix .cmx, $(CORE_SRCS)))
227227
OTHER_CORE_SRCS= bsppx_main bspack_main jsoo_main bspp_main js_cmi_datasets \
228228
js_main
229229
OTHER_CORE_CMXS= $(addprefix core/, $(addsuffix .cmx, $(OTHER_CORE_SRCS)))
230-
BSB_SRCS= bsb_config bsb_build_schemas bsb_build_util bsb_dep_infos bsb_dir bsb_ninja bsb_build_ui bsb_default bsb_gen
230+
BSB_SRCS= bsb_config bsb_build_schemas bsb_build_util \
231+
bsb_dep_infos bsb_dir bsb_ninja \
232+
bsb_build_ui bsb_default bsb_gen\
233+
bsb_unix
231234

232235
BSB_CMXS=$(addprefix bsb/, $(addsuffix .cmx, $(BSB_SRCS)))
233236
MAIN_SRCS= jsgen_main jscmj_main bsb/bsb_main bsb/bsb_helper_main

jscomp/all.depend

+7-5
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,8 @@ ounit_tests/ounit_tests_main.cmx : ext/resize_array.cmx \
617617
ounit_tests/ounit_array_tests.cmx ounit/oUnit.cmx \
618618
ounit_tests/ounit_tests_main.cmi
619619
bsb/bsb_build_schemas.cmx :
620-
bsb/bsb_build_ui.cmx : ext/string_set.cmx ext/string_map.cmx \
621-
ext/resize_array.cmx ext/ext_string.cmx ext/ext_json.cmx \
620+
bsb/bsb_build_ui.cmx : ext/string_vec.cmx ext/string_set.cmx \
621+
ext/string_map.cmx ext/ext_string.cmx ext/ext_json.cmx \
622622
ext/ext_filename.cmx ext/ext_file_pp.cmx bsb/bsb_dir.cmx \
623623
bsb/bsb_build_util.cmx bsb/bsb_build_schemas.cmx common/binary_cache.cmx \
624624
bsb/bsb_build_ui.cmi
@@ -628,8 +628,8 @@ bsb/bsb_build_util.cmx : ext/ext_string.cmx ext/ext_list.cmx \
628628
bsb/bsb_config.cmx : common/js_config.cmx ext/ext_filename.cmx \
629629
bsb/bsb_config.cmi
630630
bsb/bsb_default.cmx : ext/string_set.cmx ext/literals.cmx ext/ext_string.cmx \
631-
ext/ext_filename.cmx bsb/bsb_build_util.cmx common/bs_pkg.cmx \
632-
bsb/bsb_default.cmi
631+
ext/ext_json.cmx ext/ext_filename.cmx bsb/bsb_build_util.cmx \
632+
bsb/bsb_build_schemas.cmx common/bs_pkg.cmx bsb/bsb_default.cmi
633633
bsb/bsb_dep_infos.cmx : bsb/bsb_dep_infos.cmi
634634
bsb/bsb_dir.cmx : bsb/bsb_dir.cmi
635635
bsb/bsb_gen.cmx : ext/string_map.cmx ext/literals.cmx ext/ext_filename.cmx \
@@ -639,12 +639,13 @@ bsb/bsb_helper_main.cmx : depends/depends_post_process.cmx \
639639
bsb/bsb_helper_main.cmi
640640
bsb/bsb_main.cmx : ext/string_vec.cmx ext/literals.cmx ext/ext_string.cmx \
641641
ext/ext_json.cmx ext/ext_filename.cmx ext/ext_file_pp.cmx \
642-
ext/ext_array.cmx bsb/bsb_gen.cmx bsb/bsb_dep_infos.cmx \
642+
ext/ext_array.cmx bsb/bsb_unix.cmx bsb/bsb_gen.cmx bsb/bsb_dep_infos.cmx \
643643
bsb/bsb_default.cmx bsb/bsb_config.cmx bsb/bsb_build_util.cmx \
644644
bsb/bsb_build_ui.cmx bsb/bsb_build_schemas.cmx bsb/bsb_main.cmi
645645
bsb/bsb_ninja.cmx : ext/string_set.cmx ext/string_map.cmx ext/literals.cmx \
646646
ext/ext_filename.cmx bsb/bsb_config.cmx bsb/bsb_build_util.cmx \
647647
bsb/bsb_build_ui.cmx common/binary_cache.cmx bsb/bsb_ninja.cmi
648+
bsb/bsb_unix.cmx : bsb/bsb_unix.cmi
648649
bsb/bsb_build_ui.cmi : ext/string_set.cmi ext/string_map.cmi \
649650
ext/ext_json.cmi ext/ext_file_pp.cmi common/binary_cache.cmi
650651
bsb/bsb_build_util.cmi : ext/ext_json.cmi
@@ -656,6 +657,7 @@ bsb/bsb_gen.cmi : bsb/bsb_default.cmi bsb/bsb_build_ui.cmi
656657
bsb/bsb_helper_main.cmi :
657658
bsb/bsb_main.cmi :
658659
bsb/bsb_ninja.cmi : bsb/bsb_default.cmi bsb/bsb_build_ui.cmi
660+
bsb/bsb_unix.cmi :
659661
jscmj_main.cmx : common/js_config.cmx core/js_cmj_format.cmx \
660662
ext/ext_string.cmx ext/ext_pp.cmx ext/ext_pervasives.cmx \
661663
ext/ext_array.cmx jscmj_main.cmi

jscomp/bin/all_ounit_tests.i.ml

+15-7
Original file line numberDiff line numberDiff line change
@@ -1694,13 +1694,18 @@ val is_valid_source_name : string -> bool
16941694

16951695
val no_char : string -> char -> int -> int -> bool
16961696

1697+
16971698
val no_slash : string -> bool
16981699

16991700
(** if no conversion happens, reference equality holds *)
17001701
val replace_slash_backward : string -> string
17011702

17021703
(** if no conversion happens, reference equality holds *)
17031704
val replace_backward_slash : string -> string
1705+
1706+
val empty : string
1707+
1708+
17041709
end = struct
17051710
#1 "ext_string.ml"
17061711
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
@@ -2043,6 +2048,7 @@ let no_char x ch i len =
20432048
if i < 0 || i >= str_len || len >= str_len then (* 0 *) invalid_arg "Ext_string.no_char"
20442049
else (* 0 *) unsafe_no_char x ch i len
20452050

2051+
20462052
let no_slash x =
20472053
(* 5 *) unsafe_no_char x '/' 0 (String.length x - 1)
20482054

@@ -2062,6 +2068,9 @@ let replace_backward_slash (x : string)=
20622068
|'\\'-> (* 5 *) '/'
20632069
| x -> (* 8 *) x) x
20642070

2071+
let empty = ""
2072+
2073+
20652074
end
20662075
module Ounit_array_tests
20672076
= struct
@@ -7878,6 +7887,7 @@ get_extension "a" = ""
78787887
*)
78797888
val get_extension : string -> string
78807889

7890+
val simple_convert_node_path_to_os_path : string -> string
78817891
end = struct
78827892
#1 "ext_filename.ml"
78837893
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
@@ -8092,7 +8102,6 @@ let package_dir = lazy (find_package_json_dir (Lazy.force cwd))
80928102

80938103

80948104

8095-
80968105
let module_name_of_file file =
80978106
(* 0 *) String.capitalize
80988107
(Filename.chop_extension @@ Filename.basename file)
@@ -8200,14 +8209,13 @@ let get_extension x =
82008209
(* 0 *) let pos = Ext_string.rindex_neg x '.' in
82018210
if pos < 0 then (* 0 *) ""
82028211
else (* 0 *) Ext_string.tail_from x pos
8203-
(*
8204-
try
8205-
let pos = String.rindex x '.' in
8206-
Ext_string.tail_from x pos
8207-
with Not_found -> ""
8208-
*)
82098212

82108213

8214+
let simple_convert_node_path_to_os_path =
8215+
if Sys.unix then (* 1 *) fun x -> (* 0 *) x
8216+
else (* 0 *) if Sys.win32 || Sys.cygwin then
8217+
(* 0 *) Ext_string.replace_slash_backward
8218+
else (* 0 *) failwith ("Unknown OS : " ^ Sys.os_type)
82118219
end
82128220
module Ounit_path_tests
82138221
= struct

jscomp/bin/all_ounit_tests.ml

+15-7
Original file line numberDiff line numberDiff line change
@@ -1694,13 +1694,18 @@ val is_valid_source_name : string -> bool
16941694

16951695
val no_char : string -> char -> int -> int -> bool
16961696

1697+
16971698
val no_slash : string -> bool
16981699

16991700
(** if no conversion happens, reference equality holds *)
17001701
val replace_slash_backward : string -> string
17011702

17021703
(** if no conversion happens, reference equality holds *)
17031704
val replace_backward_slash : string -> string
1705+
1706+
val empty : string
1707+
1708+
17041709
end = struct
17051710
#1 "ext_string.ml"
17061711
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
@@ -2043,6 +2048,7 @@ let no_char x ch i len =
20432048
if i < 0 || i >= str_len || len >= str_len then invalid_arg "Ext_string.no_char"
20442049
else unsafe_no_char x ch i len
20452050

2051+
20462052
let no_slash x =
20472053
unsafe_no_char x '/' 0 (String.length x - 1)
20482054

@@ -2062,6 +2068,9 @@ let replace_backward_slash (x : string)=
20622068
|'\\'-> '/'
20632069
| x -> x) x
20642070

2071+
let empty = ""
2072+
2073+
20652074
end
20662075
module Ounit_array_tests
20672076
= struct
@@ -7878,6 +7887,7 @@ get_extension "a" = ""
78787887
*)
78797888
val get_extension : string -> string
78807889

7890+
val simple_convert_node_path_to_os_path : string -> string
78817891
end = struct
78827892
#1 "ext_filename.ml"
78837893
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
@@ -8092,7 +8102,6 @@ let package_dir = lazy (find_package_json_dir (Lazy.force cwd))
80928102

80938103

80948104

8095-
80968105
let module_name_of_file file =
80978106
String.capitalize
80988107
(Filename.chop_extension @@ Filename.basename file)
@@ -8200,14 +8209,13 @@ let get_extension x =
82008209
let pos = Ext_string.rindex_neg x '.' in
82018210
if pos < 0 then ""
82028211
else Ext_string.tail_from x pos
8203-
(*
8204-
try
8205-
let pos = String.rindex x '.' in
8206-
Ext_string.tail_from x pos
8207-
with Not_found -> ""
8208-
*)
82098212

82108213

8214+
let simple_convert_node_path_to_os_path =
8215+
if Sys.unix then fun x -> x
8216+
else if Sys.win32 || Sys.cygwin then
8217+
Ext_string.replace_slash_backward
8218+
else failwith ("Unknown OS : " ^ Sys.os_type)
82118219
end
82128220
module Ounit_path_tests
82138221
= struct

jscomp/bin/bsb.d

+7-5
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ bin/bsb.ml : bsb/bsb_dir.ml
3030
bin/bsb.ml : bsb/bsb_dir.mli
3131
bin/bsb.ml : ext/ext_file_pp.ml
3232
bin/bsb.ml : ext/ext_file_pp.mli
33-
bin/bsb.ml : ext/vec_gen.ml
34-
bin/bsb.ml : ext/resize_array.ml
35-
bin/bsb.ml : ext/resize_array.mli
3633
bin/bsb.ml : ext/set_gen.ml
3734
bin/bsb.ml : ext/string_set.ml
3835
bin/bsb.ml : ext/string_set.mli
36+
bin/bsb.ml : ext/vec_gen.ml
37+
bin/bsb.ml : ext/resize_array.ml
38+
bin/bsb.ml : ext/resize_array.mli
39+
bin/bsb.ml : ext/string_vec.ml
40+
bin/bsb.ml : ext/string_vec.mli
3941
bin/bsb.ml : bsb/bsb_build_ui.ml
4042
bin/bsb.ml : bsb/bsb_build_ui.mli
4143
bin/bsb.ml : ext/ext_sys.ml
@@ -50,7 +52,7 @@ bin/bsb.ml : bsb/bsb_ninja.ml
5052
bin/bsb.ml : bsb/bsb_ninja.mli
5153
bin/bsb.ml : bsb/bsb_gen.ml
5254
bin/bsb.ml : bsb/bsb_gen.mli
53-
bin/bsb.ml : ext/string_vec.ml
54-
bin/bsb.ml : ext/string_vec.mli
55+
bin/bsb.ml : bsb/bsb_unix.ml
56+
bin/bsb.ml : bsb/bsb_unix.mli
5557
bin/bsb.ml : bsb/bsb_main.ml
5658
bin/bsb.ml : bsb/bsb_main.mli

0 commit comments

Comments
 (0)