Skip to content

Commit 681b223

Browse files
authored
Merge pull request #5086 from rescript-lang/more_checks_for_rebuild
more checks for rebuild (cherry-pick)
2 parents 2563bcf + 3e9ef12 commit 681b223

File tree

8 files changed

+57
-63
lines changed

8 files changed

+57
-63
lines changed

jscomp/bsb/bsb_ninja_check.ml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let rec check_aux cwd (xs : string list) =
6666
match xs with
6767
| [] -> Good
6868
| "===" :: rest ->
69-
check_global rest
69+
check_global_atime rest
7070
| item :: rest
7171
->
7272
match Ext_string.split item '\t' with
@@ -78,7 +78,7 @@ let rec check_aux cwd (xs : string list) =
7878
check_aux cwd rest
7979
else Other cur_file
8080
| _ -> Bsb_file_corrupted
81-
and check_global rest =
81+
and check_global_atime rest =
8282
match rest with
8383
| [] -> Good
8484
| item :: rest ->
@@ -87,20 +87,22 @@ and check_global rest =
8787
let stamp = float_of_string stamp in
8888
let cur_file = file in
8989
let stat = Unix.stat cur_file in
90-
if stat.st_mtime <> stamp then
91-
check_global rest
90+
if stat.st_atime <= stamp then
91+
check_global_atime rest
9292
else Other cur_file
9393
| _ -> Bsb_file_corrupted
9494

9595

9696
(* TODO: for such small data structure, maybe text format is better *)
9797

98-
98+
let record_global_atime buf name =
99+
let stamp = (Unix.stat name).st_atime in
100+
Ext_buffer.add_string_char buf name '\t';
101+
Ext_buffer.add_string_char buf (hex_of_float stamp) '\n'
99102
let record
100103
~(package_kind : Bsb_package_kind.t)
101104
~per_proj_dir ~file
102105
~(config:Bsb_config_types.t) (file_or_dirs : string list) : unit =
103-
let _ = config in
104106
let buf = Ext_buffer.create 1_000 in
105107
Ext_buffer.add_string_char buf Bs_version.version '\n';
106108
Ext_buffer.add_string_char buf per_proj_dir '\n';
@@ -114,17 +116,13 @@ let record
114116
Ext_buffer.add_string_char buf
115117
(hex_of_float (Unix.stat (Filename.concat per_proj_dir f)).st_mtime) '\n';
116118
);
117-
begin match config.ppx_files with
118-
| [] -> ()
119-
| files ->
120-
Ext_buffer.add_string buf "===\n";
121-
Ext_list.iter files (fun {name ; args = _} ->
122-
try
123-
let stamp = (Unix.stat name).st_mtime in
124-
Ext_buffer.add_string_char buf name '\t';
125-
Ext_buffer.add_string_char buf (hex_of_float stamp) '\n'
126-
with _ -> ())
127-
end;
119+
Ext_buffer.add_string buf "===\n";
120+
record_global_atime buf Sys.executable_name;
121+
Ext_list.iter config.ppx_files (fun {name ; args = _} ->
122+
try
123+
record_global_atime buf name
124+
with _ -> (* record the ppx files as a best effort *)
125+
());
128126
let oc = open_out_bin file in
129127
Ext_buffer.output_buffer oc buf ;
130128
close_out oc

jscomp/bsb/bsb_ninja_regen.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ let regenerate_ninja
4242
~package_kind
4343
~per_proj_dir
4444
~forced ~file:output_deps in
45-
Bsb_log.info
46-
"@{<info>BSB check@} build spec : %a @." Bsb_ninja_check.pp_check_result check_result ;
4745
match check_result with
4846
| Good ->
4947
None (* Fast path, no need regenerate ninja *)
@@ -54,6 +52,8 @@ let regenerate_ninja
5452
| Bsb_file_not_exist
5553
| Bsb_source_directory_changed
5654
| Other _ ->
55+
Bsb_log.info
56+
"@{<info>BSB check@} build spec : %a @." Bsb_ninja_check.pp_check_result check_result;
5757
if check_result = Bsb_bsc_version_mismatch then begin
5858
Bsb_log.warn "@{<info>Different compiler version@}: clean current repo@.";
5959
Bsb_clean.clean_self per_proj_dir;

jscomp/common/bs_version.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* You should have received a copy of the GNU Lesser General Public License
2323
* along with this program; if not, write to the Free Software
2424
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
25-
let version = "9.1.0"
25+
let version = "9.1.2"
2626
let header =
2727
"// Generated by ReScript, PLEASE EDIT WITH CARE"
2828
let package_name = ref "rescript"

