Skip to content

Commit 02542bf

Browse files
committed
rename bsb_dir_group to boolean: -g or not
maybe we can create two rules, one for -g groups one without
1 parent 1dda4bc commit 02542bf

File tree

8 files changed

+16
-19
lines changed

8 files changed

+16
-19
lines changed

jscomp/bsb/bsb_ninja_file_groups.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ let emit_module_build
115115
?shadows:(if is_dev then
116116
Some [{Bsb_ninja_targets.key = Bsb_build_schemas.bsb_dir_group ;
117117
op =
118-
Overwrite (string_of_int (group_dir_index :> int)) }]
118+
Overwrite "-g" }]
119119
else None)
120120
;
121121
if has_intf_file then begin

jscomp/bsb/bsb_ninja_gen.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ let output_ninja_and_namespace_map
160160
bs_dev_dependencies
161161
(fun x -> x.package_install_path));
162162
Bsb_ninja_global_vars.g_ns , g_ns_flg ;
163-
Bsb_build_schemas.bsb_dir_group, "0" (*TODO: avoid name conflict in the future *)
164163
|] oc
165164
in
166165
let bs_groups, bsc_lib_dirs, static_resources =

jscomp/bsb/bsb_ninja_rule.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ let make_custom_rules
194194
define
195195
~restat:()
196196
~command:
197-
("$bsdep -hash " ^ digest ^" $g_ns -g $bsb_dir_group $in")
197+
("$bsdep -hash " ^ digest ^" $g_ns $bsb_dir_group $in")
198198
"build_deps" in
199199
let aux ~name ~read_cmi ~postbuild =
200200
let postbuild = has_postbuild && postbuild in

jscomp/bsb_helper/bsb_helper_depfile_gen.ml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ let oc_cmi buf namespace source =
121121
*)
122122
let oc_impl
123123
(mlast : string)
124-
(index : Bsb_dir_index.t)
124+
(dev_group : bool)
125125
(db : Bsb_db_decode.t)
126126
(namespace : string option)
127127
(buf : Ext_buffer.t)
@@ -141,7 +141,6 @@ let oc_impl
141141
Ext_buffer.add_string buf ns;
142142
Ext_buffer.add_string buf Literals.suffix_cmi;
143143
) ; (* TODO: moved into static files*)
144-
let is_not_lib_dir = not (Bsb_dir_index.is_lib_dir index) in
145144
let s = extract_dep_raw_string mlast in
146145
let offset = ref 1 in
147146
let size = String.length s in
@@ -155,7 +154,7 @@ let oc_impl
155154
end
156155
);
157156
(match
158-
Bsb_db_decode.find db dependent_module is_not_lib_dir
157+
Bsb_db_decode.find db dependent_module dev_group
159158
with
160159
| None -> ()
161160
| Some ({dir_name; case }) ->
@@ -187,7 +186,7 @@ let oc_impl
187186
*)
188187
let oc_intf
189188
mliast
190-
(index : Bsb_dir_index.t)
189+
(dev_group : bool)
191190
(db : Bsb_db_decode.t)
192191
(namespace : string option)
193192
(buf : Ext_buffer.t) : unit =
@@ -204,7 +203,6 @@ let oc_intf
204203
Ext_buffer.add_string buf Literals.suffix_cmi;
205204
) ;
206205
let cur_module_name = Ext_filename.module_name mliast in
207-
let is_not_lib_dir = not (Bsb_dir_index.is_lib_dir index) in
208206
let s = extract_dep_raw_string mliast in
209207
let offset = ref 1 in
210208
let size = String.length s in
@@ -217,7 +215,7 @@ let oc_intf
217215
exit 2
218216
end
219217
);
220-
(match Bsb_db_decode.find db dependent_module is_not_lib_dir
218+
(match Bsb_db_decode.find db dependent_module dev_group
221219
with
222220
| None -> ()
223221
| Some {dir_name; case} ->
@@ -236,7 +234,7 @@ let oc_intf
236234

237235
let emit_d
238236
compilation_kind
239-
(index : Bsb_dir_index.t)
237+
(dev_group : bool)
240238
(namespace : string option) (mlast : string) (mliast : string) =
241239
let data =
242240
Bsb_db_decode.read_build_cache
@@ -252,7 +250,7 @@ let emit_d
252250
in
253251
oc_impl
254252
mlast
255-
index
253+
dev_group
256254
data
257255
namespace
258256
buf
@@ -261,7 +259,7 @@ let emit_d
261259
if mliast <> "" then begin
262260
oc_intf
263261
mliast
264-
index
262+
dev_group
265263
data
266264
namespace
267265
buf

jscomp/bsb_helper/bsb_helper_depfile_gen.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ val deps_of_channel : in_channel -> string list
3232

3333
val emit_d:
3434
kind ->
35-
Bsb_dir_index.t ->
35+
bool ->
3636
string option ->
3737
string ->
3838
string -> (* empty string means no mliast *)

jscomp/ext/bsb_dir_index.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type t = int
2929
1 : dev 1
3030
2 : dev 2
3131
*)
32-
external of_int : int -> t = "%identity"
32+
3333
let lib_dir_index = 0
3434

3535
let is_lib_dir x = x = lib_dir_index

jscomp/ext/bsb_dir_index.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ val is_lib_dir : t -> bool
3333

3434
val get_dev_index : unit -> t
3535

36-
val of_int : int -> t
36+
3737

3838

3939

jscomp/main/bsb_helper_main.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let collect_file name =
2929
batch_files := name :: !batch_files
3030

3131
(* let output_prefix = ref None *)
32-
let dev_group = ref 0
32+
let dev_group = ref false
3333
let namespace = ref None
3434

3535

@@ -39,7 +39,7 @@ let usage = "Usage: bsb_helper.exe [options] \nOptions are:"
3939

4040
let () =
4141
Bsb_helper_arg.parse_exn [
42-
"-g", Set_int dev_group ,
42+
"-g", Set dev_group ,
4343
" Set the dev group (default to be 0)"
4444
;
4545
"-bs-ns", String (fun s -> namespace := Some s),
@@ -52,13 +52,13 @@ let () =
5252
| [x]
5353
-> Bsb_helper_depfile_gen.emit_d
5454
!compilation_kind
55-
(Bsb_dir_index.of_int !dev_group )
55+
!dev_group
5656
!namespace x ""
5757
| [y; x] (* reverse order *)
5858
->
5959
Bsb_helper_depfile_gen.emit_d
6060
!compilation_kind
61-
(Bsb_dir_index.of_int !dev_group)
61+
!dev_group
6262
!namespace x y
6363
| _ ->
6464
()

0 commit comments

Comments
 (0)