Skip to content

Commit aa42fae

Browse files
authored
Merge pull request #1065 from bloomberg/build_fix
wip:fix for build
2 parents 8b59c70 + b574a4a commit aa42fae

File tree

11 files changed

+48
-32
lines changed

11 files changed

+48
-32
lines changed

jscomp/bin/bsb.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6914,7 +6914,7 @@ type t =
69146914

69156915

69166916
let magic_number = "BS_DEP_INFOS_20161116"
6917-
let bsb_version = "20160104+dev"
6917+
let bsb_version = "20160109+dev"
69186918

69196919
let write (fname : string) (x : t) =
69206920
let oc = open_out_bin fname in
@@ -7009,7 +7009,7 @@ module Rules : sig
70097009
val copy_resources : t
70107010
val build_ml_from_mll : t
70117011
val build_cmj_js : t
7012-
val build_cmi_cmj_js : t
7012+
val build_cmj_cmi_js : t
70137013
val build_cmi : t
70147014
end
70157015

@@ -7183,24 +7183,24 @@ module Rules = struct
71837183
(**************************************)
71847184
let build_cmj_js =
71857185
define
7186-
~command:"${bsc} ${bs_package_flags} -bs-no-builtin-ppx-ml -bs-no-implicit-include \
7186+
~command:"${bsc} ${bs_package_flags} -bs-assume-has-mli -bs-no-builtin-ppx-ml -bs-no-implicit-include \
71877187
${bs_package_includes} ${bsc_includes} ${bsc_flags} -o ${in} -c ${in} ${postbuild}"
71887188

71897189
~depfile:"${in}.d"
71907190
"build_cmj_only"
71917191

7192-
let build_cmi_cmj_js =
7192+
let build_cmj_cmi_js =
71937193
define
71947194
~command:"${bsc} ${bs_package_flags} -bs-assume-no-mli -bs-no-builtin-ppx-ml -bs-no-implicit-include \
71957195
${bs_package_includes} ${bsc_includes} ${bsc_flags} -o ${in} -c ${in} ${postbuild}"
71967196
~depfile:"${in}.d"
7197-
"build_cmj_cmi"
7197+
"build_cmj_cmi" (* the compiler should never consult [.cmi] when [.mli] does not exist *)
71987198
let build_cmi =
71997199
define
72007200
~command:"${bsc} ${bs_package_flags} -bs-no-builtin-ppx-mli -bs-no-implicit-include \
72017201
${bs_package_includes} ${bsc_includes} ${bsc_flags} -o ${out} -c ${in}"
72027202
~depfile:"${in}.d"
7203-
"build_cmi"
7203+
"build_cmi" (* the compiler should always consult [.cmi], current the vanilla ocaml compiler only consult [.cmi] when [.mli] found*)
72047204
end
72057205

