Skip to content

Commit fbcfaf9

Browse files
committed
get rid of number_of_dev_groups
1 parent a724fcb commit fbcfaf9

File tree

7 files changed

+18
-46
lines changed

7 files changed

+18
-46
lines changed

jscomp/bsb/bsb_config_parse.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ let interpret_json
440440
| Some sources ->
441441
let cut_generators =
442442
extract_boolean map Bsb_build_schemas.cut_generators false in
443-
let groups, number_of_dev_groups = Bsb_parse_sources.scan
443+
let groups = Bsb_parse_sources.scan
444444
~ignored_dirs:(extract_ignored_dirs map)
445445
~toplevel
446446
~root: per_proj_dir
@@ -484,7 +484,6 @@ let interpret_json
484484
entries;
485485
generators = extract_generators map ;
486486
cut_generators ;
487-
number_of_dev_groups;
488487
}
489488
| None ->
490489
Bsb_exception.invalid_spec

jscomp/bsb/bsb_config_types.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,4 @@ type t =
8181
cut_generators : bool; (* note when used as a dev mode, we will always ignore it *)
8282
bs_suffix : bool ; (* true means [.bs.js] we should pass [-bs-suffix] flag *)
8383
gentype_config : gentype_config option;
84-
number_of_dev_groups : int
8584
}

jscomp/bsb/bsb_ninja_gen.ml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ let output_ninja_and_namespace_map
116116
namespace ;
117117
warning;
118118
gentype_config;
119-
number_of_dev_groups;
119+
120120
} : Bsb_config_types.t) : unit
121121
=
122122
let lib_artifacts_dir = !Bsb_global_backend.lib_artifacts_dir in
@@ -164,19 +164,6 @@ let output_ninja_and_namespace_map
164164
|] oc
165165
in
166166
let bs_groups, bsc_lib_dirs, static_resources =
167-
if number_of_dev_groups = 0 then
168-
let bs_group, source_dirs,static_resources =
169-
Ext_list.fold_left bs_file_groups (Map_string.empty,[],[])
170-
(fun (acc, dirs,acc_resources) ({sources ; dir; resources } as x)
171-
->
172-
Bsb_db_util.merge acc sources ,
173-
(if Bsb_file_groups.is_empty x then dirs else dir::dirs) ,
174-
( if resources = [] then acc_resources
175-
else Ext_list.map_append resources acc_resources (fun x -> dir // x ) )
176-
) in
177-
Bsb_db_util.sanity_check bs_group;
178-
[|bs_group|], source_dirs, static_resources
179-
else
180167
(* number_of_dev_groups = 1 -- all devs share the same group *)
181168
let bs_groups = Array.init 2 (fun _ -> Map_string.empty) in
182169
let source_dirs = Array.init 2 (fun _ -> []) in

jscomp/bsb/bsb_parse_sources.ml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -401,21 +401,18 @@ let scan
401401
~namespace
402402
~bs_suffix
403403
~ignored_dirs
404-
x : t * int =
405-
Bsb_dir_index.reset ();
406-
let output =
407-
parse_sources {
408-
ignored_dirs;
409-
toplevel;
410-
dir_index = Bsb_dir_index.lib_dir_index;
411-
cwd = Filename.current_dir_name;
412-
root ;
413-
cut_generators;
414-
namespace;
415-
bs_suffix;
416-
traverse = false
417-
} x in
418-
output, Bsb_dir_index.get_current_number_of_dev_groups ()
404+
x : t =
405+
parse_sources {
406+
ignored_dirs;
407+
toplevel;
408+
dir_index = Bsb_dir_index.lib_dir_index;
409+
cwd = Filename.current_dir_name;
410+
root ;
411+
cut_generators;
412+
namespace;
413+
bs_suffix;
414+
traverse = false
415+
} x
419416

420417

421418

jscomp/bsb/bsb_parse_sources.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ val scan :
3737
bs_suffix:bool ->
3838
ignored_dirs:Set_string.t ->
3939
Ext_json_types.t ->
40-
Bsb_file_groups.t * int
40+
Bsb_file_groups.t
4141

4242
(** This function has some duplication
4343
from [scan],

jscomp/ext/bsb_dir_index.ml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@ let lib_dir_index = 0
3434

3535
let is_lib_dir x = x = lib_dir_index
3636

37-
let dir_index = ref 0
3837

39-
let get_dev_index ( ) =
40-
incr dir_index ; !dir_index
4138

42-
let get_current_number_of_dev_groups =
43-
(fun () -> !dir_index )
39+
let get_dev_index ( ) = 1
40+
4441

4542

4643
(** bsb generate pre-defined variables [bsc_group_i_includes]
@@ -66,4 +63,3 @@ let string_of_bsb_dev_include i =
6663
"bsc_group_" ^ string_of_int i ^ "_includes"
6764

6865

69-
let reset () = dir_index := 0

jscomp/ext/bsb_dir_index.mli

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,8 @@ val get_dev_index : unit -> t
3535

3636
val of_int : int -> t
3737

38-
val get_current_number_of_dev_groups : unit -> int
38+
3939

4040

4141
val string_of_bsb_dev_include : t -> string
4242

43-
(** TODO: Need reset
44-
when generating each ninja file to provide stronger guarantee.
45-
Here we get a weak guarantee because only dev group is
46-
inside the toplevel project
47-
*)
48-
val reset : unit -> unit

0 commit comments

Comments
 (0)