Skip to content

Commit 09f7c37

Browse files
authored
Merge pull request #3748 from BuckleScript/simple_initialization
simple initialization
2 parents b508b0d + e894639 commit 09f7c37

File tree

8 files changed

+9141
-9132
lines changed

8 files changed

+9141
-9132
lines changed

jscomp/core/bs_conditional_initial.ml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@
2424

2525

2626
let setup_env () =
27+
Clflags.compile_only := true;
28+
Clflags.bs_only := true;
29+
Clflags.no_implicit_current_dir := true;
30+
(* default true
31+
otherwise [bsc -I sc src/hello.ml ] will include current directory to search path
32+
*)
33+
Clflags.assume_no_mli := Clflags.Mli_non_exists;
34+
Clflags.unsafe_string := false;
35+
Clflags.debug := true;
36+
Clflags.record_event_when_debug := false;
37+
Clflags.binary_annotations := true;
38+
Clflags.transparent_modules := true;
39+
(* Turn on [-no-alias-deps] by default -- double check *)
40+
Oprint.out_ident := Outcome_printer_ns.out_ident;
41+
2742
#if undefined BS_RELEASE_BUILD then
2843
Printexc.record_backtrace true;
2944
(match Ext_sys.getenv_opt "BS_DEBUG_FILE" with
@@ -40,9 +55,3 @@ let setup_env () =
4055
; Switch.cut := 100 (* tweakable but not very useful *)
4156
#end
4257

43-
let standard_library =
44-
#if undefined BS_RELEASE_BUILD then
45-
Filename.concat (Filename.dirname Sys.executable_name) "ocaml"
46-
#else
47-
Config.standard_library
48-
#end

jscomp/core/bs_conditional_initial.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@
3333
*)
3434
val setup_env : unit -> unit
3535

36-
val standard_library : string

jscomp/core/ocaml_options.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,15 @@ let print_version_string () =
260260
print_newline ();
261261
exit 0
262262

263-
263+
let standard_library =
264+
#if undefined BS_RELEASE_BUILD then
265+
Filename.concat (Filename.dirname Sys.executable_name) "ocaml"
266+
#else
267+
Config.standard_library
268+
#end
269+
264270
let print_standard_library () =
265-
print_string Bs_conditional_initial.standard_library; print_newline(); exit 0
271+
print_string standard_library; print_newline(); exit 0
266272

267273
let ocaml_options =
268274
let set r () = r := true in

jscomp/main/js_main.ml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -291,22 +291,7 @@ let buckle_script_flags : (string * Arg.spec * string) list =
291291

292292

293293
let _ =
294-
(* Default configuration: sync up with
295-
{!Jsoo_main} *)
296-
Clflags.compile_only := true;
297-
Clflags.bs_only := true;
298-
Clflags.no_implicit_current_dir := true;
299-
(* default true
300-
otherwise [bsc -I sc src/hello.ml ] will include current directory to search path
301-
*)
302-
Clflags.assume_no_mli := Clflags.Mli_non_exists;
303-
Clflags.unsafe_string := false;
304-
Clflags.debug := true;
305-
Clflags.record_event_when_debug := false;
306-
Clflags.binary_annotations := true;
307-
Clflags.transparent_modules := true;
308-
(* Turn on [-no-alias-deps] by default -- double check *)
309-
Oprint.out_ident := Outcome_printer_ns.out_ident;
294+
310295
Bs_conditional_initial.setup_env ();
311296
try
312297
Compenv.readenv ppf Before_args;

jscomp/main/jsoo_main.ml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,9 @@ end
5656
* type: "error" // or "warning" or "info"
5757
* }
5858
*)
59-
let () =
60-
Clflags.compile_only := true;
61-
Clflags.bs_only := true;
62-
Oprint.out_ident := Outcome_printer_ns.out_ident;
63-
Clflags.assume_no_mli := Clflags.Mli_non_exists;
59+
let () =
6460
Bs_conditional_initial.setup_env ();
65-
Clflags.dont_write_files := true;
66-
Clflags.unsafe_string := false;
67-
Clflags.record_event_when_debug := false
61+
Clflags.binary_annotations := false
6862

6963
let error_of_exn e =
7064
#if OCAML_VERSION =~ ">4.03.0" then

lib/4.02.3/bsdep.ml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20517,7 +20517,7 @@ module Bs_conditional_initial : sig
2051720517
*)
2051820518
val setup_env : unit -> unit
2051920519

20520-
val standard_library : string
20520+
2052120521
end = struct
2052220522
#1 "bs_conditional_initial.ml"
2052320523
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
@@ -20546,15 +20546,26 @@ end = struct
2054620546

2054720547

2054820548
let setup_env () =
20549+
Clflags.compile_only := true;
20550+
Clflags.bs_only := true;
20551+
Clflags.no_implicit_current_dir := true;
20552+
(* default true
20553+
otherwise [bsc -I sc src/hello.ml ] will include current directory to search path
20554+
*)
20555+
Clflags.assume_no_mli := Clflags.Mli_non_exists;
20556+
Clflags.unsafe_string := false;
20557+
Clflags.debug := true;
20558+
Clflags.record_event_when_debug := false;
20559+
Clflags.binary_annotations := true;
20560+
Clflags.transparent_modules := true;
20561+
(* Turn on [-no-alias-deps] by default -- double check *)
20562+
Oprint.out_ident := Outcome_printer_ns.out_ident;
20563+
2054920564

2055020565
Lexer.replace_directive_bool "BS" true;
2055120566
Lexer.replace_directive_string "BS_VERSION" Bs_version.version
2055220567

2055320568

20554-
let standard_library =
20555-
20556-
Config.standard_library
20557-
2055820569

2055920570
end
2056020571
module Compenv : sig

0 commit comments

Comments
 (0)