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
27 changes: 18 additions & 9 deletions jscomp/bin/bsb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7560,9 +7560,11 @@ let bs_file_groups = ref []

let sourcedirs_meta = ".sourcedirs"
let merlin = ".merlin"
let merlin_header = "\n####{BSB GENERATED: NO EDIT\n"
let merlin_trailer = "\n####BSB GENERATED: NO EDIT}\n"
let merlin_header = "####{BSB GENERATED: NO EDIT"
let merlin_trailer = "####BSB GENERATED: NO EDIT}"
let merlin_trailer_length = String.length merlin_trailer

(** [new_content] should start end finish with newline *)
let revise_merlin new_content =
if Sys.file_exists merlin then
let merlin_chan = open_in_bin merlin in
Expand All @@ -7572,27 +7574,33 @@ let revise_merlin new_content =

let header = Ext_string.find s ~sub:merlin_header in
let tail = Ext_string.find s ~sub:merlin_trailer in
if header < 0 && tail < 0 then
if header < 0 && tail < 0 then (* locked region not added yet *)
let ochan = open_out_bin merlin in
output_string ochan s ;
output_string ochan "\n";
output_string ochan merlin_header;
Buffer.output_buffer ochan new_content;
output_string ochan merlin_trailer ;
output_string ochan "\n";
close_out ochan
else if header >=0 && tail >= 0 then
else if header >=0 && tail >= 0 then
(* there is one, hit it everytime,
should be fixed point
*)
let ochan = open_out_bin merlin in
output_string ochan (String.sub s 0 header) ;
output_string ochan merlin_header;
Buffer.output_buffer ochan new_content;
output_string ochan merlin_trailer ;
output_string ochan (Ext_string.tail_from s (tail + merlin_trailer_length));
close_out ochan
else assert false
else failwith ("the .merlin is corrupted, locked region by bsb is not consistent ")
else
let ochan = open_out_bin merlin in
output_string ochan merlin_header ;
Buffer.output_buffer ochan new_content;
output_string ochan merlin_trailer ;
output_string ochan "\n";
close_out ochan
(*TODO: it is a little mess that [cwd] and [project dir] are shared*)
(** *)
Expand All @@ -7616,11 +7624,12 @@ let write_ninja_file bsc_dir cwd =
let () =
Bsb_default.get_ppx_flags ()
|> List.iter (fun x ->
Buffer.add_string buffer (Printf.sprintf "FLG -ppx %s\n" x )
Buffer.add_string buffer (Printf.sprintf "\nFLG -ppx %s" x )
)
in
let () = Buffer.add_string buffer
(Printf.sprintf "S %s\n\
(Printf.sprintf "\n\
S %s\n\
B %s\n\
FLG -ppx %s\n\
" lib_ocaml_dir lib_ocaml_dir bsppx
Expand All @@ -7630,7 +7639,7 @@ let write_ninja_file bsc_dir cwd =
| [] -> ()
| xs ->
Buffer.add_string buffer
(Printf.sprintf "FLG %s\n" (String.concat " " xs) ) in
(Printf.sprintf "\nFLG %s" (String.concat " " xs) ) in
let () =
Bsb_default.get_bs_dependencies ()
|> List.iter (fun package ->
Expand All @@ -7646,7 +7655,7 @@ let write_ninja_file bsc_dir cwd =
in
res.files |> List.iter
(fun (x : Bsb_build_ui.file_group) ->
output_string ochan x.dir;
output_string ochan x.dir; (* to [.sourcedirs] *)
output_string ochan "\n" ;
Buffer.add_string buffer "\nS ";
Buffer.add_string buffer x.dir ;
Expand Down
Binary file modified jscomp/bin/bsb.win
Binary file not shown.
Binary file modified jscomp/bin/bsb_helper.win
Binary file not shown.
Binary file modified jscomp/bin/bsc.win
Binary file not shown.
2 changes: 1 addition & 1 deletion jscomp/bin/bsdep.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ val version : string

end = struct
#1 "bs_version.ml"
let version = "1.3.4"
let version = "1.4.0"

end
module Terminfo : sig
Expand Down
Binary file modified jscomp/bin/bsdep.win
Binary file not shown.
Binary file modified jscomp/bin/bspack.win
Binary file not shown.
Binary file modified jscomp/bin/bspp.win
Binary file not shown.
2 changes: 1 addition & 1 deletion jscomp/bin/bsppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7801,7 +7801,7 @@ val version : string

end = struct
#1 "bs_version.ml"
let version = "1.3.4"
let version = "1.4.0"

end
module Ext_pervasives : sig
Expand Down
Binary file modified jscomp/bin/bsppx.win
Binary file not shown.
2 changes: 1 addition & 1 deletion jscomp/bin/whole_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ val version : string

end = struct
#1 "bs_version.ml"
let version = "1.3.4"
let version = "1.4.0"

end
module Terminfo : sig
Expand Down
27 changes: 18 additions & 9 deletions jscomp/bsb/bsb_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ let bs_file_groups = ref []

let sourcedirs_meta = ".sourcedirs"
let merlin = ".merlin"
let merlin_header = "\n####{BSB GENERATED: NO EDIT\n"
let merlin_trailer = "\n####BSB GENERATED: NO EDIT}\n"
let merlin_header = "####{BSB GENERATED: NO EDIT"
let merlin_trailer = "####BSB GENERATED: NO EDIT}"
let merlin_trailer_length = String.length merlin_trailer

(** [new_content] should start end finish with newline *)
let revise_merlin new_content =
if Sys.file_exists merlin then
let merlin_chan = open_in_bin merlin in
Expand All @@ -51,27 +53,33 @@ let revise_merlin new_content =

let header = Ext_string.find s ~sub:merlin_header in
let tail = Ext_string.find s ~sub:merlin_trailer in
if header < 0 && tail < 0 then
if header < 0 && tail < 0 then (* locked region not added yet *)
let ochan = open_out_bin merlin in
output_string ochan s ;
output_string ochan "\n";
output_string ochan merlin_header;
Buffer.output_buffer ochan new_content;
output_string ochan merlin_trailer ;
output_string ochan "\n";
close_out ochan
else if header >=0 && tail >= 0 then
else if header >=0 && tail >= 0 then
(* there is one, hit it everytime,
should be fixed point
*)
let ochan = open_out_bin merlin in
output_string ochan (String.sub s 0 header) ;
output_string ochan merlin_header;
Buffer.output_buffer ochan new_content;
output_string ochan merlin_trailer ;
output_string ochan (Ext_string.tail_from s (tail + merlin_trailer_length));
close_out ochan
else assert false
else failwith ("the .merlin is corrupted, locked region by bsb is not consistent ")
else
let ochan = open_out_bin merlin in
output_string ochan merlin_header ;
Buffer.output_buffer ochan new_content;
output_string ochan merlin_trailer ;
output_string ochan "\n";
close_out ochan
(*TODO: it is a little mess that [cwd] and [project dir] are shared*)
(** *)
Expand All @@ -95,11 +103,12 @@ let write_ninja_file bsc_dir cwd =
let () =
Bsb_default.get_ppx_flags ()
|> List.iter (fun x ->
Buffer.add_string buffer (Printf.sprintf "FLG -ppx %s\n" x )
Buffer.add_string buffer (Printf.sprintf "\nFLG -ppx %s" x )
)
in
let () = Buffer.add_string buffer
(Printf.sprintf "S %s\n\
(Printf.sprintf "\n\
S %s\n\
B %s\n\
FLG -ppx %s\n\
" lib_ocaml_dir lib_ocaml_dir bsppx
Expand All @@ -109,7 +118,7 @@ let write_ninja_file bsc_dir cwd =
| [] -> ()
| xs ->
Buffer.add_string buffer
(Printf.sprintf "FLG %s\n" (String.concat " " xs) ) in
(Printf.sprintf "\nFLG %s" (String.concat " " xs) ) in
let () =
Bsb_default.get_bs_dependencies ()
|> List.iter (fun package ->
Expand All @@ -125,7 +134,7 @@ let write_ninja_file bsc_dir cwd =
in
res.files |> List.iter
(fun (x : Bsb_build_ui.file_group) ->
output_string ochan x.dir;
output_string ochan x.dir; (* to [.sourcedirs] *)
output_string ochan "\n" ;
Buffer.add_string buffer "\nS ";
Buffer.add_string buffer x.dir ;
Expand Down
2 changes: 1 addition & 1 deletion jscomp/common/bs_version.ml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
let version = "1.3.4"
let version = "1.4.0"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"postinstall": "node scripts/install.js"
},
"name": "bs-platform",
"version": "1.3.4",
"version": "1.4.0",
"description": "bucklescript compiler, ocaml standard libary by bucklescript and its required runtime support",
"repository": {
"type": "git",
Expand Down