lib/4.06.1/bsb.ml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ end = struct
5555
* You should have received a copy of the GNU Lesser General Public License
5656
* along with this program; if not, write to the Free Software
5757
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
58-
let version = "9.1.0"
58+
let version = "9.1.2"
5959
let header =
6060
"// Generated by ReScript, PLEASE EDIT WITH CARE"
6161
let package_name = ref "rescript"
@@ -12180,7 +12180,7 @@ let rec check_aux cwd (xs : string list) =
1218012180
match xs with
1218112181
| [] -> Good
1218212182
| "===" :: rest ->
12183-
check_global rest
12183+
check_global_atime rest
1218412184
| item :: rest
1218512185
->
1218612186
match Ext_string.split item '\t' with
@@ -12192,7 +12192,7 @@ let rec check_aux cwd (xs : string list) =
1219212192
check_aux cwd rest
1219312193
else Other cur_file
1219412194
| _ -> Bsb_file_corrupted
12195-
and check_global rest =
12195+
and check_global_atime rest =
1219612196
match rest with
1219712197
| [] -> Good
1219812198
| item :: rest ->
@@ -12201,20 +12201,22 @@ and check_global rest =
1220112201
let stamp = float_of_string stamp in
1220212202
let cur_file = file in
1220312203
let stat = Unix.stat cur_file in
12204-
if stat.st_mtime <> stamp then
12205-
check_global rest
12204+
if stat.st_atime <= stamp then
12205+
check_global_atime rest
1220612206
else Other cur_file
1220712207
| _ -> Bsb_file_corrupted
1220812208

1220912209

1221012210
(* TODO: for such small data structure, maybe text format is better *)
1221112211

12212-
12212+
let record_global_atime buf name =
12213+
let stamp = (Unix.stat name).st_atime in
12214+
Ext_buffer.add_string_char buf name '\t';
12215+
Ext_buffer.add_string_char buf (hex_of_float stamp) '\n'
1221312216
let record
1221412217
~(package_kind : Bsb_package_kind.t)
1221512218
~per_proj_dir ~file
1221612219
~(config:Bsb_config_types.t) (file_or_dirs : string list) : unit =
12217-
let _ = config in
1221812220
let buf = Ext_buffer.create 1_000 in
1221912221
Ext_buffer.add_string_char buf Bs_version.version '\n';
1222012222
Ext_buffer.add_string_char buf per_proj_dir '\n';
@@ -12228,17 +12230,13 @@ let record
1222812230
Ext_buffer.add_string_char buf
1222912231
(hex_of_float (Unix.stat (Filename.concat per_proj_dir f)).st_mtime) '\n';
1223012232
);
12231-
begin match config.ppx_files with
12232-
| [] -> ()
12233-
| files ->
12234-
Ext_buffer.add_string buf "===\n";
12235-
Ext_list.iter files (fun {name ; args = _} ->
12236-
try
12237-
let stamp = (Unix.stat name).st_mtime in
12238-
Ext_buffer.add_string_char buf name '\t';
12239-
Ext_buffer.add_string_char buf (hex_of_float stamp) '\n'
12240-
with _ -> ())
12241-
end;
12233+
Ext_buffer.add_string buf "===\n";
12234+
record_global_atime buf Sys.executable_name;
12235+
Ext_list.iter config.ppx_files (fun {name ; args = _} ->
12236+
try
12237+
record_global_atime buf name
12238+
with _ -> (* record the ppx files as a best effort *)
12239+
());
1224212240
let oc = open_out_bin file in
1224312241
Ext_buffer.output_buffer oc buf ;
1224412242
close_out oc
@@ -14163,8 +14161,6 @@ let regenerate_ninja
1416314161
~package_kind
1416414162
~per_proj_dir
1416514163
~forced ~file:output_deps in
14166-
Bsb_log.info
14167-
"@{<info>BSB check@} build spec : %a @." Bsb_ninja_check.pp_check_result check_result ;
1416814164
match check_result with
1416914165
| Good ->
1417014166
None (* Fast path, no need regenerate ninja *)
@@ -14175,6 +14171,8 @@ let regenerate_ninja
1417514171
| Bsb_file_not_exist
1417614172
| Bsb_source_directory_changed
1417714173
| Other _ ->
14174+
Bsb_log.info
14175+
"@{<info>BSB check@} build spec : %a @." Bsb_ninja_check.pp_check_result check_result;
1417814176
if check_result = Bsb_bsc_version_mismatch then begin
1417914177
Bsb_log.warn "@{<info>Different compiler version@}: clean current repo@.";
1418014178
Bsb_clean.clean_self per_proj_dir;

lib/4.06.1/rescript.ml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5940,7 +5940,7 @@ end = struct
59405940
* You should have received a copy of the GNU Lesser General Public License
59415941
* along with this program; if not, write to the Free Software
59425942
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
5943-
let version = "9.1.0"
5943+
let version = "9.1.2"
59445944
let header =
59455945
"// Generated by ReScript, PLEASE EDIT WITH CARE"
59465946
let package_name = ref "rescript"
@@ -12180,7 +12180,7 @@ let rec check_aux cwd (xs : string list) =
1218012180
match xs with
1218112181
| [] -> Good
1218212182
| "===" :: rest ->
12183-
check_global rest
12183+
check_global_atime rest
1218412184
| item :: rest
1218512185
->
1218612186
match Ext_string.split item '\t' with
@@ -12192,7 +12192,7 @@ let rec check_aux cwd (xs : string list) =
1219212192
check_aux cwd rest
1219312193
else Other cur_file
1219412194
| _ -> Bsb_file_corrupted
12195-
and check_global rest =
12195+
and check_global_atime rest =
1219612196
match rest with
1219712197
| [] -> Good
1219812198
| item :: rest ->
@@ -12201,20 +12201,22 @@ and check_global rest =
1220112201
let stamp = float_of_string stamp in
1220212202
let cur_file = file in
1220312203
let stat = Unix.stat cur_file in
12204-
if stat.st_mtime <> stamp then
12205-
check_global rest
12204+
if stat.st_atime <= stamp then
12205+
check_global_atime rest
1220612206
else Other cur_file
1220712207
| _ -> Bsb_file_corrupted
1220812208

