Skip to content

Commit dfa766c

Browse files
committed
Fix stale builds
- Add an internal flag cmj_only (not generating js) - remove transparent module by default - upgrade ocaml compiler to record more depends
1 parent fe47e11 commit dfa766c

18 files changed

+79
-41
lines changed

jscomp/bsb/bsb_ninja_rule.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ let make_custom_rules
226226
~name:"ml_cmi" in
227227
let build_package =
228228
define
229-
~command:"$bsc -w -49 -color always -no-alias-deps -bs-cmi-only $in"
229+
~command:"$bsc -w -49 -color always -no-alias-deps $in"
230230
~restat:()
231231
"build_package"
232232
in

jscomp/common/js_config.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ let bs_suffix = ref false
9898
let debug = ref false
9999

100100
let cmi_only = ref false
101+
let cmj_only = ref false
102+
101103
let force_cmi = ref false
102104
let force_cmj = ref false
103105

jscomp/common/js_config.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ val bs_suffix : bool ref
9494
val debug : bool ref
9595

9696
val cmi_only : bool ref
97+
val cmj_only : bool ref
98+
(* stopped after generating cmj *)
9799
val force_cmi : bool ref
98100
val force_cmj : bool ref
99101

jscomp/core/bs_conditional_initial.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ let setup_env () =
3535
Clflags.debug := true;
3636
Clflags.record_event_when_debug := false;
3737
Clflags.binary_annotations := true;
38-
Clflags.transparent_modules := true;
3938
(* Turn on [-no-alias-deps] by default -- double check *)
4039
Oprint.out_ident := Outcome_printer_ns.out_ident;
4140

jscomp/core/js_implementation.ml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,13 @@ let after_parsing_impl ppf outputprefix ast =
153153
(typedtree, coercion)
154154
|> Translmod.transl_implementation modulename
155155
|> (fun lambda ->
156+
let js_program =
156157
print_if ppf Clflags.dump_rawlambda Printlambda.lambda (get_lambda lambda)
157-
|>
158-
Lam_compile_main.lambda_as_module
159-
finalenv
160-
outputprefix
158+
|> Lam_compile_main.compile outputprefix finalenv in
159+
if not !Js_config.cmj_only then
160+
Lam_compile_main.lambda_as_module
161+
js_program
162+
outputprefix
161163
);
162164
end;
163165
process_with_gentype (outputprefix ^ ".cmt")
@@ -198,6 +200,7 @@ let make_structure_item ~ns cunit : Parsetree.structure_item =
198200
keep in sync {!Bsb_namespace_map_gen.output}
199201
*)
200202
let implementation_map ppf sourcefile outputprefix =
203+
let () = Js_config.cmj_only := true in
201204
let ichan = open_in_bin sourcefile in
202205
seek_in ichan (Ext_digest.length +1);
203206
let list_of_modules = Ext_io.rev_lines_of_chann ichan in

jscomp/core/lam_compile_main.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,10 @@ let compile
292292
let (//) = Filename.concat
293293

294294
let lambda_as_module
295-
finalenv
295+
(lambda_output : J.deps_program)
296296
(output_prefix : string)
297-
(lam : Lambda.lambda) =
298-
let lambda_output =
299-
compile output_prefix finalenv lam in
297+
: unit =
298+
if not !Js_config.cmj_only then begin
300299
let basename =
301300
Ext_namespace.change_ext_ns_suffix
302301
(Filename.basename
@@ -327,7 +326,7 @@ let lambda_as_module
327326
) output_chan )
328327

329328
#end
330-
329+
end
331330
(* We can use {!Env.current_unit = "Pervasives"} to tell if it is some specific module,
332331
We need handle some definitions in standard libraries in a special way, most are io specific,
333332
includes {!Pervasives.stdin, Pervasives.stdout, Pervasives.stderr}

jscomp/core/lam_compile_main.mli

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ val compile :
4444
J.deps_program
4545

4646
val lambda_as_module :
47-
Env.t ->
47+
J.deps_program ->
4848
string ->
49-
Lambda.lambda ->
5049
unit

jscomp/depends/ast_extract.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type 'a kind = 'a Ml_binary.kind
4040
let read_parse_and_extract (type t) (k : t kind) (ast : t) : String_set.t =
4141
Depend.free_structure_names := String_set.empty;
4242
Ext_ref.protect Clflags.transparent_modules false begin fun _ ->
43-
List.iter
43+
List.iter (* check *)
4444
(fun modname ->
4545
#if OCAML_VERSION =~ ">4.03.0" then
4646
ignore @@

lib/4.02.3/bsb.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12733,7 +12733,7 @@ let make_custom_rules
1273312733
~name:"ml_cmi" in
1273412734
let build_package =
1273512735
define
12736-
~command:"$bsc -w -49 -color always -no-alias-deps -bs-cmi-only $in"
12736+
~command:"$bsc -w -49 -color always -no-alias-deps $in"
1273712737
~restat:()
1273812738
"build_package"
1273912739
in

lib/4.02.3/bsdep.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20557,7 +20557,6 @@ let setup_env () =
2055720557
Clflags.debug := true;
2055820558
Clflags.record_event_when_debug := false;
2055920559
Clflags.binary_annotations := true;
20560-
Clflags.transparent_modules := true;
2056120560
(* Turn on [-no-alias-deps] by default -- double check *)
2056220561
Oprint.out_ident := Outcome_printer_ns.out_ident;
2056320562

@@ -29733,6 +29732,8 @@ val bs_suffix : bool ref
2973329732
val debug : bool ref
2973429733

2973529734
val cmi_only : bool ref
29735+
val cmj_only : bool ref
29736+
(* stopped after generating cmj *)
2973629737
val force_cmi : bool ref
2973729738
val force_cmj : bool ref
2973829739

@@ -29841,6 +29842,8 @@ let bs_suffix = ref false
2984129842
let debug = ref false
2984229843

2984329844
let cmi_only = ref false
29845+
let cmj_only = ref false
29846+
2984429847
let force_cmi = ref false
2984529848
let force_cmj = ref false
2984629849

0 commit comments

Comments
 (0)