Skip to content

Commit c7c9325

Browse files
authored
move json to ext (#1051)
1 parent ae19d6c commit c7c9325

17 files changed

+64
-63
lines changed

Diff for: jscomp/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ EXT_SRCS = ext_util\
182182
ext_pp_scope\
183183
ext_io\
184184
ext_sexp\
185+
ext_json\
185186
ident_hash_set\
186187
hash_set_poly\
187188
ident_hashtbl\
@@ -226,7 +227,7 @@ CORE_CMXS=$(addprefix core/, $(addsuffix .cmx, $(CORE_SRCS)))
226227
OTHER_CORE_SRCS= bsppx_main bspack_main jsoo_main bspp_main js_cmi_datasets \
227228
js_main
228229
OTHER_CORE_CMXS= $(addprefix core/, $(addsuffix .cmx, $(OTHER_CORE_SRCS)))
229-
BSB_SRCS= bsb_config bsb_build_schemas bsb_build_util bsb_dep_infos bsb_dir bsb_json bsb_ninja bsb_build_ui bsb_default bsb_gen
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
230231

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

Diff for: jscomp/all.depend

+13-13
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ ext/ext_pp_scope.cmx : ext/string_map.cmx ext/int_map.cmx ext/ident_set.cmx \
6565
ext/ext_pp_scope.cmi
6666
ext/ext_io.cmx : ext/ext_pervasives.cmx ext/ext_io.cmi
6767
ext/ext_sexp.cmx : ext/ext_sexp.cmi
68+
ext/ext_json.cmx : ext/string_map.cmx ext/ext_array.cmx ext/ext_json.cmi
6869
ext/ident_hash_set.cmx : ext/hash_set_gen.cmx ext/ext_ident.cmx \
6970
stubs/bs_hash_stubs.cmx ext/ident_hash_set.cmi
7071
ext/hash_set_poly.cmx : ext/hash_set_gen.cmx ext/hash_set_poly.cmi
@@ -118,6 +119,7 @@ ext/ext_topsort.cmi : ext/vec_gen.cmx ext/set_int.cmi ext/int_vec.cmi
118119
ext/ext_pp_scope.cmi : ext/ident_set.cmi
119120
ext/ext_io.cmi :
120121
ext/ext_sexp.cmi :
122+
ext/ext_json.cmi : ext/string_map.cmi
121123
ext/ident_hash_set.cmi : ext/hash_set_gen.cmx
122124
ext/hash_set_poly.cmi :
123125
ext/ident_hashtbl.cmi : ext/hashtbl_gen.cmx
@@ -592,12 +594,12 @@ ounit_tests/ounit_scc_tests.cmx : ext/string_hashtbl.cmx ounit/oUnit.cmx \
592594
ext/int_vec_vec.cmx ext/int_vec.cmx ext/ext_string.cmx ext/ext_scc.cmx
593595
ounit_tests/ounit_hashtbl_tests.cmx : ext/string_hashtbl.cmx ounit/oUnit.cmx
594596
ounit_tests/ounit_json_tests.cmx : ext/string_map.cmx ounit/oUnit.cmx \
595-
bsb/bsb_json.cmx
597+
ext/ext_json.cmx
596598
ounit_tests/ounit_map_tests.cmx : ounit/oUnit.cmx ext/int_map.cmx
597599
ounit_tests/ounit_ordered_hash_set_tests.cmx : \
598600
ext/ordered_hash_set_string.cmx ounit/oUnit.cmx ext/ext_util.cmx
599601
ounit_tests/ounit_vec_test.cmx : ext/set_int.cmx ounit/oUnit.cmx \
600-
ext/int_vec.cmx bsb/bsb_json.cmx
602+
ext/int_vec.cmx ext/ext_json.cmx
601603
ounit_tests/ounit_string_tests.cmx : ounit/oUnit.cmx ext/ext_string.cmx
602604
ounit_tests/ounit_topsort_tests.cmx : ext/set_int.cmx ounit/oUnit.cmx \
603605
ext/int_vec.cmx ext/ext_topsort.cmx
@@ -616,12 +618,12 @@ ounit_tests/ounit_tests_main.cmx : ext/resize_array.cmx \
616618
ounit_tests/ounit_tests_main.cmi
617619
bsb/bsb_build_schemas.cmx :
618620
bsb/bsb_build_ui.cmx : ext/string_set.cmx ext/string_map.cmx \
619-
ext/resize_array.cmx ext/ext_string.cmx ext/ext_filename.cmx \
620-
ext/ext_file_pp.cmx bsb/bsb_json.cmx bsb/bsb_dir.cmx \
621+
ext/resize_array.cmx ext/ext_string.cmx ext/ext_json.cmx \
622+
ext/ext_filename.cmx ext/ext_file_pp.cmx bsb/bsb_dir.cmx \
621623
bsb/bsb_build_util.cmx bsb/bsb_build_schemas.cmx common/binary_cache.cmx \
622624
bsb/bsb_build_ui.cmi
623-
bsb/bsb_build_util.cmx : ext/ext_list.cmx ext/ext_filename.cmx \
624-
ext/ext_array.cmx bsb/bsb_json.cmx bsb/bsb_config.cmx \
625+
bsb/bsb_build_util.cmx : ext/ext_list.cmx ext/ext_json.cmx \
626+
ext/ext_filename.cmx ext/ext_array.cmx bsb/bsb_config.cmx \
625627
bsb/bsb_build_util.cmi
626628
bsb/bsb_config.cmx : common/js_config.cmx ext/ext_filename.cmx \
627629
bsb/bsb_config.cmi
@@ -635,25 +637,23 @@ bsb/bsb_gen.cmx : ext/string_map.cmx ext/literals.cmx ext/ext_filename.cmx \
635637
bsb/bsb_build_ui.cmx common/binary_cache.cmx bsb/bsb_gen.cmi
636638
bsb/bsb_helper_main.cmx : depends/depends_post_process.cmx \
637639
bsb/bsb_helper_main.cmi
638-
bsb/bsb_json.cmx : ext/string_map.cmx ext/ext_array.cmx bsb/bsb_json.cmi
639640
bsb/bsb_main.cmx : ext/string_vec.cmx ext/literals.cmx ext/ext_string.cmx \
640-
ext/ext_filename.cmx ext/ext_file_pp.cmx ext/ext_array.cmx \
641-
bsb/bsb_json.cmx bsb/bsb_gen.cmx bsb/bsb_dep_infos.cmx \
641+
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 \
642643
bsb/bsb_default.cmx bsb/bsb_config.cmx bsb/bsb_build_util.cmx \
643644
bsb/bsb_build_ui.cmx bsb/bsb_build_schemas.cmx bsb/bsb_main.cmi
644645
bsb/bsb_ninja.cmx : ext/string_set.cmx ext/string_map.cmx ext/literals.cmx \
645646
ext/ext_filename.cmx bsb/bsb_config.cmx bsb/bsb_build_util.cmx \
646647
bsb/bsb_build_ui.cmx common/binary_cache.cmx bsb/bsb_ninja.cmi
647648
bsb/bsb_build_ui.cmi : ext/string_set.cmi ext/string_map.cmi \
648-
ext/ext_file_pp.cmi bsb/bsb_json.cmi common/binary_cache.cmi
649-
bsb/bsb_build_util.cmi : bsb/bsb_json.cmi
649+
ext/ext_json.cmi ext/ext_file_pp.cmi common/binary_cache.cmi
650+
bsb/bsb_build_util.cmi : ext/ext_json.cmi
650651
bsb/bsb_config.cmi :
651-
bsb/bsb_default.cmi : ext/string_set.cmi bsb/bsb_json.cmi
652+
bsb/bsb_default.cmi : ext/string_set.cmi ext/ext_json.cmi
652653
bsb/bsb_dep_infos.cmi :
653654
bsb/bsb_dir.cmi :
654655
bsb/bsb_gen.cmi : bsb/bsb_default.cmi bsb/bsb_build_ui.cmi
655656
bsb/bsb_helper_main.cmi :
656-
bsb/bsb_json.cmi : ext/string_map.cmi
657657
bsb/bsb_main.cmi :
658658
bsb/bsb_ninja.cmi : bsb/bsb_default.cmi bsb/bsb_build_ui.cmi
659659
jscmj_main.cmx : common/js_config.cmx core/js_cmj_format.cmx \

Diff for: jscomp/bin/all_ounit_tests.d

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ bin/all_ounit_tests.ml : ounit_tests/ounit_hashtbl_tests.ml
4444
bin/all_ounit_tests.ml : ext/map_gen.ml
4545
bin/all_ounit_tests.ml : ext/string_map.ml
4646
bin/all_ounit_tests.ml : ext/string_map.mli
47-
bin/all_ounit_tests.ml : bsb/bsb_json.ml
48-
bin/all_ounit_tests.ml : bsb/bsb_json.mli
47+
bin/all_ounit_tests.ml : ext/ext_json.ml
48+
bin/all_ounit_tests.ml : ext/ext_json.mli
4949
bin/all_ounit_tests.ml : ounit_tests/ounit_json_tests.ml
5050
bin/all_ounit_tests.ml : ext/ext_list.ml
5151
bin/all_ounit_tests.ml : ext/ext_list.mli

Diff for: jscomp/bin/all_ounit_tests.ml

+6-6
Original file line numberDiff line numberDiff line change
@@ -5475,8 +5475,8 @@ let of_array xs =
54755475
Array.fold_left (fun acc (k,v) -> add k v acc) empty xs
54765476

54775477
end
5478-
module Bsb_json : sig
5479-
#1 "bsb_json.mli"
5478+
module Ext_json : sig
5479+
#1 "ext_json.mli"
54805480
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
54815481
*
54825482
* This program is free software: you can redistribute it and/or modify
@@ -5551,7 +5551,7 @@ val test:
55515551
val query : path -> t -> status
55525552

55535553
end = struct
5554-
#1 "bsb_json.ml"
5554+
#1 "ext_json.ml"
55555555
# 1 "bsb/bsb_json.mll"
55565556

55575557
type error =
@@ -6293,9 +6293,9 @@ module Ounit_json_tests
62936293
let ((>::),
62946294
(>:::)) = OUnit.((>::),(>:::))
62956295

6296-
open Bsb_json
6296+
open Ext_json
62976297
let (|?) m (key, cb) =
6298-
m |> Bsb_json.test key cb
6298+
m |> Ext_json.test key cb
62996299

63006300
exception Parse_error
63016301
let suites =
@@ -11692,7 +11692,7 @@ module Ounit_vec_test
1169211692
let ((>::),
1169311693
(>:::)) = OUnit.((>::),(>:::))
1169411694

11695-
open Bsb_json
11695+
open Ext_json
1169611696

1169711697
let v = Int_vec.init 10 (fun i -> i);;
1169811698
let (=~) x y = OUnit.assert_equal ~cmp:(Int_vec.equal (fun (x: int) y -> x=y)) x y

Diff for: jscomp/bin/bsb.d

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ bin/bsb.ml : bsb/bsb_config.ml
2020
bin/bsb.ml : bsb/bsb_config.mli
2121
bin/bsb.ml : ext/ext_array.ml
2222
bin/bsb.ml : ext/ext_array.mli
23-
bin/bsb.ml : bsb/bsb_json.ml
24-
bin/bsb.ml : bsb/bsb_json.mli
23+
bin/bsb.ml : ext/ext_json.ml
24+
bin/bsb.ml : ext/ext_json.mli
2525
bin/bsb.ml : ext/ext_list.ml
2626
bin/bsb.ml : ext/ext_list.mli
2727
bin/bsb.ml : bsb/bsb_build_util.ml

Diff for: jscomp/bin/bsb.ml

+19-19
Original file line numberDiff line numberDiff line change
@@ -2891,8 +2891,8 @@ let exists p a =
28912891
loop 0
28922892

28932893
end
2894-
module Bsb_json : sig
2895-
#1 "bsb_json.mli"
2894+
module Ext_json : sig
2895+
#1 "ext_json.mli"
28962896
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
28972897
*
28982898
* This program is free software: you can redistribute it and/or modify
@@ -2967,7 +2967,7 @@ val test:
29672967
val query : path -> t -> status
29682968

29692969
end = struct
2970-
#1 "bsb_json.ml"
2970+
#1 "ext_json.ml"
29712971
# 1 "bsb/bsb_json.mll"
29722972

29732973
type error =
@@ -4264,7 +4264,7 @@ val mkp : string -> unit
42644264
*)
42654265
val get_bsc_bsdep : string -> string * string
42664266
val get_bsc_dir : string -> string
4267-
val get_list_string : Bsb_json.t array -> string list
4267+
val get_list_string : Ext_json.t array -> string list
42684268