72067206
let output_build
@@ -7413,9 +7413,9 @@ let handle_file_group oc ~package_specs ~js_post_build_cmd acc (group: Bsb_buil
74137413
~rule:Rules.build_bin_deps ;
74147414
let rule_name , cm_outputs, deps =
74157415
if module_info.mli = Mli_empty then
7416-
Rules.build_cmj_js,
7417-
[ output_cmi] , []
7418-
else Rules.build_cmi_cmj_js, [], [output_cmi]
7416+
Rules.build_cmj_cmi_js, [output_cmi], []
7417+
else Rules.build_cmj_js, [] , [output_cmi]
7418+
74197419
in
74207420
let shadows =
74217421
match js_post_build_cmd with

jscomp/bin/bsdep.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4171,8 +4171,9 @@ val unsafe_string : bool ref
41714171
val opaque : bool ref
41724172

41734173

4174+
type mli_status = Mli_na | Mli_exists | Mli_non_exists
41744175
val no_implicit_current_dir : bool ref
4175-
val assume_no_mli : bool ref
4176+
val assume_no_mli : mli_status ref
41764177

41774178

41784179
end = struct
@@ -4294,8 +4295,9 @@ let keep_locs = ref false (* -keep-locs *)
42944295
let unsafe_string = ref true;; (* -safe-string / -unsafe-string *)
42954296

42964297

4298+
type mli_status = Mli_na | Mli_exists | Mli_non_exists
42974299
let no_implicit_current_dir = ref false
4298-
let assume_no_mli = ref false
4300+
let assume_no_mli = ref Mli_na
42994301

43004302

43014303
end

jscomp/bin/bsppx.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10178,8 +10178,9 @@ val unsafe_string : bool ref
1017810178
val opaque : bool ref
1017910179

1018010180

10181+
type mli_status = Mli_na | Mli_exists | Mli_non_exists
1018110182
val no_implicit_current_dir : bool ref
10182-
val assume_no_mli : bool ref
10183+
val assume_no_mli : mli_status ref
1018310184

1018410185

1018510186
end = struct
@@ -10301,8 +10302,9 @@ let keep_locs = ref false (* -keep-locs *)
1030110302
let unsafe_string = ref true;; (* -safe-string / -unsafe-string *)
1030210303

1030310304

10305+
type mli_status = Mli_na | Mli_exists | Mli_non_exists
1030410306
let no_implicit_current_dir = ref false
10305-
let assume_no_mli = ref false
10307+
let assume_no_mli = ref Mli_na
1030610308

1030710309

1030810310
end

jscomp/bin/whole_compiler.ml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4171,8 +4171,9 @@ val unsafe_string : bool ref
41714171
val opaque : bool ref
41724172

41734173

4174+
type mli_status = Mli_na | Mli_exists | Mli_non_exists
41744175
val no_implicit_current_dir : bool ref
4175-
val assume_no_mli : bool ref
4176+
val assume_no_mli : mli_status ref
41764177

41774178

41784179
end = struct
@@ -4294,8 +4295,9 @@ let keep_locs = ref false (* -keep-locs *)
42944295
let unsafe_string = ref true;; (* -safe-string / -unsafe-string *)
42954296

42964297

4298+
type mli_status = Mli_na | Mli_exists | Mli_non_exists
42974299
let no_implicit_current_dir = ref false
4298-
let assume_no_mli = ref false
4300+
let assume_no_mli = ref Mli_na
42994301

43004302

43014303
end
@@ -56655,7 +56657,8 @@ let type_implementation_more sourcefile outputprefix modulename initial_env ast
5665556657
let sourceintf =
5665656658
Misc.chop_extension_if_any sourcefile ^ !Config.interface_suffix in
5665756659

56658-
if not !Clflags.assume_no_mli && Sys.file_exists sourceintf then begin
56660+
let mli_status = !Clflags.assume_no_mli in
56661+
if (mli_status = Clflags.Mli_na && Sys.file_exists sourceintf) || (mli_status = Clflags.Mli_exists) then begin
5665956662

5666056663
let intf_file =
5666156664
try
@@ -56754,7 +56757,8 @@ let package_units initial_env objfiles cmifile modulename =
5675456757
let prefix = chop_extension_if_any cmifile in
5675556758
let mlifile = prefix ^ !Config.interface_suffix in
5675656759

56757-
if not !Clflags.assume_no_mli && Sys.file_exists mlifile then begin
56760+
let mli_status = !Clflags.assume_no_mli in
56761+
if (mli_status = Clflags.Mli_na && Sys.file_exists mlifile) || (mli_status = Clflags.Mli_exists) then begin
5675856762

5675956763
if not (Sys.file_exists cmifile) then begin
5676056764
raise(Error(Location.in_file mlifile, Env.empty,
@@ -105089,9 +105093,12 @@ let define_variable s =
105089105093
let buckle_script_flags =
105090105094
("-bs-no-implicit-include", Arg.Set Clflags.no_implicit_current_dir
105091105095
, " Don't include current dir implicitly")
105096+
::
105097+
("-bs-assume-has-mli", Arg.Unit (fun _ -> Clflags.assume_no_mli := Clflags.Mli_exists),
105098+
" (internal) Assume mli always exist ")
105092105099
::
105093-
("-bs-assume-no-mli", Arg.Set Clflags.assume_no_mli,
105094-
" Don't lookup whether mli exist or not")
105100+
("-bs-assume-no-mli", Arg.Unit (fun _ -> Clflags.assume_no_mli := Clflags.Mli_non_exists),
105101+
" (internal) Don't lookup whether mli exist or not")
105095105102
::
105096105103
("-bs-D", Arg.String define_variable,
105097105104
" Define conditional variable e.g, -D DEBUG=true"

jscomp/bsb/bsb_dep_infos.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type t =
3535

3636

3737
let magic_number = "BS_DEP_INFOS_20161116"
38-
let bsb_version = "20160104+dev"
38+
let bsb_version = "20160109+dev"
3939

4040
let write (fname : string) (x : t) =
4141
let oc = open_out_bin fname in

jscomp/bsb/bsb_ninja.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,24 @@ module Rules = struct
135135
(**************************************)
136136
let build_cmj_js =
137137
define
138-
~command:"${bsc} ${bs_package_flags} -bs-no-builtin-ppx-ml -bs-no-implicit-include \
138+
~command:"${bsc} ${bs_package_flags} -bs-assume-has-mli -bs-no-builtin-ppx-ml -bs-no-implicit-include \
139139
${bs_package_includes} ${bsc_includes} ${bsc_flags} -o ${in} -c ${in} ${postbuild}"
140140

141141
~depfile:"${in}.d"
142142
"build_cmj_only"
143143

144-
let build_cmi_cmj_js =
144+
let build_cmj_cmi_js =
145145
define
146146
~command:"${bsc} ${bs_package_flags} -bs-assume-no-mli -bs-no-builtin-ppx-ml -bs-no-implicit-include \
147147
${bs_package_includes} ${bsc_includes} ${bsc_flags} -o ${in} -c ${in} ${postbuild}"
148148
~depfile:"${in}.d"
149-
"build_cmj_cmi"
149+
"build_cmj_cmi" (* the compiler should never consult [.cmi] when [.mli] does not exist *)
150150
let build_cmi =
151151
define
152152
~command:"${bsc} ${bs_package_flags} -bs-no-builtin-ppx-mli -bs-no-implicit-include \
153153
${bs_package_includes} ${bsc_includes} ${bsc_flags} -o ${out} -c ${in}"
154154
~depfile:"${in}.d"
155-
"build_cmi"
155+
"build_cmi" (* the compiler should always consult [.cmi], current the vanilla ocaml compiler only consult [.cmi] when [.mli] found*)
156156
end
157157

158158
let output_build
@@ -365,9 +365,9 @@ let handle_file_group oc ~package_specs ~js_post_build_cmd acc (group: Bsb_buil
365365
~rule:Rules.build_bin_deps ;
366366
let rule_name , cm_outputs, deps =
367367
if module_info.mli = Mli_empty then
368-
Rules.build_cmj_js,
369-
[ output_cmi] , []
370-
else Rules.build_cmi_cmj_js, [], [output_cmi]
368+
Rules.build_cmj_cmi_js, [output_cmi], []
369+
else Rules.build_cmj_js, [] , [output_cmi]
370+
371371
in
372372
let shadows =
373373
match js_post_build_cmd with

jscomp/bsb/bsb_ninja.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module Rules : sig
4444
val copy_resources : t
4545
val build_ml_from_mll : t
4646
val build_cmj_js : t
47-
val build_cmi_cmj_js : t
47+
val build_cmj_cmi_js : t
4848
val build_cmi : t
4949
end
5050

jscomp/core/js_main.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ let define_variable s =
130130
let buckle_script_flags =
131131
("-bs-no-implicit-include", Arg.Set Clflags.no_implicit_current_dir
132132
, " Don't include current dir implicitly")
133+
::
134+
("-bs-assume-has-mli", Arg.Unit (fun _ -> Clflags.assume_no_mli := Clflags.Mli_exists),
135+
" (internal) Assume mli always exist ")
133136
::
134-
("-bs-assume-no-mli", Arg.Set Clflags.assume_no_mli,
135-
" Don't lookup whether mli exist or not")
137+
("-bs-assume-no-mli", Arg.Unit (fun _ -> Clflags.assume_no_mli := Clflags.Mli_non_exists),
138+
" (internal) Don't lookup whether mli exist or not")
136139
::
137140
("-bs-D", Arg.String define_variable,
138141
" Define conditional variable e.g, -D DEBUG=true"

jscomp/core/jsoo_main.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* }
4040
*)
4141
let () =
42-
Clflags.assume_no_mli := true;
42+
Clflags.assume_no_mli := Clflags.Mli_non_exists;
4343
Bs_conditional_initial.setup_env ();
4444
Clflags.dont_write_files := true;
4545
Clflags.unsafe_string := false

jscomp/test/hello_reason.re

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
2+
let hello = "hello";
13
Js.log Hello_reason_dep.hello;

ocaml

Submodule ocaml updated from 2595978 to ee951e7

0 commit comments

Comments
 (0)