Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified darwin/ninja.exe
Binary file not shown.
12 changes: 9 additions & 3 deletions jscomp/bsb/bsb_ninja_gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion jscomp/bsb/bsb_ninja_global_vars.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
(* let src_root_dir = "g_root"

let lazy_src_root_dir = "$g_root" *)

let g_finger = "g_finger"



Expand Down
10 changes: 6 additions & 4 deletions jscomp/bsb/bsb_ninja_rule.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 -> ()
Expand Down
4 changes: 2 additions & 2 deletions jscomp/bsb/bsb_ninja_targets.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion jscomp/bsb/bsb_ninja_targets.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions jscomp/ext/ext_buffer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions jscomp/ext/ext_buffer.mli
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ val add_string_char :

val add_ninja_prefix_var :
t ->
char ->
string ->
unit

Expand Down
78 changes: 66 additions & 12 deletions lib/4.06.1/bsb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ val add_string_char :

val add_ninja_prefix_var :
t ->
char ->
string ->
unit

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 -> ()
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/4.06.1/bsb.ml.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions lib/4.06.1/bsb_helper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,7 @@ val add_string_char :

val add_ninja_prefix_var :
t ->
char ->
string ->
unit

Expand Down Expand Up @@ -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
Expand Down
Loading