42694269
end = struct
42704270
#1 "bsb_build_util.ml"
@@ -4375,7 +4375,7 @@ let rec mkp dir =
43754375

43764376

43774377
let get_list_string s =
4378-
Ext_array.to_list_map (fun (x : Bsb_json.t) ->
4378+
Ext_array.to_list_map (fun (x : Ext_json.t) ->
43794379
match x with
43804380
| `Str x -> Some x.str
43814381
| _ -> None
@@ -6091,14 +6091,14 @@ type t =
60916091

60926092

60936093
val parsing_source :
6094-
string -> Bsb_json.t String_map.t -> t
6094+
string -> Ext_json.t String_map.t -> t
60956095

60966096
(** entry is to the
60976097
[sources] in the schema
60986098
*)
60996099
val parsing_sources :
61006100
string ->
6101-
Bsb_json.t array ->
6101+
Ext_json.t array ->
61026102
t
61036103

61046104

@@ -6144,7 +6144,7 @@ type file_group =
61446144
let (//) = Ext_filename.combine
61456145

61466146
let (|?) m (key, cb) =
6147-
m |> Bsb_json.test key cb
6147+
m |> Ext_json.test key cb
61486148

61496149
let get_list_string = Bsb_build_util.get_list_string
61506150

@@ -6175,7 +6175,7 @@ let print_arrays file_array oc offset =
61756175

61766176

61776177

6178-
let handle_list_files dir (s : Bsb_json.t array) loc_start loc_end : Ext_file_pp.interval list * Binary_cache.t =
6178+
let handle_list_files dir (s : Ext_json.t array) loc_start loc_end : Ext_file_pp.interval list * Binary_cache.t =
61796179
if Array.length s = 0 then
61806180
begin
61816181
let files_array = Bsb_dir.readdir dir in
@@ -6195,7 +6195,7 @@ let handle_list_files dir (s : Bsb_json.t array) loc_start loc_end : Ext_file_p
61956195

61966196
else
61976197
[],
6198-
Array.fold_left (fun acc (s : Bsb_json.t) ->
6198+
Array.fold_left (fun acc (s : Ext_json.t) ->
61996199
match s with
62006200
| `Str {str = s} ->
62016201
Binary_cache.map_update ~dir acc s
@@ -6229,7 +6229,7 @@ let empty = { files = []; intervals = []; globbed_dirs = []; }
62296229

62306230

62316231

6232-
let rec parsing_source cwd (x : Bsb_json.t String_map.t )
6232+
let rec parsing_source cwd (x : Ext_json.t String_map.t )
62336233
: t =
62346234
let dir = ref cwd in
62356235
let sources = ref String_map.empty in
@@ -6335,7 +6335,7 @@ let rec parsing_source cwd (x : Bsb_json.t String_map.t )
63356335
}
63366336

63376337

6338-
let parsing_sources cwd (file_groups : Bsb_json.t array) =
6338+
let parsing_sources cwd (file_groups : Ext_json.t array) =
63396339
Array.fold_left (fun origin x ->
63406340
match x with
63416341
| `Obj map ->
@@ -6511,16 +6511,16 @@ val get_ocamllex : unit -> string
65116511
val set_ocamllex : cwd:string -> string -> unit
65126512

65136513

6514-
val set_bs_external_includes : Bsb_json.t array -> unit
6514+
val set_bs_external_includes : Ext_json.t array -> unit
65156515
val get_bs_external_includes : unit -> string list
65166516

65176517

65186518

65196519

6520-
val set_bsc_flags : Bsb_json.t array -> unit
6520+
val set_bsc_flags : Ext_json.t array -> unit
65216521
val get_bsc_flags : unit -> string list
65226522

6523-
val set_ppx_flags : cwd:string -> Bsb_json.t array -> unit
6523+
val set_ppx_flags : cwd:string -> Ext_json.t array -> unit
65246524
val get_ppx_flags : unit -> string list
65256525

65266526
val set_package_name : string -> unit
@@ -6531,7 +6531,7 @@ val get_refmt : unit -> string
65316531

65326532

65336533
val get_bs_dependencies : unit -> string list
6534-
val set_bs_dependencies : Bsb_json.t array -> unit
6534+
val set_bs_dependencies : Ext_json.t array -> unit
65356535

65366536

65376537
val get_js_post_build_cmd : unit -> string option
@@ -6542,7 +6542,7 @@ val set_ninja : cwd:string -> string -> unit
65426542

65436543
type package_specs = String_set.t
65446544
val get_package_specs : unit -> package_specs
6545-
val set_package_specs_from_array : Bsb_json.t array -> unit
6545+
val set_package_specs_from_array : Ext_json.t array -> unit
65466546

65476547
val get_generate_merlin : unit -> bool
65486548
val set_generate_merlin : bool -> unit
@@ -7656,7 +7656,7 @@ let bsdeps = ".bsdeps"
76567656

76577657
(* Key is the path *)
76587658
let (|?) m (key, cb) =
7659-
m |> Bsb_json.test key cb
7659+
m |> Ext_json.test key cb
76607660

76617661
let (//) = Ext_filename.combine
76627662

@@ -7775,7 +7775,7 @@ let write_ninja_file bsc_dir cwd =
77757775
revise_merlin buffer ;
77767776
in
77777777
let config_json_chan = open_in_bin Literals.bsconfig_json in
7778-
let global_data = Bsb_json.parse_json_from_chan config_json_chan in
7778+
let global_data = Ext_json.parse_json_from_chan config_json_chan in
77797779

77807780
let () =
77817781
match global_data with

Diff for: jscomp/bsb/bsb_build_ui.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type file_group =
3838
let (//) = Ext_filename.combine
3939

4040
let (|?) m (key, cb) =
41-
m |> Bsb_json.test key cb
41+
m |> Ext_json.test key cb
4242

4343
let get_list_string = Bsb_build_util.get_list_string
4444

@@ -69,7 +69,7 @@ let print_arrays file_array oc offset =
6969

7070

7171

72-
let handle_list_files dir (s : Bsb_json.t array) loc_start loc_end : Ext_file_pp.interval list * Binary_cache.t =
72+
let handle_list_files dir (s : Ext_json.t array) loc_start loc_end : Ext_file_pp.interval list * Binary_cache.t =
7373
if Array.length s = 0 then
7474
begin
7575
let files_array = Bsb_dir.readdir dir in
@@ -89,7 +89,7 @@ let handle_list_files dir (s : Bsb_json.t array) loc_start loc_end : Ext_file_p
8989

9090
else
9191
[],
92-
Array.fold_left (fun acc (s : Bsb_json.t) ->
92+
Array.fold_left (fun acc (s : Ext_json.t) ->
9393
match s with
9494
| `Str {str = s} ->
9595
Binary_cache.map_update ~dir acc s
@@ -123,7 +123,7 @@ let empty = { files = []; intervals = []; globbed_dirs = []; }
123123

124124

125125

126-
let rec parsing_source cwd (x : Bsb_json.t String_map.t )
126+
let rec parsing_source cwd (x : Ext_json.t String_map.t )
127127
: t =
128128
let dir = ref cwd in
129129
let sources = ref String_map.empty in
@@ -229,7 +229,7 @@ let rec parsing_source cwd (x : Bsb_json.t String_map.t )
229229
}
230230

231231

232-
let parsing_sources cwd (file_groups : Bsb_json.t array) =
232+
let parsing_sources cwd (file_groups : Ext_json.t array) =
233233
Array.fold_left (fun origin x ->
234234
match x with
235235
| `Obj map ->

Diff for: jscomp/bsb/bsb_build_ui.mli

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ type t =
4444

4545

4646
val parsing_source :
47-
string -> Bsb_json.t String_map.t -> t
47+
string -> Ext_json.t String_map.t -> t
4848

4949
(** entry is to the
5050
[sources] in the schema
5151
*)
5252
val parsing_sources :
5353
string ->
54-
Bsb_json.t array ->
54+
Ext_json.t array ->
5555
t
5656

Diff for: jscomp/bsb/bsb_build_util.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ let rec mkp dir =
105105

106106

107107
let get_list_string s =
108-
Ext_array.to_list_map (fun (x : Bsb_json.t) ->
108+
Ext_array.to_list_map (fun (x : Ext_json.t) ->
109109
match x with
110110
| `Str x -> Some x.str
111111
| _ -> None

Diff for: jscomp/bsb/bsb_build_util.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ val mkp : string -> unit
6464
*)
6565
val get_bsc_bsdep : string -> string * string
6666
val get_bsc_dir : string -> string
67-
val get_list_string : Bsb_json.t array -> string list
67+
val get_list_string : Ext_json.t array -> string list

0 commit comments

Comments
 (0)