1220912209

1221012210
(* TODO: for such small data structure, maybe text format is better *)
1221112211

12212-
12212+
let record_global_atime buf name =
12213+
let stamp = (Unix.stat name).st_atime in
12214+
Ext_buffer.add_string_char buf name '\t';
12215+
Ext_buffer.add_string_char buf (hex_of_float stamp) '\n'
1221312216
let record
1221412217
~(package_kind : Bsb_package_kind.t)
1221512218
~per_proj_dir ~file
1221612219
~(config:Bsb_config_types.t) (file_or_dirs : string list) : unit =
12217-
let _ = config in
1221812220
let buf = Ext_buffer.create 1_000 in
1221912221
Ext_buffer.add_string_char buf Bs_version.version '\n';
1222012222
Ext_buffer.add_string_char buf per_proj_dir '\n';
@@ -12228,17 +12230,13 @@ let record
1222812230
Ext_buffer.add_string_char buf
1222912231
(hex_of_float (Unix.stat (Filename.concat per_proj_dir f)).st_mtime) '\n';
1223012232
);
12231-
begin match config.ppx_files with
12232-
| [] -> ()
12233-
| files ->
12234-
Ext_buffer.add_string buf "===\n";
12235-
Ext_list.iter files (fun {name ; args = _} ->
12236-
try
12237-
let stamp = (Unix.stat name).st_mtime in
12238-
Ext_buffer.add_string_char buf name '\t';
12239-
Ext_buffer.add_string_char buf (hex_of_float stamp) '\n'
12240-
with _ -> ())
12241-
end;
12233+
Ext_buffer.add_string buf "===\n";
12234+
record_global_atime buf Sys.executable_name;
12235+
Ext_list.iter config.ppx_files (fun {name ; args = _} ->
12236+
try
12237+
record_global_atime buf name
12238+
with _ -> (* record the ppx files as a best effort *)
12239+
());
1224212240
let oc = open_out_bin file in
1224312241
Ext_buffer.output_buffer oc buf ;
1224412242
close_out oc
@@ -14163,8 +14161,6 @@ let regenerate_ninja
1416314161
~package_kind
1416414162
~per_proj_dir
1416514163
~forced ~file:output_deps in
14166-
Bsb_log.info
14167-
"@{<info>BSB check@} build spec : %a @." Bsb_ninja_check.pp_check_result check_result ;
1416814164
match check_result with
1416914165
| Good ->
1417014166
None (* Fast path, no need regenerate ninja *)
@@ -14175,6 +14171,8 @@ let regenerate_ninja
1417514171
| Bsb_file_not_exist
1417614172
| Bsb_source_directory_changed
1417714173
| Other _ ->
14174+
Bsb_log.info
14175+
"@{<info>BSB check@} build spec : %a @." Bsb_ninja_check.pp_check_result check_result;
1417814176
if check_result = Bsb_bsc_version_mismatch then begin
1417914177
Bsb_log.warn "@{<info>Different compiler version@}: clean current repo@.";
1418014178
Bsb_clean.clean_self per_proj_dir;

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18039,7 +18039,7 @@ end = struct
1803918039
* You should have received a copy of the GNU Lesser General Public License
1804018040
* along with this program; if not, write to the Free Software
1804118041
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
18042-
let version = "9.1.0"
18042+
let version = "9.1.2"
1804318043
let header =
1804418044
"// Generated by ReScript, PLEASE EDIT WITH CARE"
1804518045
let package_name = ref "rescript"

lib/4.06.1/whole_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304481,7 +304481,7 @@ end = struct
304481304481
* You should have received a copy of the GNU Lesser General Public License
304482304482
* along with this program; if not, write to the Free Software
304483304483
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
304484-
let version = "9.1.0"
304484+
let version = "9.1.2"
304485304485
let header =
304486304486
"// Generated by ReScript, PLEASE EDIT WITH CARE"
304487304487
let package_name = ref "rescript"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"coverage": "nyc --timeout=3000 --reporter=html mocha jscomp/test/*test.js && open ./coverage/index.html"
2020
},
2121
"name": "rescript",
22-
"version": "9.1.0",
22+
"version": "9.1.1-dev.2",
2323
"description": "ReScript toolchain",
2424
"repository": {
2525
"type": "git",

0 commit comments

Comments
 (0)