@@ -648,6 +648,7 @@ val add_string_char :
648648
649649val add_ninja_prefix_var :
650650 t ->
651+ char ->
651652 string ->
652653 unit
653654
@@ -771,14 +772,14 @@ let add_char_string b c s =
771772 b.position <- new_position
772773
773774(* equivalent to add_char " "; add_char "$"; add_string s *)
774- let add_ninja_prefix_var b s =
775+ let add_ninja_prefix_var b char s =
775776 let s_len = String.length s in
776777 let len = s_len + 2 in
777778 let new_position = b.position + len in
778779 if new_position > b.length then resize b len;
779780 let b_buffer = b.buffer in
780781 let b_position = b.position in
781- Bytes.unsafe_set b_buffer b_position ' ' ;
782+ Bytes.unsafe_set b_buffer b_position char ;
782783 Bytes.unsafe_set b_buffer (b_position + 1) '$' ;
783784 Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len;
784785 b.position <- new_position
@@ -12682,6 +12683,51 @@ let output
1268212683 write_file fname digest buf
1268312684
1268412685
12686+ end
12687+ module Bsb_ninja_global_vars
12688+ = struct
12689+ #1 "bsb_ninja_global_vars.ml"
12690+ (* Copyright (C) 2017 Authors of BuckleScript
12691+ *
12692+ * This program is free software: you can redistribute it and/or modify
12693+ * it under the terms of the GNU Lesser General Public License as published by
12694+ * the Free Software Foundation, either version 3 of the License, or
12695+ * (at your option) any later version.
12696+ *
12697+ * In addition to the permissions granted to you by the LGPL, you may combine
12698+ * or link a "work that uses the Library" with a publicly distributed version
12699+ * of this file to produce a combined library or application, then distribute
12700+ * that combined work under the terms of your choosing, with no requirement
12701+ * to comply with the obligations normally placed on you by section 4 of the
12702+ * LGPL version 3 (or the corresponding section of a later version of the LGPL
12703+ * should you choose to use a later version).
12704+ *
12705+ * This program is distributed in the hope that it will be useful,
12706+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12707+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12708+ * GNU Lesser General Public License for more details.
12709+ *
12710+ * You should have received a copy of the GNU Lesser General Public License
12711+ * along with this program; if not, write to the Free Software
12712+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
12713+
12714+
12715+
12716+
12717+
12718+ (* Invariant: the two string literal has
12719+ to be "a" and "$a"
12720+ *)
12721+
12722+ (* let src_root_dir = "g_root"
12723+
12724+ let lazy_src_root_dir = "$g_root" *)
12725+ let g_finger = "g_finger"
12726+
12727+
12728+
12729+
12730+
1268512731end
1268612732module Bsb_ninja_rule : sig
1268712733#1 "bsb_ninja_rule.mli"
@@ -12907,12 +12953,12 @@ let make_custom_rules
1290712953 ~package_name
1290812954 ~bsc
1290912955 ~warnings
12910- ~bs_dep
12956+ ~( bs_dep : string)
1291112957 ~(ppx_files : Bsb_config_types.ppx list)
1291212958 ~bsc_flags
12913- ~dpkg_incls
12914- ~lib_incls
12915- ~dev_incls
12959+ ~( dpkg_incls : string)
12960+ ~( lib_incls : string)
12961+ ~( dev_incls : string)
1291612962 (custom_rules : command Map_string.t) :
1291712963 builtin =
1291812964 (** FIXME: We don't need set [-o ${out}] when building ast
@@ -12954,6 +13000,8 @@ let make_custom_rules
1295413000 Ext_buffer.add_string buf package_name;
1295513001 Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs "$in_d")
1295613002 end;
13003+ Ext_buffer.add_string buf " -bs-v ";
13004+ Ext_buffer.add_ninja_prefix_var buf '-' Bsb_ninja_global_vars.g_finger;
1295713005 Ext_buffer.add_string buf " $i";
1295813006 begin match postbuild with
1295913007 | None -> ()
@@ -13143,7 +13191,7 @@ val phony :
1314313191 out_channel ->
1314413192 unit
1314513193
13146- val output_kv : string -> string -> out_channel -> unit
13194+ val output_finger : string -> string -> out_channel -> unit
1314713195
1314813196end = struct
1314913197#1 "bsb_ninja_targets.ml"
@@ -13201,9 +13249,9 @@ let phony ?(order_only_deps=[]) ~inputs ~output oc =
1320113249 end;
1320213250 output_string oc "\n"
1320313251
13204- let output_kv key value oc =
13252+ let output_finger key value oc =
1320513253 output_string oc key ;
13206- output_string oc " = ";
13254+ output_string oc " : = ";
1320713255 output_string oc value ;
1320813256 output_string oc "\n"
1320913257
@@ -13762,9 +13810,15 @@ let output_ninja_and_namespace_map
1376213810
1376313811 let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in
1376413812 mark_rescript oc;
13765- (* Bsb_ninja_targets.output_kv
13766- Bsb_ninja_global_vars.src_root_dir per_proj_dir
13767- oc ; *)
13813+ let finger_file =
13814+ fun (x : Bsb_config_types.dependency) -> x.package_install_path //".ninja_log"
13815+ in
13816+ Bsb_ninja_targets.output_finger
13817+ Bsb_ninja_global_vars.g_finger
13818+ (String.concat " "
13819+ (Ext_list.map_append bs_dependencies
13820+ (Ext_list.map bs_dev_dependencies finger_file) finger_file))
13821+ oc ;
1376813822 output_static_resources static_resources rules.copy_resources oc ;
1376913823 (** Generate build statement for each file *)
1377013824 Ext_list.iter bs_file_groups
0 commit comments