@@ -162,7 +162,7 @@ pub fn compile(
162
162
let result = compile_file (
163
163
package,
164
164
root_package,
165
- & package . get_iast_path ( & path) ,
165
+ & helpers :: get_ast_path ( & path) . to_string_lossy ( ) ,
166
166
module,
167
167
& build_state. rescript_version ,
168
168
true ,
@@ -179,7 +179,7 @@ pub fn compile(
179
179
let result = compile_file (
180
180
package,
181
181
root_package,
182
- & package . get_ast_path ( & source_file. implementation . path ) ,
182
+ & helpers :: get_ast_path ( & source_file. implementation . path ) . to_string_lossy ( ) ,
183
183
module,
184
184
& build_state. rescript_version ,
185
185
false ,
@@ -379,16 +379,16 @@ pub fn compiler_args(
379
379
. par_iter ( )
380
380
. map ( |package_name| {
381
381
let canonicalized_path = if let Some ( packages) = packages {
382
- packages
383
- . get ( package_name)
384
- . expect ( "expect package" )
385
- . path
386
- . to_string ( )
382
+ let package = packages. get ( package_name) . expect ( "expect package" ) ;
383
+ package. path . to_string ( )
387
384
} else {
388
385
packages:: read_dependency ( package_name, project_root, project_root, workspace_root)
389
386
. expect ( "cannot find dep" )
390
387
} ;
391
- vec ! [ "-I" . to_string( ) , packages:: get_build_path( & canonicalized_path) ]
388
+ vec ! [
389
+ "-I" . to_string( ) ,
390
+ packages:: get_ocaml_build_path( & canonicalized_path) ,
391
+ ]
392
392
} )
393
393
. collect :: < Vec < Vec < String > > > ( ) ;
394
394
@@ -415,9 +415,6 @@ pub fn compiler_args(
415
415
packages:: Namespace :: NoNamespace => vec ! [ ] ,
416
416
} ;
417
417
418
- let jsx_args = root_config. get_jsx_args ( ) ;
419
- let jsx_module_args = root_config. get_jsx_module_args ( ) ;
420
- let jsx_mode_args = root_config. get_jsx_mode_args ( ) ;
421
418
let uncurried_args = root_config. get_uncurried_args ( version) ;
422
419
let gentype_arg = root_config. get_gentype_arg ( ) ;
423
420
@@ -478,15 +475,12 @@ pub fn compiler_args(
478
475
vec ! [
479
476
namespace_args,
480
477
read_cmi_args,
481
- vec![ "-I" . to_string( ) , "." . to_string( ) ] ,
478
+ vec![ "-I" . to_string( ) , "../ocaml " . to_string( ) ] ,
482
479
deps. concat( ) ,
483
- gentype_arg,
484
- jsx_args,
485
- jsx_module_args,
486
- jsx_mode_args,
487
480
uncurried_args,
488
481
bsc_flags. to_owned( ) ,
489
482
warning_args,
483
+ gentype_arg,
490
484
// vec!["-warn-error".to_string(), "A".to_string()],
491
485
// ^^ this one fails for bisect-ppx
492
486
// this is the default
@@ -497,6 +491,7 @@ pub fn compiler_args(
497
491
// "-I".to_string(),
498
492
// abs_node_modules_path.to_string() + "/rescript/ocaml",
499
493
// ],
494
+ vec![ "-bs-v" . to_string( ) , format!( "{}" , version) ] ,
500
495
vec![ ast_path. to_string( ) ] ,
501
496
]
502
497
. concat ( )
@@ -515,6 +510,7 @@ fn compile_file(
515
510
workspace_root : & Option < String > ,
516
511
build_dev_deps : bool ,
517
512
) -> Result < Option < String > > {
513
+ let ocaml_build_path_abs = package. get_ocaml_build_path ( ) ;
518
514
let build_path_abs = package. get_build_path ( ) ;
519
515
let implementation_file_path = match & module. source_type {
520
516
SourceType :: SourceFile ( ref source_file) => Ok ( & source_file. implementation . path ) ,
@@ -539,7 +535,6 @@ fn compile_file(
539
535
& Some ( packages) ,
540
536
build_dev_deps,
541
537
) ;
542
-
543
538
let to_mjs = Command :: new ( bsc_path)
544
539
. current_dir ( helpers:: canonicalize_string_path ( & build_path_abs. to_owned ( ) ) . unwrap ( ) )
545
540
. args ( to_mjs_args)
@@ -566,35 +561,41 @@ fn compile_file(
566
561
// perhaps we can do this copying somewhere else
567
562
if !is_interface {
568
563
let _ = std:: fs:: copy (
569
- build_path_abs. to_string ( ) + "/" + & module_name + ".cmi" ,
570
- std:: path:: Path :: new ( & package. get_bs_build_path ( ) )
564
+ std:: path:: Path :: new ( & package. get_build_path ( ) )
571
565
. join ( dir)
572
566
// because editor tooling doesn't support namespace entries yet
573
567
// we just remove the @ for now. This makes sure the editor support
574
568
// doesn't break
575
569
. join ( module_name. to_owned ( ) + ".cmi" ) ,
570
+ ocaml_build_path_abs. to_string ( ) + "/" + & module_name + ".cmi" ,
576
571
) ;
577
572
let _ = std:: fs:: copy (
578
- build_path_abs. to_string ( ) + "/" + & module_name + ".cmj" ,
579
- std:: path:: Path :: new ( & package. get_bs_build_path ( ) )
573
+ std:: path:: Path :: new ( & package. get_build_path ( ) )
580
574
. join ( dir)
581
575
. join ( module_name. to_owned ( ) + ".cmj" ) ,
576
+ ocaml_build_path_abs. to_string ( ) + "/" + & module_name + ".cmj" ,
582
577
) ;
583
578
let _ = std:: fs:: copy (
584
- build_path_abs. to_string ( ) + "/" + & module_name + ".cmt" ,
585
- std:: path:: Path :: new ( & package. get_bs_build_path ( ) )
579
+ std:: path:: Path :: new ( & package. get_build_path ( ) )
586
580
. join ( dir)
587
581
// because editor tooling doesn't support namespace entries yet
588
582
// we just remove the @ for now. This makes sure the editor support
589
583
// doesn't break
590
584
. join ( module_name. to_owned ( ) + ".cmt" ) ,
585
+ ocaml_build_path_abs. to_string ( ) + "/" + & module_name + ".cmt" ,
591
586
) ;
592
587
} else {
593
588
let _ = std:: fs:: copy (
594
- build_path_abs. to_string ( ) + "/" + & module_name + ".cmti" ,
595
- std:: path:: Path :: new ( & package. get_bs_build_path ( ) )
589
+ std:: path:: Path :: new ( & package. get_build_path ( ) )
596
590
. join ( dir)
597
591
. join ( module_name. to_owned ( ) + ".cmti" ) ,
592
+ ocaml_build_path_abs. to_string ( ) + "/" + & module_name + ".cmti" ,
593
+ ) ;
594
+ let _ = std:: fs:: copy (
595
+ std:: path:: Path :: new ( & package. get_build_path ( ) )
596
+ . join ( dir)
597
+ . join ( module_name. to_owned ( ) + ".cmi" ) ,
598
+ ocaml_build_path_abs. to_string ( ) + "/" + & module_name + ".cmi" ,
598
599
) ;
599
600
}
600
601
match & module. source_type {
@@ -611,7 +612,7 @@ fn compile_file(
611
612
// and in lib/ocaml when referencing modules in other packages
612
613
let _ = std:: fs:: copy (
613
614
std:: path:: Path :: new ( & package. path ) . join ( path) ,
614
- std:: path:: Path :: new ( & package. get_bs_build_path ( ) ) . join ( path) ,
615
+ std:: path:: Path :: new ( & package. get_build_path ( ) ) . join ( path) ,
615
616
)
616
617
. expect ( "copying source file failed" ) ;
617
618
@@ -672,7 +673,7 @@ pub fn mark_modules_with_expired_deps_dirty(build_state: &mut BuildState) {
672
673
let dependent_module = build_state. modules . get ( dependent) . unwrap ( ) ;
673
674
match dependent_module. source_type {
674
675
SourceType :: SourceFile ( _) => {
675
- match ( module. last_compiled_cmt , module. last_compiled_cmi ) {
676
+ match ( module. last_compiled_cmt , module. last_compiled_cmt ) {
676
677
( None , None ) | ( Some ( _) , None ) | ( None , Some ( _) ) => {
677
678
// println!(
678
679
// "🛑 {} is a dependent of {} but has no cmt/cmi",
@@ -686,7 +687,7 @@ pub fn mark_modules_with_expired_deps_dirty(build_state: &mut BuildState) {
686
687
// we compare the last compiled time of the dependent module with the last
687
688
// compile of the interface of the module it depends on, if the interface
688
689
// didn't change it doesn't matter
689
- match ( dependent_module. last_compiled_cmt , module. last_compiled_cmi ) {
690
+ match ( dependent_module. last_compiled_cmt , module. last_compiled_cmt ) {
690
691
( Some ( last_compiled_dependent) , Some ( last_compiled) ) => {
691
692
if last_compiled_dependent < last_compiled {
692
693
// println!(
@@ -719,7 +720,7 @@ pub fn mark_modules_with_expired_deps_dirty(build_state: &mut BuildState) {
719
720
let dependent_module = build_state. modules . get ( dependent_of_namespace) . unwrap ( ) ;
720
721
721
722
if let ( Some ( last_compiled_dependent) , Some ( last_compiled) ) =
722
- ( dependent_module. last_compiled_cmt , module. last_compiled_cmi )
723
+ ( dependent_module. last_compiled_cmt , module. last_compiled_cmt )
723
724
{
724
725
if last_compiled_dependent < last_compiled {
725
726
modules_with_expired_deps. insert ( dependent. to_string ( ) ) ;
0 commit comments