1- module Bsb_dir_index : sig
2- #1 " bsb_dir_index.mli"
3- (* Copyright (C) 2017 Authors of BuckleScript
4- *
5- * This program is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * (at your option) any later version.
9- *
10- * In addition to the permissions granted to you by the LGPL, you may combine
11- * or link a "work that uses the Library" with a publicly distributed version
12- * of this file to produce a combined library or application, then distribute
13- * that combined work under the terms of your choosing, with no requirement
14- * to comply with the obligations normally placed on you by section 4 of the
15- * LGPL version 3 (or the corresponding section of a later version of the LGPL
16- * should you choose to use a later version).
17- *
18- * This program is distributed in the hope that it will be useful,
19- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21- * GNU Lesser General Public License for more details.
22- *
23- * You should have received a copy of the GNU Lesser General Public License
24- * along with this program; if not, write to the Free Software
25- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
26-
27- (* * Used to index [.bsbuildcache] may not be needed if we flatten dev
28- into a single group
29- *)
30- type t = private int
31-
32- val lib_dir_index : t
33-
34- val is_lib_dir : t -> bool
35-
36- val get_dev_index : unit -> t
37-
38- val of_int : int -> t
39-
40-
41-
42-
43- end = struct
44- #1 " bsb_dir_index.ml"
45- (* Copyright (C) 2017 Authors of BuckleScript
46- *
47- * This program is free software: you can redistribute it and/or modify
48- * it under the terms of the GNU Lesser General Public License as published by
49- * the Free Software Foundation, either version 3 of the License, or
50- * (at your option) any later version.
51- *
52- * In addition to the permissions granted to you by the LGPL, you may combine
53- * or link a "work that uses the Library" with a publicly distributed version
54- * of this file to produce a combined library or application, then distribute
55- * that combined work under the terms of your choosing, with no requirement
56- * to comply with the obligations normally placed on you by section 4 of the
57- * LGPL version 3 (or the corresponding section of a later version of the LGPL
58- * should you choose to use a later version).
59- *
60- * This program is distributed in the hope that it will be useful,
61- * but WITHOUT ANY WARRANTY; without even the implied warranty of
62- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63- * GNU Lesser General Public License for more details.
64- *
65- * You should have received a copy of the GNU Lesser General Public License
66- * along with this program; if not, write to the Free Software
67- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
68-
69- type t = int
70-
71- (* *
72- 0 : lib
73- 1 : dev 1
74- 2 : dev 2
75- *)
76- external of_int : int -> t = " %identity"
77- let lib_dir_index = 0
78-
79- let is_lib_dir x = x = lib_dir_index
80-
81-
82-
83- let get_dev_index ( ) = 1
84-
85-
86-
87-
88-
89-
90-
91- end
921module Ext_bytes : sig
932#1 " ext_bytes.mli"
943(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
@@ -3915,7 +3824,7 @@ val deps_of_channel : in_channel -> string list
39153824
39163825val emit_d :
39173826 kind ->
3918- Bsb_dir_index .t ->
3827+ bool ->
39193828 string option ->
39203829 string ->
39213830 string -> (* empty string means no mliast *)
@@ -4046,7 +3955,7 @@ let oc_cmi buf namespace source =
40463955*)
40473956let oc_impl
40483957 (mlast : string )
4049- (index : Bsb_dir_index.t )
3958+ (dev_group : bool )
40503959 (db : Bsb_db_decode.t )
40513960 (namespace : string option )
40523961 (buf : Ext_buffer.t )
@@ -4066,7 +3975,6 @@ let oc_impl
40663975 Ext_buffer. add_string buf ns;
40673976 Ext_buffer. add_string buf Literals. suffix_cmi;
40683977 ) ; (* TODO: moved into static files*)
4069- let is_not_lib_dir = not (Bsb_dir_index. is_lib_dir index) in
40703978 let s = extract_dep_raw_string mlast in
40713979 let offset = ref 1 in
40723980 let size = String. length s in
@@ -4080,7 +3988,7 @@ let oc_impl
40803988 end
40813989 );
40823990 (match
4083- Bsb_db_decode. find db dependent_module is_not_lib_dir
3991+ Bsb_db_decode. find db dependent_module dev_group
40843992 with
40853993 | None -> ()
40863994 | Some ({dir_name; case } ) ->
@@ -4112,7 +4020,7 @@ let oc_impl
41124020*)
41134021let oc_intf
41144022 mliast
4115- (index : Bsb_dir_index.t )
4023+ (dev_group : bool )
41164024 (db : Bsb_db_decode.t )
41174025 (namespace : string option )
41184026 (buf : Ext_buffer.t ) : unit =
@@ -4129,7 +4037,6 @@ let oc_intf
41294037 Ext_buffer. add_string buf Literals. suffix_cmi;
41304038 ) ;
41314039 let cur_module_name = Ext_filename. module_name mliast in
4132- let is_not_lib_dir = not (Bsb_dir_index. is_lib_dir index) in
41334040 let s = extract_dep_raw_string mliast in
41344041 let offset = ref 1 in
41354042 let size = String. length s in
@@ -4142,7 +4049,7 @@ let oc_intf
41424049 exit 2
41434050 end
41444051 );
4145- (match Bsb_db_decode. find db dependent_module is_not_lib_dir
4052+ (match Bsb_db_decode. find db dependent_module dev_group
41464053 with
41474054 | None -> ()
41484055 | Some {dir_name; case} ->
@@ -4161,7 +4068,7 @@ let oc_intf
41614068
41624069let emit_d
41634070 compilation_kind
4164- (index : Bsb_dir_index.t )
4071+ (dev_group : bool )
41654072 (namespace : string option ) (mlast : string ) (mliast : string ) =
41664073 let data =
41674074 Bsb_db_decode. read_build_cache
@@ -4177,7 +4084,7 @@ let emit_d
41774084 in
41784085 oc_impl
41794086 mlast
4180- index
4087+ dev_group
41814088 data
41824089 namespace
41834090 buf
@@ -4186,7 +4093,7 @@ let emit_d
41864093 if mliast <> " " then begin
41874094 oc_intf
41884095 mliast
4189- index
4096+ dev_group
41904097 data
41914098 namespace
41924099 buf
@@ -4265,7 +4172,7 @@ let collect_file name =
42654172 batch_files := name :: ! batch_files
42664173
42674174(* let output_prefix = ref None *)
4268- let dev_group = ref 0
4175+ let dev_group = ref false
42694176let namespace = ref None
42704177
42714178
@@ -4275,7 +4182,7 @@ let usage = "Usage: bsb_helper.exe [options] \nOptions are:"
42754182
42764183let () =
42774184 Bsb_helper_arg. parse_exn [
4278- " -g" , Set_int dev_group ,
4185+ " -g" , Set dev_group ,
42794186 " Set the dev group (default to be 0)"
42804187 ;
42814188 " -bs-ns" , String (fun s -> namespace := Some s),
@@ -4288,13 +4195,13 @@ let () =
42884195 | [x]
42894196 -> Bsb_helper_depfile_gen. emit_d
42904197 ! compilation_kind
4291- ( Bsb_dir_index. of_int ! dev_group )
4198+ ! dev_group
42924199 ! namespace x " "
42934200 | [y; x] (* reverse order *)
42944201 ->
42954202 Bsb_helper_depfile_gen. emit_d
42964203 ! compilation_kind
4297- ( Bsb_dir_index. of_int ! dev_group)
4204+ ! dev_group
42984205 ! namespace x y
42994206 | _ ->
43004207 ()
0 commit comments