Skip to content

Commit 224a31f

Browse files
authored
Merge pull request #4827 from rescript-lang/mark_rescript
make the dev version of bsc.exe behave the same as release version of bsc
2 parents ba9da46 + 2564c13 commit 224a31f

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

jscomp/bsb/bsb_ninja_gen.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ let output_static_resources
9292
FIXME: check if the trick still works
9393
phony build.ninja : | resources
9494
*)
95-
95+
let mark_rescript oc =
96+
output_string oc "rescript = 1\n"
9697
let output_installation_file cwd_lib_bs namespace files_to_install =
9798
let install_oc = open_out_bin (cwd_lib_bs // "install.ninja") in
99+
mark_rescript install_oc;
98100
let o s = output_string install_oc s in
99101
let[@inline] oo suffix ~dest ~src =
100102
o "o " ;
@@ -232,7 +234,8 @@ let output_ninja_and_namespace_map
232234
~dev_incls (* its own devs *)
233235
generators in
234236

235-
let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in
237+
let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in
238+
mark_rescript oc;
236239
Bsb_ninja_targets.output_kv
237240
Bsb_ninja_global_vars.src_root_dir per_proj_dir
238241
oc ;

jscomp/core/bs_conditional_initial.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ let setup_env () =
6363
Matching_polyfill.names_from_construct_pattern;
6464
#if undefined BS_RELEASE_BUILD then
6565
Printexc.record_backtrace true;
66+
(let root_dir =
67+
Filename.dirname
68+
(Filename.dirname Sys.executable_name) in
69+
let (//) = Filename.concat in
70+
Clflags.include_dirs :=
71+
(root_dir//"jscomp"//"others") ::
72+
(root_dir//"jscomp"//"stdlib-406") ::
73+
(root_dir//"jscomp"//"runtime") ::
74+
!Clflags.include_dirs);
6675
#end
6776
Lexer.replace_directive_bool "BS" true;
6877
Lexer.replace_directive_bool "JS" true;

lib/4.06.1/bsb.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13663,9 +13663,11 @@ let output_static_resources
1366313663
FIXME: check if the trick still works
1366413664
phony build.ninja : | resources
1366513665
*)
13666-
13666+
let mark_rescript oc =
13667+
output_string oc "rescript = 1\n"
1366713668
let output_installation_file cwd_lib_bs namespace files_to_install =
1366813669
let install_oc = open_out_bin (cwd_lib_bs // "install.ninja") in
13670+
mark_rescript install_oc;
1366913671
let o s = output_string install_oc s in
1367013672
let[@inline] oo suffix ~dest ~src =
1367113673
o "o " ;
@@ -13803,7 +13805,8 @@ let output_ninja_and_namespace_map
1380313805
~dev_incls (* its own devs *)
1380413806
generators in
1380513807

13806-
let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in
13808+
let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in
13809+
mark_rescript oc;
1380713810
Bsb_ninja_targets.output_kv
1380813811
Bsb_ninja_global_vars.src_root_dir per_proj_dir
1380913812
oc ;

scripts/ninja.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ function generateNinja(depsMap, allTargets, cwd, extraDeps = []) {
859859
return build_stmts;
860860
}
861861

862-
var COMPILIER = `../${process.platform}/bsc`;
862+
var COMPILIER = `../${process.platform}/bsc.exe`;
863863
var BSC_COMPILER = `bsc = ${COMPILIER}`;
864864
var compilerTarget = pseudoTarget(COMPILIER);
865865

@@ -1613,7 +1613,7 @@ o common/bs_version.ml : mk_bsversion build_version.js ../package.json
16131613
16141614
o ../${
16151615
process.platform
1616-
}/bsc: link napkin/napkin.cmxa js_parser/js_parser.cmxa stubs/stubs.cmxa ext/ext.cmxa common/common.cmxa syntax/syntax.cmxa depends/depends.cmxa super_errors/super_errors.cmxa outcome_printer/outcome_printer.cmxa core/core.cmxa main/js_main.cmx
1616+
}/bsc.exe: link napkin/napkin.cmxa js_parser/js_parser.cmxa stubs/stubs.cmxa ext/ext.cmxa common/common.cmxa syntax/syntax.cmxa depends/depends.cmxa super_errors/super_errors.cmxa outcome_printer/outcome_printer.cmxa core/core.cmxa main/js_main.cmx
16171617
libs = ocamlcommon.cmxa
16181618
o ../${
16191619
process.platform

0 commit comments

Comments
 (0)