Skip to content

Commit 9e3fa93

Browse files
authored
Merge pull request #4656 from rescript-lang/soft_ninja
go futher even with warn-as-error
2 parents 4f4812a + 0042d36 commit 9e3fa93

File tree

10 files changed

+94
-46
lines changed

10 files changed

+94
-46
lines changed

darwin/ninja.exe

12.2 KB
Binary file not shown.

jscomp/build_version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fs.writeFileSync(
4141
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
4242
let version = "${version}"
4343
let header =
44-
"// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE"
44+
"// Generated by ReScript, PLEASE EDIT WITH CARE"
4545
let package_name = "${name}"
4646
`,
4747
"utf8"

jscomp/core/lam_compile_main.ml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ let compile
270270
Ext_string.compare (Lam_module_ident.name id1) (Lam_module_ident.name id2)
271271
)
272272
in
273-
Warnings.check_fatal ();
274273
let effect =
275274
Lam_stats_export.get_dependent_module_effect
276275
maybe_pure external_module_ids in
@@ -302,29 +301,38 @@ let lambda_as_module
302301
(if !Js_config.bs_suffix then Literals.suffix_bs_js else Literals.suffix_js)
303302
in
304303
let package_info = Js_packages_state.get_packages_info () in
305-
if Js_packages_info.is_empty package_info && !Js_config.js_stdout then
306-
Js_dump_program.dump_deps_program ~output_prefix NodeJS lambda_output stdout
307-
else
304+
if Js_packages_info.is_empty package_info && !Js_config.js_stdout then begin
305+
Js_dump_program.dump_deps_program ~output_prefix NodeJS lambda_output stdout;
306+
if !Warnings.nerrors > 0 then begin
307+
Warnings.nerrors := 0;
308+
exit 77
309+
end
310+
end else
308311
Js_packages_info.iter package_info (fun {module_system; path = _path} ->
309312
let output_chan chan =
310313
Js_dump_program.dump_deps_program ~output_prefix
311314
module_system
312315
lambda_output
313316
chan in
317+
let target_file =
318+
(Lazy.force Ext_path.package_dir //
319+
_path //
320+
basename
321+
(* #913 only generate little-case js file *)
322+
) in
323+
if !Warnings.nerrors > 0 then begin
324+
Warnings.nerrors := 0 ;
325+
if Sys.file_exists target_file then Sys.remove target_file;
326+
exit 77
327+
(* don't write js file, we need remove js files
328+
otherwise the js files are out-of-date
329+
exit 177 *)
330+
end else
314331
if not @@ !Clflags.dont_write_files then
315332
Ext_pervasives.with_file_as_chan
316-
#if BS_NATIVE then
317-
(if Filename.is_relative _path then Lazy.force Ext_path.package_dir // _path // basename
318-
(* #913 only generate little-case js file *)
319-
else _path // basename) output_chan )
320-
#else
321-
(Lazy.force Ext_path.package_dir //
322-
_path //
323-
basename
324-
(* #913 only generate little-case js file *)
325-
) output_chan )
333+
target_file output_chan )
326334

327-
#end
335+
328336

329337
(* We can use {!Env.current_unit = "Pervasives"} to tell if it is some specific module,
330338
We need handle some definitions in standard libraries in a special way, most are io specific,

lib/4.06.1/unstable/bspack.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3461,6 +3461,7 @@ val mk_lazy: (unit -> 'a) -> 'a Lazy.t
34613461
the warning settings at the time [mk_lazy] is called. *)
34623462

34633463

3464+
val nerrors : int ref
34643465
val message : t -> string
34653466
val number: t -> int
34663467
val super_report :

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3728,6 +3728,7 @@ val mk_lazy: (unit -> 'a) -> 'a Lazy.t
37283728
the warning settings at the time [mk_lazy] is called. *)
37293729

37303730

3731+
val nerrors : int ref
37313732
val message : t -> string
37323733
val number: t -> int
37333734
val super_report :
@@ -399973,7 +399974,6 @@ let compile
399973399974
Ext_string.compare (Lam_module_ident.name id1) (Lam_module_ident.name id2)
399974399975
)
399975399976
in
399976-
Warnings.check_fatal ();
399977399977
let effect =
399978399978
Lam_stats_export.get_dependent_module_effect
399979399979
maybe_pure external_module_ids in
@@ -400005,23 +400005,36 @@ let lambda_as_module
400005400005
(if !Js_config.bs_suffix then Literals.suffix_bs_js else Literals.suffix_js)
400006400006
in
400007400007
let package_info = Js_packages_state.get_packages_info () in
400008-
if Js_packages_info.is_empty package_info && !Js_config.js_stdout then
400009-
Js_dump_program.dump_deps_program ~output_prefix NodeJS lambda_output stdout
400010-
else
400008+
if Js_packages_info.is_empty package_info && !Js_config.js_stdout then begin
400009+
Js_dump_program.dump_deps_program ~output_prefix NodeJS lambda_output stdout;
400010+
if !Warnings.nerrors > 0 then begin
400011+
Warnings.nerrors := 0;
400012+
exit 77
400013+
end
400014+
end else
400011400015
Js_packages_info.iter package_info (fun {module_system; path = _path} ->
400012400016
let output_chan chan =
400013400017
Js_dump_program.dump_deps_program ~output_prefix
400014400018
module_system
400015400019
lambda_output
400016400020
chan in
400021+
let target_file =
400022+
(Lazy.force Ext_path.package_dir //
400023+
_path //
400024+
basename
400025+
(* #913 only generate little-case js file *)
400026+
) in
400027+
if !Warnings.nerrors > 0 then begin
400028+
Warnings.nerrors := 0 ;
400029+
if Sys.file_exists target_file then Sys.remove target_file;
400030+
exit 77
400031+
(* don't write js file, we need remove js files
400032+
otherwise the js files are out-of-date
400033+
exit 177 *)
400034+
end else
400017400035
if not @@ !Clflags.dont_write_files then
400018400036
Ext_pervasives.with_file_as_chan
400019-
400020-
(Lazy.force Ext_path.package_dir //
400021-
_path //
400022-
basename
400023-
(* #913 only generate little-case js file *)
400024-
) output_chan )
400037+
target_file output_chan )
400025400038

400026400039

400027400040

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3728,6 +3728,7 @@ val mk_lazy: (unit -> 'a) -> 'a Lazy.t
37283728
the warning settings at the time [mk_lazy] is called. *)
37293729

37303730

3731+
val nerrors : int ref
37313732
val message : t -> string
37323733
val number: t -> int
37333734
val super_report :
@@ -399973,7 +399974,6 @@ let compile
399973399974
Ext_string.compare (Lam_module_ident.name id1) (Lam_module_ident.name id2)
399974399975
)
399975399976
in
399976-
Warnings.check_fatal ();
399977399977
let effect =
399978399978
Lam_stats_export.get_dependent_module_effect
399979399979
maybe_pure external_module_ids in
@@ -400005,23 +400005,35 @@ let lambda_as_module
400005400005
(if !Js_config.bs_suffix then Literals.suffix_bs_js else Literals.suffix_js)
400006400006
in
400007400007
let package_info = Js_packages_state.get_packages_info () in
400008-
if Js_packages_info.is_empty package_info && !Js_config.js_stdout then
400009-
Js_dump_program.dump_deps_program ~output_prefix NodeJS lambda_output stdout
400010-
else
400008+
if Js_packages_info.is_empty package_info && !Js_config.js_stdout then begin
400009+
Js_dump_program.dump_deps_program ~output_prefix NodeJS lambda_output stdout;
400010+
if !Warnings.nerrors > 0 then begin
400011+
Warnings.nerrors := 0;
400012+
end
400013+
end else
400011400014
Js_packages_info.iter package_info (fun {module_system; path = _path} ->
400012400015
let output_chan chan =
400013400016
Js_dump_program.dump_deps_program ~output_prefix
400014400017
module_system
400015400018
lambda_output
400016400019
chan in
400020+
let target_file =
400021+
(Lazy.force Ext_path.package_dir //
400022+
_path //
400023+
basename
400024+
(* #913 only generate little-case js file *)
400025+
) in
400026+
if !Warnings.nerrors > 0 then begin
400027+
Warnings.nerrors := 0 ;
400028+
if Sys.file_exists target_file then Sys.remove target_file;
400029+
exit 77
400030+
(* don't write js file, we need remove js files
400031+
otherwise the js files are out-of-date
400032+
exit 177 *)
400033+
end else
400017400034
if not @@ !Clflags.dont_write_files then
400018400035
Ext_pervasives.with_file_as_chan
400019-
400020-
(Lazy.force Ext_path.package_dir //
400021-
_path //
400022-
basename
400023-
(* #913 only generate little-case js file *)
400024-
) output_chan )
400036+
target_file output_chan )
400025400037

400026400038

400027400039

lib/4.06.1/unstable/native_ppx.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3461,6 +3461,7 @@ val mk_lazy: (unit -> 'a) -> 'a Lazy.t
34613461
the warning settings at the time [mk_lazy] is called. *)
34623462

34633463

3464+
val nerrors : int ref
34643465
val message : t -> string
34653466
val number: t -> int
34663467
val super_report :

lib/4.06.1/whole_compiler.ml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3405,6 +3405,7 @@ val mk_lazy: (unit -> 'a) -> 'a Lazy.t
34053405
the warning settings at the time [mk_lazy] is called. *)
34063406

34073407

3408+
val nerrors : int ref
34083409
val message : t -> string
34093410
val number: t -> int
34103411
val super_report :
@@ -402860,7 +402861,6 @@ let compile
402860402861
Ext_string.compare (Lam_module_ident.name id1) (Lam_module_ident.name id2)
402861402862
)
402862402863
in
402863-
Warnings.check_fatal ();
402864402864
let effect =
402865402865
Lam_stats_export.get_dependent_module_effect
402866402866
maybe_pure external_module_ids in
@@ -402892,23 +402892,36 @@ let lambda_as_module
402892402892
(if !Js_config.bs_suffix then Literals.suffix_bs_js else Literals.suffix_js)
402893402893
in
402894402894
let package_info = Js_packages_state.get_packages_info () in
402895-
if Js_packages_info.is_empty package_info && !Js_config.js_stdout then
402896-
Js_dump_program.dump_deps_program ~output_prefix NodeJS lambda_output stdout
402897-
else
402895+
if Js_packages_info.is_empty package_info && !Js_config.js_stdout then begin
402896+
Js_dump_program.dump_deps_program ~output_prefix NodeJS lambda_output stdout;
402897+
if !Warnings.nerrors > 0 then begin
402898+
Warnings.nerrors := 0;
402899+
exit 77
402900+
end
402901+
end else
402898402902
Js_packages_info.iter package_info (fun {module_system; path = _path} ->
402899402903
let output_chan chan =
402900402904
Js_dump_program.dump_deps_program ~output_prefix
402901402905
module_system
402902402906
lambda_output
402903402907
chan in
402908+
let target_file =
402909+
(Lazy.force Ext_path.package_dir //
402910+
_path //
402911+
basename
402912+
(* #913 only generate little-case js file *)
402913+
) in
402914+
if !Warnings.nerrors > 0 then begin
402915+
Warnings.nerrors := 0 ;
402916+
if Sys.file_exists target_file then Sys.remove target_file;
402917+
exit 77
402918+
(* don't write js file, we need remove js files
402919+
otherwise the js files are out-of-date
402920+
exit 177 *)
402921+
end else
402904402922
if not @@ !Clflags.dont_write_files then
402905402923
Ext_pervasives.with_file_as_chan
402906-
402907-
(Lazy.force Ext_path.package_dir //
402908-
_path //
402909-
basename
402910-
(* #913 only generate little-case js file *)
402911-
) output_chan )
402924+
target_file output_chan )
402912402925

402913402926

402914402927

linux/ninja.exe

0 Bytes
Binary file not shown.

vendor/ninja.tar.gz

107 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)