diff --git a/darwin/ninja.exe b/darwin/ninja.exe index 0c47c89d64..1d13f2357c 100755 Binary files a/darwin/ninja.exe and b/darwin/ninja.exe differ diff --git a/jscomp/bsb/bsb_ninja_gen.ml b/jscomp/bsb/bsb_ninja_gen.ml index 37a6e6fd91..998d574176 100644 --- a/jscomp/bsb/bsb_ninja_gen.ml +++ b/jscomp/bsb/bsb_ninja_gen.ml @@ -236,9 +236,15 @@ let output_ninja_and_namespace_map let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in mark_rescript oc; - (* Bsb_ninja_targets.output_kv - Bsb_ninja_global_vars.src_root_dir per_proj_dir - oc ; *) + let finger_file = + fun (x : Bsb_config_types.dependency) -> x.package_install_path //".ninja_log" + in + Bsb_ninja_targets.output_finger + Bsb_ninja_global_vars.g_finger + (String.concat " " + (Ext_list.map_append bs_dependencies + (Ext_list.map bs_dev_dependencies finger_file) finger_file)) + oc ; output_static_resources static_resources rules.copy_resources oc ; (** Generate build statement for each file *) Ext_list.iter bs_file_groups diff --git a/jscomp/bsb/bsb_ninja_global_vars.ml b/jscomp/bsb/bsb_ninja_global_vars.ml index 1db8998fdc..6c63a09471 100644 --- a/jscomp/bsb/bsb_ninja_global_vars.ml +++ b/jscomp/bsb/bsb_ninja_global_vars.ml @@ -33,7 +33,7 @@ (* let src_root_dir = "g_root" let lazy_src_root_dir = "$g_root" *) - +let g_finger = "g_finger" diff --git a/jscomp/bsb/bsb_ninja_rule.ml b/jscomp/bsb/bsb_ninja_rule.ml index b8d826846f..49d35f856a 100644 --- a/jscomp/bsb/bsb_ninja_rule.ml +++ b/jscomp/bsb/bsb_ninja_rule.ml @@ -125,12 +125,12 @@ let make_custom_rules ~package_name ~bsc ~warnings - ~bs_dep + ~(bs_dep : string) ~(ppx_files : Bsb_config_types.ppx list) ~bsc_flags - ~dpkg_incls - ~lib_incls - ~dev_incls + ~(dpkg_incls : string) + ~(lib_incls : string) + ~(dev_incls : string) (custom_rules : command Map_string.t) : builtin = (** FIXME: We don't need set [-o ${out}] when building ast @@ -172,6 +172,8 @@ let make_custom_rules Ext_buffer.add_string buf package_name; Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs "$in_d") end; + Ext_buffer.add_string buf " -bs-v "; + Ext_buffer.add_ninja_prefix_var buf '-' Bsb_ninja_global_vars.g_finger; Ext_buffer.add_string buf " $i"; begin match postbuild with | None -> () diff --git a/jscomp/bsb/bsb_ninja_targets.ml b/jscomp/bsb/bsb_ninja_targets.ml index 4b685f248a..593133e423 100644 --- a/jscomp/bsb/bsb_ninja_targets.ml +++ b/jscomp/bsb/bsb_ninja_targets.ml @@ -52,9 +52,9 @@ let phony ?(order_only_deps=[]) ~inputs ~output oc = end; output_string oc "\n" -let output_kv key value oc = +let output_finger key value oc = output_string oc key ; - output_string oc " = "; + output_string oc " := "; output_string oc value ; output_string oc "\n" diff --git a/jscomp/bsb/bsb_ninja_targets.mli b/jscomp/bsb/bsb_ninja_targets.mli index 5b535c0e88..164d784ba8 100644 --- a/jscomp/bsb/bsb_ninja_targets.mli +++ b/jscomp/bsb/bsb_ninja_targets.mli @@ -45,4 +45,4 @@ val phony : out_channel -> unit -val output_kv : string -> string -> out_channel -> unit +val output_finger : string -> string -> out_channel -> unit diff --git a/jscomp/ext/ext_buffer.ml b/jscomp/ext/ext_buffer.ml index 503e2a16b0..ded5d8447e 100644 --- a/jscomp/ext/ext_buffer.ml +++ b/jscomp/ext/ext_buffer.ml @@ -110,14 +110,14 @@ let add_char_string b c s = b.position <- new_position (* equivalent to add_char " "; add_char "$"; add_string s *) -let add_ninja_prefix_var b s = +let add_ninja_prefix_var b char s = let s_len = String.length s in let len = s_len + 2 in let new_position = b.position + len in if new_position > b.length then resize b len; let b_buffer = b.buffer in let b_position = b.position in - Bytes.unsafe_set b_buffer b_position ' ' ; + Bytes.unsafe_set b_buffer b_position char ; Bytes.unsafe_set b_buffer (b_position + 1) '$' ; Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len; b.position <- new_position diff --git a/jscomp/ext/ext_buffer.mli b/jscomp/ext/ext_buffer.mli index 3830c94074..ba8f4698b6 100644 --- a/jscomp/ext/ext_buffer.mli +++ b/jscomp/ext/ext_buffer.mli @@ -111,6 +111,7 @@ val add_string_char : val add_ninja_prefix_var : t -> + char -> string -> unit diff --git a/lib/4.06.1/bsb.ml b/lib/4.06.1/bsb.ml index 3e0dd45202..46b58bf2a8 100644 --- a/lib/4.06.1/bsb.ml +++ b/lib/4.06.1/bsb.ml @@ -648,6 +648,7 @@ val add_string_char : val add_ninja_prefix_var : t -> + char -> string -> unit @@ -771,14 +772,14 @@ let add_char_string b c s = b.position <- new_position (* equivalent to add_char " "; add_char "$"; add_string s *) -let add_ninja_prefix_var b s = +let add_ninja_prefix_var b char s = let s_len = String.length s in let len = s_len + 2 in let new_position = b.position + len in if new_position > b.length then resize b len; let b_buffer = b.buffer in let b_position = b.position in - Bytes.unsafe_set b_buffer b_position ' ' ; + Bytes.unsafe_set b_buffer b_position char ; Bytes.unsafe_set b_buffer (b_position + 1) '$' ; Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len; b.position <- new_position @@ -12682,6 +12683,51 @@ let output write_file fname digest buf +end +module Bsb_ninja_global_vars += struct +#1 "bsb_ninja_global_vars.ml" +(* Copyright (C) 2017 Authors of BuckleScript + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + + + + + +(* Invariant: the two string literal has + to be "a" and "$a" +*) + +(* let src_root_dir = "g_root" + +let lazy_src_root_dir = "$g_root" *) +let g_finger = "g_finger" + + + + + end module Bsb_ninja_rule : sig #1 "bsb_ninja_rule.mli" @@ -12907,12 +12953,12 @@ let make_custom_rules ~package_name ~bsc ~warnings - ~bs_dep + ~(bs_dep : string) ~(ppx_files : Bsb_config_types.ppx list) ~bsc_flags - ~dpkg_incls - ~lib_incls - ~dev_incls + ~(dpkg_incls : string) + ~(lib_incls : string) + ~(dev_incls : string) (custom_rules : command Map_string.t) : builtin = (** FIXME: We don't need set [-o ${out}] when building ast @@ -12954,6 +13000,8 @@ let make_custom_rules Ext_buffer.add_string buf package_name; Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs "$in_d") end; + Ext_buffer.add_string buf " -bs-v "; + Ext_buffer.add_ninja_prefix_var buf '-' Bsb_ninja_global_vars.g_finger; Ext_buffer.add_string buf " $i"; begin match postbuild with | None -> () @@ -13143,7 +13191,7 @@ val phony : out_channel -> unit -val output_kv : string -> string -> out_channel -> unit +val output_finger : string -> string -> out_channel -> unit end = struct #1 "bsb_ninja_targets.ml" @@ -13201,9 +13249,9 @@ let phony ?(order_only_deps=[]) ~inputs ~output oc = end; output_string oc "\n" -let output_kv key value oc = +let output_finger key value oc = output_string oc key ; - output_string oc " = "; + output_string oc " := "; output_string oc value ; output_string oc "\n" @@ -13762,9 +13810,15 @@ let output_ninja_and_namespace_map let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in mark_rescript oc; - (* Bsb_ninja_targets.output_kv - Bsb_ninja_global_vars.src_root_dir per_proj_dir - oc ; *) + let finger_file = + fun (x : Bsb_config_types.dependency) -> x.package_install_path //".ninja_log" + in + Bsb_ninja_targets.output_finger + Bsb_ninja_global_vars.g_finger + (String.concat " " + (Ext_list.map_append bs_dependencies + (Ext_list.map bs_dev_dependencies finger_file) finger_file)) + oc ; output_static_resources static_resources rules.copy_resources oc ; (** Generate build statement for each file *) Ext_list.iter bs_file_groups diff --git a/lib/4.06.1/bsb.ml.d b/lib/4.06.1/bsb.ml.d index 1b53671a37..a56413c555 100644 --- a/lib/4.06.1/bsb.ml.d +++ b/lib/4.06.1/bsb.ml.d @@ -32,6 +32,7 @@ ../lib/4.06.1/bsb.ml: ./bsb/bsb_ninja_file_groups.mli ../lib/4.06.1/bsb.ml: ./bsb/bsb_ninja_gen.ml ../lib/4.06.1/bsb.ml: ./bsb/bsb_ninja_gen.mli +../lib/4.06.1/bsb.ml: ./bsb/bsb_ninja_global_vars.ml ../lib/4.06.1/bsb.ml: ./bsb/bsb_ninja_regen.ml ../lib/4.06.1/bsb.ml: ./bsb/bsb_ninja_regen.mli ../lib/4.06.1/bsb.ml: ./bsb/bsb_ninja_rule.ml diff --git a/lib/4.06.1/bsb_helper.ml b/lib/4.06.1/bsb_helper.ml index 4489160f67..aeb74722d7 100644 --- a/lib/4.06.1/bsb_helper.ml +++ b/lib/4.06.1/bsb_helper.ml @@ -1667,6 +1667,7 @@ val add_string_char : val add_ninja_prefix_var : t -> + char -> string -> unit @@ -1790,14 +1791,14 @@ let add_char_string b c s = b.position <- new_position (* equivalent to add_char " "; add_char "$"; add_string s *) -let add_ninja_prefix_var b s = +let add_ninja_prefix_var b char s = let s_len = String.length s in let len = s_len + 2 in let new_position = b.position + len in if new_position > b.length then resize b len; let b_buffer = b.buffer in let b_position = b.position in - Bytes.unsafe_set b_buffer b_position ' ' ; + Bytes.unsafe_set b_buffer b_position char ; Bytes.unsafe_set b_buffer (b_position + 1) '$' ; Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len; b.position <- new_position diff --git a/lib/4.06.1/unstable/all_ounit_tests.ml b/lib/4.06.1/unstable/all_ounit_tests.ml index 9d99d22f54..dc43ef4b01 100644 --- a/lib/4.06.1/unstable/all_ounit_tests.ml +++ b/lib/4.06.1/unstable/all_ounit_tests.ml @@ -6463,6 +6463,7 @@ val add_string_char : val add_ninja_prefix_var : t -> + char -> string -> unit @@ -6586,14 +6587,14 @@ let add_char_string b c s = b.position <- new_position (* equivalent to add_char " "; add_char "$"; add_string s *) -let add_ninja_prefix_var b s = +let add_ninja_prefix_var b char s = let s_len = String.length s in let len = s_len + 2 in let new_position = b.position + len in if new_position > b.length then resize b len; let b_buffer = b.buffer in let b_position = b.position in - Bytes.unsafe_set b_buffer b_position ' ' ; + Bytes.unsafe_set b_buffer b_position char ; Bytes.unsafe_set b_buffer (b_position + 1) '$' ; Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len; b.position <- new_position diff --git a/lib/4.06.1/unstable/bspack.ml b/lib/4.06.1/unstable/bspack.ml index 70813b78a3..919fcda56b 100644 --- a/lib/4.06.1/unstable/bspack.ml +++ b/lib/4.06.1/unstable/bspack.ml @@ -8811,6 +8811,7 @@ val add_string_char : val add_ninja_prefix_var : t -> + char -> string -> unit @@ -8934,14 +8935,14 @@ let add_char_string b c s = b.position <- new_position (* equivalent to add_char " "; add_char "$"; add_string s *) -let add_ninja_prefix_var b s = +let add_ninja_prefix_var b char s = let s_len = String.length s in let len = s_len + 2 in let new_position = b.position + len in if new_position > b.length then resize b len; let b_buffer = b.buffer in let b_position = b.position in - Bytes.unsafe_set b_buffer b_position ' ' ; + Bytes.unsafe_set b_buffer b_position char ; Bytes.unsafe_set b_buffer (b_position + 1) '$' ; Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len; b.position <- new_position diff --git a/lib/4.06.1/unstable/js_compiler.ml b/lib/4.06.1/unstable/js_compiler.ml index 24b80c275e..876e4e147c 100644 --- a/lib/4.06.1/unstable/js_compiler.ml +++ b/lib/4.06.1/unstable/js_compiler.ml @@ -69217,6 +69217,7 @@ val add_string_char : val add_ninja_prefix_var : t -> + char -> string -> unit @@ -69340,14 +69341,14 @@ let add_char_string b c s = b.position <- new_position (* equivalent to add_char " "; add_char "$"; add_string s *) -let add_ninja_prefix_var b s = +let add_ninja_prefix_var b char s = let s_len = String.length s in let len = s_len + 2 in let new_position = b.position + len in if new_position > b.length then resize b len; let b_buffer = b.buffer in let b_position = b.position in - Bytes.unsafe_set b_buffer b_position ' ' ; + Bytes.unsafe_set b_buffer b_position char ; Bytes.unsafe_set b_buffer (b_position + 1) '$' ; Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len; b.position <- new_position diff --git a/lib/4.06.1/unstable/js_refmt_compiler.ml b/lib/4.06.1/unstable/js_refmt_compiler.ml index a29bae2899..6afeeeeaef 100644 --- a/lib/4.06.1/unstable/js_refmt_compiler.ml +++ b/lib/4.06.1/unstable/js_refmt_compiler.ml @@ -69217,6 +69217,7 @@ val add_string_char : val add_ninja_prefix_var : t -> + char -> string -> unit @@ -69340,14 +69341,14 @@ let add_char_string b c s = b.position <- new_position (* equivalent to add_char " "; add_char "$"; add_string s *) -let add_ninja_prefix_var b s = +let add_ninja_prefix_var b char s = let s_len = String.length s in let len = s_len + 2 in let new_position = b.position + len in if new_position > b.length then resize b len; let b_buffer = b.buffer in let b_position = b.position in - Bytes.unsafe_set b_buffer b_position ' ' ; + Bytes.unsafe_set b_buffer b_position char ; Bytes.unsafe_set b_buffer (b_position + 1) '$' ; Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len; b.position <- new_position diff --git a/lib/4.06.1/whole_compiler.ml b/lib/4.06.1/whole_compiler.ml index 65583a33fe..00964d5df6 100644 --- a/lib/4.06.1/whole_compiler.ml +++ b/lib/4.06.1/whole_compiler.ml @@ -353418,6 +353418,7 @@ val add_string_char : val add_ninja_prefix_var : t -> + char -> string -> unit @@ -353541,14 +353542,14 @@ let add_char_string b c s = b.position <- new_position (* equivalent to add_char " "; add_char "$"; add_string s *) -let add_ninja_prefix_var b s = +let add_ninja_prefix_var b char s = let s_len = String.length s in let len = s_len + 2 in let new_position = b.position + len in if new_position > b.length then resize b len; let b_buffer = b.buffer in let b_position = b.position in - Bytes.unsafe_set b_buffer b_position ' ' ; + Bytes.unsafe_set b_buffer b_position char ; Bytes.unsafe_set b_buffer (b_position + 1) '$' ; Ext_bytes.unsafe_blit_string s 0 b_buffer (b_position + 2) s_len; b.position <- new_position diff --git a/ninja b/ninja index 554f9ad3ae..5d08bbdd23 160000 --- a/ninja +++ b/ninja @@ -1 +1 @@ -Subproject commit 554f9ad3aec1134fa2dedce8bbe498e0f2d3acca +Subproject commit 5d08bbdd23c226abec0a17ceaf744d8f9dbaaa67