@@ -30,6 +30,8 @@ let no_deps_mode = ref false
30
30
31
31
let do_install = ref false
32
32
33
+ let warning_as_error = ref None
34
+
33
35
let force_regenerate = ref false
34
36
35
37
type spec = Bsb_arg .spec
@@ -40,6 +42,8 @@ let unit_set_spec b : spec = Unit (Unit_set b)
40
42
41
43
let string_set_spec s : spec = String (String_set s)
42
44
45
+ let string_call f : spec = String (String_call f)
46
+
43
47
let failed_annon ~rev_args =
44
48
match rev_args with
45
49
| x :: _ -> Bsb_arg. bad_arg (" Don't know what to do with " ^ x)
@@ -132,6 +136,7 @@ let build_subcommand ~start argv argv_len =
132
136
Always regenerate build.ninja no matter bsconfig.json is changed or \
133
137
not" );
134
138
(" -no-deps" , unit_set_spec no_deps_mode, " *internal* Needed for watcher to build without dependencies on file change" );
139
+ (" -warn-error" , string_call (fun s -> warning_as_error := Some s), " Warning numbers and whether to turn them into errors, e.g., \" +8+32-102\" " )
135
140
|]
136
141
failed_annon;
137
142
@@ -141,14 +146,20 @@ let build_subcommand ~start argv argv_len =
141
146
match ninja_args with
142
147
| [| " -h" |] -> ninja_command_exit ninja_args
143
148
| _ ->
149
+ let warn_as_error = match ! warning_as_error with
150
+ | Some s ->
151
+ let () = try Warnings. parse_options true s with Arg. Bad msg -> Bsb_arg. bad_arg (msg ^ " \n " ) in
152
+ Some s
153
+ | None -> None in
144
154
let config_opt =
145
155
Bsb_ninja_regen. regenerate_ninja
146
156
~package_kind: Toplevel
147
157
~per_proj_dir: Bsb_global_paths. cwd
148
158
~forced: ! force_regenerate
149
159
~warn_legacy_config: true
160
+ ~warn_as_error
150
161
in
151
- if not ! no_deps_mode then Bsb_world. make_world_deps Bsb_global_paths. cwd config_opt ninja_args;
162
+ if not ! no_deps_mode then Bsb_world. make_world_deps Bsb_global_paths. cwd config_opt ninja_args warn_as_error ;
152
163
if ! do_install then install_target () ;
153
164
ninja_command_exit ninja_args
154
165
@@ -180,6 +191,7 @@ let info_subcommand ~start argv =
180
191
~per_proj_dir: Bsb_global_paths. cwd
181
192
~forced: true
182
193
~warn_legacy_config: true
194
+ ~warn_as_error: None
183
195
with
184
196
| None -> assert false
185
197
| Some { file_groups = { files } } ->
@@ -210,8 +222,9 @@ let () =
210
222
~per_proj_dir: Bsb_global_paths. cwd
211
223
~forced: false
212
224
~warn_legacy_config: true
225
+ ~warn_as_error: None
213
226
in
214
- Bsb_world. make_world_deps Bsb_global_paths. cwd config_opt [||];
227
+ Bsb_world. make_world_deps Bsb_global_paths. cwd config_opt [||] None ;
215
228
ninja_command_exit [||])
216
229
else
217
230
match argv.(1 ) with
0 commit comments