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
92
1
module Ext_bytes : sig
93
2
#1 " ext_bytes.mli"
94
3
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
@@ -3915,7 +3824,7 @@ val deps_of_channel : in_channel -> string list
3915
3824
3916
3825
val emit_d :
3917
3826
kind ->
3918
- Bsb_dir_index .t ->
3827
+ bool ->
3919
3828
string option ->
3920
3829
string ->
3921
3830
string -> (* empty string means no mliast *)
@@ -4046,7 +3955,7 @@ let oc_cmi buf namespace source =
4046
3955
*)
4047
3956
let oc_impl
4048
3957
(mlast : string )
4049
- (index : Bsb_dir_index.t )
3958
+ (dev_group : bool )
4050
3959
(db : Bsb_db_decode.t )
4051
3960
(namespace : string option )
4052
3961
(buf : Ext_buffer.t )
@@ -4066,7 +3975,6 @@ let oc_impl
4066
3975
Ext_buffer. add_string buf ns;
4067
3976
Ext_buffer. add_string buf Literals. suffix_cmi;
4068
3977
) ; (* TODO: moved into static files*)
4069
- let is_not_lib_dir = not (Bsb_dir_index. is_lib_dir index) in
4070
3978
let s = extract_dep_raw_string mlast in
4071
3979
let offset = ref 1 in
4072
3980
let size = String. length s in
@@ -4080,7 +3988,7 @@ let oc_impl
4080
3988
end
4081
3989
);
4082
3990
(match
4083
- Bsb_db_decode. find db dependent_module is_not_lib_dir
3991
+ Bsb_db_decode. find db dependent_module dev_group
4084
3992
with
4085
3993
| None -> ()
4086
3994
| Some ({dir_name; case } ) ->
@@ -4112,7 +4020,7 @@ let oc_impl
4112
4020
*)
4113
4021
let oc_intf
4114
4022
mliast
4115
- (index : Bsb_dir_index.t )
4023
+ (dev_group : bool )
4116
4024
(db : Bsb_db_decode.t )
4117
4025
(namespace : string option )
4118
4026
(buf : Ext_buffer.t ) : unit =
@@ -4129,7 +4037,6 @@ let oc_intf
4129
4037
Ext_buffer. add_string buf Literals. suffix_cmi;
4130
4038
) ;
4131
4039
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
4133
4040
let s = extract_dep_raw_string mliast in
4134
4041
let offset = ref 1 in
4135
4042
let size = String. length s in
@@ -4142,7 +4049,7 @@ let oc_intf
4142
4049
exit 2
4143
4050
end
4144
4051
);
4145
- (match Bsb_db_decode. find db dependent_module is_not_lib_dir
4052
+ (match Bsb_db_decode. find db dependent_module dev_group
4146
4053
with
4147
4054
| None -> ()
4148
4055
| Some {dir_name; case} ->
@@ -4161,7 +4068,7 @@ let oc_intf
4161
4068
4162
4069
let emit_d
4163
4070
compilation_kind
4164
- (index : Bsb_dir_index.t )
4071
+ (dev_group : bool )
4165
4072
(namespace : string option ) (mlast : string ) (mliast : string ) =
4166
4073
let data =
4167
4074
Bsb_db_decode. read_build_cache
@@ -4177,7 +4084,7 @@ let emit_d
4177
4084
in
4178
4085
oc_impl
4179
4086
mlast
4180
- index
4087
+ dev_group
4181
4088
data
4182
4089
namespace
4183
4090
buf
@@ -4186,7 +4093,7 @@ let emit_d
4186
4093
if mliast <> " " then begin
4187
4094
oc_intf
4188
4095
mliast
4189
- index
4096
+ dev_group
4190
4097
data
4191
4098
namespace
4192
4099
buf
@@ -4265,7 +4172,7 @@ let collect_file name =
4265
4172
batch_files := name :: ! batch_files
4266
4173
4267
4174
(* let output_prefix = ref None *)
4268
- let dev_group = ref 0
4175
+ let dev_group = ref false
4269
4176
let namespace = ref None
4270
4177
4271
4178
@@ -4275,7 +4182,7 @@ let usage = "Usage: bsb_helper.exe [options] \nOptions are:"
4275
4182
4276
4183
let () =
4277
4184
Bsb_helper_arg. parse_exn [
4278
- " -g" , Set_int dev_group ,
4185
+ " -g" , Set dev_group ,
4279
4186
" Set the dev group (default to be 0)"
4280
4187
;
4281
4188
" -bs-ns" , String (fun s -> namespace := Some s),
@@ -4288,13 +4195,13 @@ let () =
4288
4195
| [x]
4289
4196
-> Bsb_helper_depfile_gen. emit_d
4290
4197
! compilation_kind
4291
- ( Bsb_dir_index. of_int ! dev_group )
4198
+ ! dev_group
4292
4199
! namespace x " "
4293
4200
| [y; x] (* reverse order *)
4294
4201
->
4295
4202
Bsb_helper_depfile_gen. emit_d
4296
4203
! compilation_kind
4297
- ( Bsb_dir_index. of_int ! dev_group)
4204
+ ! dev_group
4298
4205
! namespace x y
4299
4206
| _ ->
4300
4207
()
0 commit comments