@@ -3276,97 +3276,6 @@ type ts = t array
32763276
32773277
32783278
3279- end
3280- module Bsb_dir_index : sig
3281- #1 "bsb_dir_index.mli"
3282- (* Copyright (C) 2017 Authors of BuckleScript
3283- *
3284- * This program is free software: you can redistribute it and/or modify
3285- * it under the terms of the GNU Lesser General Public License as published by
3286- * the Free Software Foundation, either version 3 of the License, or
3287- * (at your option) any later version.
3288- *
3289- * In addition to the permissions granted to you by the LGPL, you may combine
3290- * or link a "work that uses the Library" with a publicly distributed version
3291- * of this file to produce a combined library or application, then distribute
3292- * that combined work under the terms of your choosing, with no requirement
3293- * to comply with the obligations normally placed on you by section 4 of the
3294- * LGPL version 3 (or the corresponding section of a later version of the LGPL
3295- * should you choose to use a later version).
3296- *
3297- * This program is distributed in the hope that it will be useful,
3298- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3299- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3300- * GNU Lesser General Public License for more details.
3301- *
3302- * You should have received a copy of the GNU Lesser General Public License
3303- * along with this program; if not, write to the Free Software
3304- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
3305-
3306- (** Used to index [.bsbuildcache] may not be needed if we flatten dev
3307- into a single group
3308- *)
3309- type t = private int
3310-
3311- val lib_dir_index : t
3312-
3313- val is_lib_dir : t -> bool
3314-
3315- val get_dev_index : unit -> t
3316-
3317-
3318-
3319-
3320-
3321-
3322- end = struct
3323- #1 "bsb_dir_index.ml"
3324- (* Copyright (C) 2017 Authors of BuckleScript
3325- *
3326- * This program is free software: you can redistribute it and/or modify
3327- * it under the terms of the GNU Lesser General Public License as published by
3328- * the Free Software Foundation, either version 3 of the License, or
3329- * (at your option) any later version.
3330- *
3331- * In addition to the permissions granted to you by the LGPL, you may combine
3332- * or link a "work that uses the Library" with a publicly distributed version
3333- * of this file to produce a combined library or application, then distribute
3334- * that combined work under the terms of your choosing, with no requirement
3335- * to comply with the obligations normally placed on you by section 4 of the
3336- * LGPL version 3 (or the corresponding section of a later version of the LGPL
3337- * should you choose to use a later version).
3338- *
3339- * This program is distributed in the hope that it will be useful,
3340- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3341- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3342- * GNU Lesser General Public License for more details.
3343- *
3344- * You should have received a copy of the GNU Lesser General Public License
3345- * along with this program; if not, write to the Free Software
3346- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
3347-
3348- type t = int
3349-
3350- (**
3351- 0 : lib
3352- 1 : dev 1
3353- 2 : dev 2
3354- *)
3355-
3356- let lib_dir_index = 0
3357-
3358- let is_lib_dir x = x = lib_dir_index
3359-
3360-
3361-
3362- let get_dev_index ( ) = 1
3363-
3364-
3365-
3366-
3367-
3368-
3369-
33703279end
33713280module Set_gen
33723281= struct
@@ -4045,7 +3954,7 @@ type file_group =
40453954 sources : Bsb_db.t;
40463955 resources : string list ;
40473956 public : public ;
4048- dir_index : Bsb_dir_index.t ;
3957+ dir_index : bool ; (* false means not in dev mode *)
40493958 generators : build_generator list ;
40503959 (* output of [generators] should be added to [sources],
40513960 if it is [.ml,.mli,.re,.rei]
@@ -4122,7 +4031,7 @@ type file_group =
41224031 sources : Bsb_db.t;
41234032 resources : string list ;
41244033 public : public ;
4125- dir_index : Bsb_dir_index.t ;
4034+ dir_index : bool ;
41264035 generators : build_generator list ;
41274036 (* output of [generators] should be added to [sources],
41284037 if it is [.ml,.mli,.re,.rei]
@@ -10565,7 +10474,7 @@ let errorf x fmt =
1056510474
1056610475type cxt = {
1056710476 toplevel : bool ;
10568- dir_index : Bsb_dir_index.t ;
10477+ dir_index : bool ;
1056910478 cwd : string ;
1057010479 root : string;
1057110480 cut_generators : bool;
@@ -10870,7 +10779,7 @@ and parsing_single_source ({toplevel; dir_index ; cwd} as cxt ) (x : Ext_json_ty
1087010779 : t =
1087110780 match x with
1087210781 | Str { str = dir } ->
10873- if not toplevel && not (Bsb_dir_index.is_lib_dir dir_index) then
10782+ if not toplevel && dir_index then
1087410783 Bsb_file_groups.empty
1087510784 else
1087610785 parsing_source_dir_map
@@ -10881,10 +10790,10 @@ and parsing_single_source ({toplevel; dir_index ; cwd} as cxt ) (x : Ext_json_ty
1088110790 let current_dir_index =
1088210791 match Map_string.find_opt map Bsb_build_schemas.type_ with
1088310792 | Some (Str {str="dev"}) ->
10884- Bsb_dir_index.get_dev_index ()
10793+ true
1088510794 | Some _ -> Bsb_exception.config_error x {|type field expect "dev" literal |}
1088610795 | None -> dir_index in
10887- if not toplevel && not (Bsb_dir_index.is_lib_dir current_dir_index) then
10796+ if not toplevel && current_dir_index then
1088810797 Bsb_file_groups.empty
1088910798 else
1089010799 let dir =
@@ -10925,7 +10834,7 @@ let scan
1092510834 parse_sources {
1092610835 ignored_dirs;
1092710836 toplevel;
10928- dir_index = Bsb_dir_index.lib_dir_index ;
10837+ dir_index = false ;
1092910838 cwd = Filename.current_dir_name;
1093010839 root ;
1093110840 cut_generators;
@@ -13411,7 +13320,7 @@ let make_common_shadows
1341113320let emit_module_build
1341213321 (rules : Bsb_ninja_rule.builtin)
1341313322 (package_specs : Bsb_package_specs.t)
13414- (group_dir_index : Bsb_dir_index.t )
13323+ (is_dev : bool )
1341513324 oc
1341613325 ~bs_suffix
1341713326 js_post_build_cmd
@@ -13421,7 +13330,6 @@ let emit_module_build
1342113330 let has_intf_file = module_info.info = Ml_mli in
1342213331 let is_re = module_info.is_re in
1342313332 let filename_sans_extension = module_info.name_sans_extension in
13424- let is_dev = not (Bsb_dir_index.is_lib_dir group_dir_index) in
1342513333 let input_impl =
1342613334 Bsb_config.proj_rel
1342713335 (filename_sans_extension ^ if is_re then Literals.suffix_re else Literals.suffix_ml ) in
@@ -13762,7 +13670,7 @@ let output_ninja_and_namespace_map
1376213670 let static_resources =
1376313671 Ext_list.fold_left bs_file_groups [] (fun (acc_resources : string list) {sources; dir; resources; dir_index}
1376413672 ->
13765- let dir_index = ( dir_index :> int) in
13673+ let dir_index = if dir_index then 1 else 0 in
1376613674 bs_groups.(dir_index) <- Bsb_db_util.merge bs_groups.(dir_index) sources ;
1376713675 source_dirs.(dir_index) <- dir :: source_dirs.(dir_index);
1376813676 Ext_list.map_append resources acc_resources (fun x -> dir//x)
0 commit comments