Skip to content

Commit 87f68a5

Browse files
authored
fix #642, complain when -bs-main have an empty queue (#687)
* fix #642, complain when -bs-main have an empty queue * Update Makefile
1 parent e4ea9c4 commit 87f68a5

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

jscomp/common/bs_exception.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ type error =
2828
| Bs_cyclic_depends of string list
2929
| Bs_duplicated_module of string * string
3030
| Bs_package_not_found of string
31+
| Bs_main_not_exist of string
32+
3133
exception Error of error
3234

3335
let error err = raise (Error err)
@@ -44,6 +46,10 @@ let report_error ppf = function
4446
| Bs_duplicated_module (a,b)
4547
->
4648
Format.fprintf ppf "The build system does not support two files with same names yet %s, %s" a b
49+
| Bs_main_not_exist main
50+
->
51+
Format.fprintf ppf "File %s not found " main
52+
4753
| Bs_package_not_found package
4854
->
4955
Format.fprintf ppf "Pacage %s not found or %s/lib/ocaml does not exist"

jscomp/common/bs_exception.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ type error =
2727
| Bs_cyclic_depends of string list
2828
| Bs_duplicated_module of string * string
2929
| Bs_package_not_found of string
30+
| Bs_main_not_exist of string
31+
3032
val error : error -> 'a

jscomp/ocaml_batch_compile.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ let batch_compile ppf files main_file =
6767
Ocaml_parse.lazy_parse_implementation
6868
Ocaml_parse.lazy_parse_interface
6969
main_file in
70+
if Queue.is_empty result then
71+
Bs_exception.error (Bs_main_not_exist main_file)
72+
;
7073
process_result ppf main_file ast_table result
7174
else 0
7275

jscomp/runtime/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ else
3232
BS_FLAGS= $(BS_COMMON_FLAGS) -bs-package-output lib/js
3333
endif
3434

35-
COMPFLAGS += $(BS_FLAGS) -I ../stdlib -nostdlib -nopervasives -open Pervasives -unsafe -w -40
35+
COMPFLAGS += $(BS_FLAGS) -I ../stdlib -nostdlib -nopervasives -open Pervasives -unsafe -w -40-49
3636

3737

3838

0 commit comments

Comments
 (0)