@@ -7301,8 +7301,8 @@ type t =
7301
7301
}
7302
7302
7303
7303
7304
- let magic_number = " BS_DEP_INFOS_20170809 "
7305
- let bsb_version = " 20170809 +dev"
7304
+ let magic_number = " BS_DEP_INFOS_20170822 "
7305
+ let bsb_version = " 20170822 +dev"
7306
7306
(* TODO: for such small data structure, maybe text format is better *)
7307
7307
7308
7308
let write (fname : string ) (x : t ) =
@@ -7325,15 +7325,15 @@ type check_result =
7325
7325
7326
7326
let pp_check_result fmt (check_resoult : check_result ) =
7327
7327
Format. pp_print_string fmt (match check_resoult with
7328
- | Good -> " OK"
7329
- | Bsb_file_not_exist -> " Dependencies information missing"
7330
- | Bsb_source_directory_changed ->
7331
- " Bsb source directory changed"
7332
- | Bsb_bsc_version_mismatch ->
7333
- " Bsc or bsb version mismatch"
7334
- | Bsb_forced ->
7335
- " Bsb forced rebuild"
7336
- | Other s -> s)
7328
+ | Good -> " OK"
7329
+ | Bsb_file_not_exist -> " Dependencies information missing"
7330
+ | Bsb_source_directory_changed ->
7331
+ " Bsb source directory changed"
7332
+ | Bsb_bsc_version_mismatch ->
7333
+ " Bsc or bsb version mismatch"
7334
+ | Bsb_forced ->
7335
+ " Bsb forced rebuild"
7336
+ | Other s -> s)
7337
7337
7338
7338
let rec check_aux cwd xs i finish =
7339
7339
if i = finish then Good
@@ -7431,7 +7431,7 @@ val remove_package_suffix: string -> string
7431
7431
*)
7432
7432
val js_name_of_basename : string -> string
7433
7433
7434
- val module_name_of_package_name : string -> string
7434
+ val namespace_of_package_name : string -> string
7435
7435
7436
7436
end = struct
7437
7437
#1 " ext_package_name.ml"
@@ -7485,7 +7485,7 @@ let js_name_of_basename s =
7485
7485
remove_package_suffix (String. uncapitalize s) ^ Literals. suffix_js
7486
7486
7487
7487
7488
- let module_name_of_package_name (s : string ) : string =
7488
+ let namespace_of_package_name (s : string ) : string =
7489
7489
let len = String. length s in
7490
7490
let buf = Buffer. create len in
7491
7491
let add capital ch =
@@ -10514,7 +10514,9 @@ type reason_react_jsx = string option
10514
10514
type t =
10515
10515
{
10516
10516
package_name : string ;
10517
+ (* [captial-package] *)
10517
10518
namespace : string option ;
10519
+ (* CapitalPackage *)
10518
10520
external_includes : string list ;
10519
10521
bsc_flags : string list ;
10520
10522
ppx_flags : string list ;
@@ -11012,32 +11014,32 @@ let (|?) m (key, cb) =
11012
11014
11013
11015
let parse_entries (field : Ext_json_types.t array ) =
11014
11016
Ext_array. to_list_map (function
11015
- | Ext_json_types. Obj {map} ->
11016
- (* kind defaults to bytecode *)
11017
- let kind = ref " js" in
11018
- let main = ref None in
11019
- let _ = map
11020
- |? (Bsb_build_schemas. kind, `Str (fun x -> kind := x))
11021
- |? (Bsb_build_schemas. main, `Str (fun x -> main := Some x))
11022
- in
11023
- let path = begin match ! main with
11024
- (* This is technically optional when compiling to js *)
11025
- | None when ! kind = Literals. js ->
11026
- " Index"
11027
- | None ->
11028
- failwith " Missing field 'main'. That field is required its value needs to be the main module for the target"
11029
- | Some path -> path
11030
- end in
11031
- if ! kind = Literals. native then
11032
- Some (Bsb_config_types. NativeTarget path)
11033
- else if ! kind = Literals. bytecode then
11034
- Some (Bsb_config_types. BytecodeTarget path)
11035
- else if ! kind = Literals. js then
11036
- Some (Bsb_config_types. JsTarget path)
11037
- else
11038
- failwith " Missing field 'kind'. That field is required and its value be 'js', 'native' or 'bytecode'"
11039
- | _ -> failwith " Unrecognized object inside array 'entries' field." )
11040
- field
11017
+ | Ext_json_types. Obj {map} ->
11018
+ (* kind defaults to bytecode *)
11019
+ let kind = ref " js" in
11020
+ let main = ref None in
11021
+ let _ = map
11022
+ |? (Bsb_build_schemas. kind, `Str (fun x -> kind := x))
11023
+ |? (Bsb_build_schemas. main, `Str (fun x -> main := Some x))
11024
+ in
11025
+ let path = begin match ! main with
11026
+ (* This is technically optional when compiling to js *)
11027
+ | None when ! kind = Literals. js ->
11028
+ " Index"
11029
+ | None ->
11030
+ failwith " Missing field 'main'. That field is required its value needs to be the main module for the target"
11031
+ | Some path -> path
11032
+ end in
11033
+ if ! kind = Literals. native then
11034
+ Some (Bsb_config_types. NativeTarget path)
11035
+ else if ! kind = Literals. bytecode then
11036
+ Some (Bsb_config_types. BytecodeTarget path)
11037
+ else if ! kind = Literals. js then
11038
+ Some (Bsb_config_types. JsTarget path)
11039
+ else
11040
+ failwith " Missing field 'kind'. That field is required and its value be 'js', 'native' or 'bytecode'"
11041
+ | _ -> failwith " Unrecognized object inside array 'entries' field." )
11042
+ field
11041
11043
11042
11044
11043
11045
@@ -11074,7 +11076,7 @@ let interpret_json
11074
11076
cwd
11075
11077
11076
11078
: Bsb_config_types.t =
11077
-
11079
+
11078
11080
let reason_react_jsx = ref None in
11079
11081
let config_json = (cwd // Literals. bsconfig_json) in
11080
11082
let refmt = ref None in
@@ -11126,27 +11128,27 @@ let interpret_json
11126
11128
in
11127
11129
map
11128
11130
|? (Bsb_build_schemas. reason, `Obj begin fun m ->
11129
- match String_map. find_opt Bsb_build_schemas. react_jsx m with
11130
-
11131
- | Some (False _)
11132
- | None -> ()
11133
- | Some (Flo{loc; flo} ) ->
11134
- begin match flo with
11135
- | "1" ->
11136
- reason_react_jsx :=
11137
- Some (Filename. quote (Filename. concat bsc_dir Literals. reactjs_jsx_ppx_exe) )
11138
- | "2" ->
11131
+ match String_map. find_opt Bsb_build_schemas. react_jsx m with
11132
+
11133
+ | Some (False _)
11134
+ | None -> ()
11135
+ | Some (Flo{loc; flo} ) ->
11136
+ begin match flo with
11137
+ | "1" ->
11138
+ reason_react_jsx :=
11139
+ Some (Filename. quote (Filename. concat bsc_dir Literals. reactjs_jsx_ppx_exe) )
11140
+ | "2" ->
11141
+ reason_react_jsx :=
11142
+ Some (Filename. quote
11143
+ (Filename. concat bsc_dir Literals. reactjs_jsx_ppx_2_exe) )
11144
+ | _ -> Bsb_exception. failf ~loc " Unsupported jsx version %s" flo
11145
+ end
11146
+ | Some (True _ ) ->
11139
11147
reason_react_jsx :=
11140
- Some (Filename. quote
11141
- (Filename. concat bsc_dir Literals. reactjs_jsx_ppx_2_exe) )
11142
- | _ -> Bsb_exception. failf ~loc " Unsupported jsx version %s" flo
11143
- end
11144
- | Some (True _ ) ->
11145
- reason_react_jsx :=
11146
11148
Some (Filename. quote (Filename. concat bsc_dir Literals. reactjs_jsx_ppx_exe)
11147
- )
11148
- | Some x -> Bsb_exception. failf ~loc: (Ext_json. loc_of x)
11149
- " Unexpected input for jsx"
11149
+ )
11150
+ | Some x -> Bsb_exception. failf ~loc: (Ext_json. loc_of x)
11151
+ " Unexpected input for jsx"
11150
11152
end)
11151
11153
11152
11154
|? (Bsb_build_schemas. generate_merlin, `Bool (fun b ->
@@ -11155,7 +11157,7 @@ let interpret_json
11155
11157
|? (Bsb_build_schemas. name, `Str (fun s -> package_name := Some s))
11156
11158
|? (Bsb_build_schemas. namespace, `Bool (fun b ->
11157
11159
namespace := b
11158
- ))
11160
+ ))
11159
11161
|? (Bsb_build_schemas. js_post_build, `Obj begin fun m ->
11160
11162
m |? (Bsb_build_schemas. cmd , `Str (fun s ->
11161
11163
js_post_build_cmd := Some (Bsb_build_util. resolve_bsb_magic_file ~cwd ~desc: Bsb_build_schemas. js_post_build s)
@@ -11187,16 +11189,16 @@ let interpret_json
11187
11189
|? (Bsb_build_schemas. generators, `Arr (fun s ->
11188
11190
generators :=
11189
11191
Array. fold_left (fun acc json ->
11190
- match (json : Ext_json_types.t ) with
11191
- | Obj {map = m ; loc} ->
11192
- begin match String_map. find_opt Bsb_build_schemas. name m,
11193
- String_map. find_opt Bsb_build_schemas. command m with
11194
- | Some (Str {str = name } ), Some ( Str {str = command } ) ->
11195
- String_map. add name command acc
11196
- | _ , _ ->
11197
- Bsb_exception. failf ~loc {| generators exepect format like { " name" : " cppo" , " command" : " cppo $in -o $out" } | }
11198
- end
11199
- | _ -> acc ) String_map. empty s ))
11192
+ match (json : Ext_json_types.t ) with
11193
+ | Obj {map = m ; loc} ->
11194
+ begin match String_map. find_opt Bsb_build_schemas. name m,
11195
+ String_map. find_opt Bsb_build_schemas. command m with
11196
+ | Some (Str {str = name } ), Some ( Str {str = command } ) ->
11197
+ String_map. add name command acc
11198
+ | _ , _ ->
11199
+ Bsb_exception. failf ~loc {| generators exepect format like { " name" : " cppo" , " command" : " cppo $in -o $out" } | }
11200
+ end
11201
+ | _ -> acc ) String_map. empty s ))
11200
11202
|? (Bsb_build_schemas. refmt, `Str (fun s ->
11201
11203
refmt := Some (Bsb_build_util. resolve_bsb_magic_file ~cwd ~desc: Bsb_build_schemas. refmt s) ))
11202
11204
|? (Bsb_build_schemas. refmt_flags, `Arr (fun s -> refmt_flags := get_list_string s))
@@ -11226,14 +11228,14 @@ let interpret_json
11226
11228
Unix. rename output_file config_json
11227
11229
end ;
11228
11230
let package_name =
11229
- ( match ! package_name with
11230
- | Some name -> name
11231
- | None ->
11232
- failwith " Error: Package name is required. Please specify a `name` in `bsconfig.json`"
11233
- ) in
11234
- let namespace =
11231
+ match ! package_name with
11232
+ | Some name -> name
11233
+ | None ->
11234
+ failwith " Error: Package name is required. Please specify a `name` in `bsconfig.json`"
11235
+ in
11236
+ let namespace =
11235
11237
if ! namespace then
11236
- Some (Ext_package_name. module_name_of_package_name package_name)
11238
+ Some (Ext_package_name. namespace_of_package_name package_name)
11237
11239
else None in
11238
11240
{
11239
11241
package_name ;
@@ -11248,8 +11250,8 @@ let interpret_json
11248
11250
js_post_build_cmd = ! js_post_build_cmd ;
11249
11251
package_specs =
11250
11252
(match override_package_specs with
11251
- | None -> package_specs
11252
- | Some x -> x );
11253
+ | None -> package_specs
11254
+ | Some x -> x );
11253
11255
globbed_dirs = res.globbed_dirs;
11254
11256
bs_file_groups = res.files;
11255
11257
files_to_install = String_hash_set. create 96 ;
@@ -11391,9 +11393,9 @@ let output_merlin_namespace buffer ns=
11391
11393
11392
11394
let bsc_flg_to_merlin_ocamlc_flg bsc_flags =
11393
11395
merlin_flg ^
11394
- String. concat Ext_string. single_space
11395
- (List. filter (fun x -> not (Ext_string. starts_with x bs_flg_prefix )) @@
11396
- Literals. dash_nostdlib::bsc_flags)
11396
+ String. concat Ext_string. single_space
11397
+ (List. filter (fun x -> not (Ext_string. starts_with x bs_flg_prefix )) @@
11398
+ Literals. dash_nostdlib::bsc_flags)
11397
11399
11398
11400
11399
11401
let merlin_file_gen ~cwd
@@ -11413,22 +11415,17 @@ let merlin_file_gen ~cwd
11413
11415
=
11414
11416
if generate_merlin then begin
11415
11417
let buffer = Buffer. create 1024 in
11416
- (* let namespace =
11417
- if namespace then
11418
- (Some (Ext_package_name.module_name_of_package_name package_name))
11419
- else None
11420
- in *)
11421
11418
output_merlin_namespace buffer namespace;
11422
11419
ppx_flags
11423
11420
|> List. iter (fun x ->
11424
11421
Buffer. add_string buffer (merlin_flg_ppx ^ x )
11425
11422
);
11426
11423
(match reason_react_jsx with
11427
- | Some s ->
11428
- begin
11429
- Buffer. add_string buffer (merlin_flg_ppx ^ s)
11430
- end
11431
- | None -> () );
11424
+ | Some s ->
11425
+ begin
11426
+ Buffer. add_string buffer (merlin_flg_ppx ^ s)
11427
+ end
11428
+ | None -> () );
11432
11429
Buffer. add_string buffer (merlin_flg_ppx ^ built_in_ppx);
11433
11430
(*
11434
11431
(match external_includes with
@@ -12589,10 +12586,7 @@ let output_ninja_and_namespace_map
12589
12586
Bsb_build_util. flag_concat dash_i @@ List. map
12590
12587
(fun (x : Bsb_config_types.dependency ) -> x.package_install_path) bs_dev_dependencies
12591
12588
in
12592
- (* let namespace =
12593
- if namespace then
12594
- Some ( Ext_package_name.module_name_of_package_name package_name)
12595
- else None in *)
12589
+
12596
12590
begin
12597
12591
let () =
12598
12592
let bs_package_flags , namespace_flag =
@@ -13128,14 +13122,11 @@ let install_targets cwd (config : Bsb_config_types.t option) =
13128
13122
Format. fprintf Format. std_formatter " @{<info>Installing started@}@." ;
13129
13123
(* Format.pp_print_flush Format.std_formatter ();*)
13130
13124
(* Format.fprintf Format.std_formatter "@{<info>%s@} Installed @." x; *)
13131
- (* let namespace =
13132
- if namespace then
13133
- Some (Ext_package_name.module_name_of_package_name package_name)
13134
- else None in *)
13135
- (match namespace with
13136
- | None -> ()
13137
- | Some x ->
13138
- install_filename_sans_extension destdir None x);
13125
+ begin match namespace with
13126
+ | None -> ()
13127
+ | Some x ->
13128
+ install_filename_sans_extension destdir None x
13129
+ end ;
13139
13130
String_hash_set. iter (install_filename_sans_extension destdir namespace) files_to_install;
13140
13131
Format. fprintf Format. std_formatter " @{<info>Installing finished@} @." ;
13141
13132
end
0 commit comments