Skip to content

Commit d0e834d

Browse files
committed
prepare a release flag to diff the cmi
1 parent 5dd2eef commit d0e834d

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

jscomp/main/cmij_main.ml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,6 @@ let from_cmi (files : string list) (output_file : string) =
104104
let content =
105105
Marshal.to_string
106106
cmi
107-
(* cmi_name, crcs can be saved, but only a tiny bit *)
108-
(* (cmi.cmi_sign) *)
109-
(* (Array.of_list cmi.cmi_sign) *)
110-
(* ({ with
111-
(* cmi_crcs = [] *)
112-
cmi_flags = []
113-
}) *)
114107
[] in
115108
Printf.sprintf {|%S (* %d *)|} module_name (String.length content) ,
116109
Printf.sprintf {|(* %s *) %S|} module_name content) in
@@ -141,6 +134,11 @@ let stdlib = "stdlib-406"
141134
let (//) = Filename.concat
142135
let (|~) = Ext_string.contain_substring
143136

137+
let release_cmi = Array.exists ((=) "-release") Sys.argv
138+
let () =
139+
if release_cmi then
140+
print_endline "collecting cmi from ../lib/ocaml in release mode"
141+
144142
let () =
145143
let cmj_files =
146144
(
@@ -150,14 +148,18 @@ let () =
150148
from_cmj cmj_files
151149
(Filename.concat "main" "builtin_cmj_datasets.ml");
152150
let cmi_files =
153-
"runtime" // "js.cmi" ::
154-
(get_files Literals.suffix_cmi stdlib @
155-
get_files Literals.suffix_cmi "others" )
156-
|> List.filter (fun x ->
157-
x|~ "js_internalOO" ||
158-
x|~ "camlinternal" ||
159-
not (x |~ "internal"))
151+
if release_cmi then
152+
get_files Literals.suffix_cmi (".."//"lib"//"ocaml")
153+
else
154+
"runtime" // "js.cmi" ::
155+
(get_files Literals.suffix_cmi stdlib @
156+
get_files Literals.suffix_cmi "others" )
157+
|> List.filter (fun x ->
158+
x|~ "js_internalOO" ||
159+
x|~ "camlinternal" ||
160+
not (x |~ "internal"))
160161
in
161-
from_cmi cmi_files
162+
from_cmi
163+
cmi_files
162164
(Filename.concat "main" "builtin_cmi_datasets.ml")
163165

0 commit comments

Comments
 (0)