@@ -162,7 +162,7 @@ pub fn compile(
162162 let result = compile_file (
163163 package,
164164 root_package,
165- & package . get_iast_path ( & path) ,
165+ & helpers :: get_ast_path ( & path) . to_string_lossy ( ) ,
166166 module,
167167 & build_state. rescript_version ,
168168 true ,
@@ -179,7 +179,7 @@ pub fn compile(
179179 let result = compile_file (
180180 package,
181181 root_package,
182- & package . get_ast_path ( & source_file. implementation . path ) ,
182+ & helpers :: get_ast_path ( & source_file. implementation . path ) . to_string_lossy ( ) ,
183183 module,
184184 & build_state. rescript_version ,
185185 false ,
@@ -379,16 +379,16 @@ pub fn compiler_args(
379379 . par_iter ( )
380380 . map ( |package_name| {
381381 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 ( )
387384 } else {
388385 packages:: read_dependency ( package_name, project_root, project_root, workspace_root)
389386 . expect ( "cannot find dep" )
390387 } ;
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+ ]
392392 } )
393393 . collect :: < Vec < Vec < String > > > ( ) ;
394394
@@ -415,9 +415,6 @@ pub fn compiler_args(
415415 packages:: Namespace :: NoNamespace => vec ! [ ] ,
416416 } ;
417417
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 ( ) ;
421418 let uncurried_args = root_config. get_uncurried_args ( version) ;
422419 let gentype_arg = root_config. get_gentype_arg ( ) ;
423420
@@ -478,15 +475,12 @@ pub fn compiler_args(
478475 vec ! [
479476 namespace_args,
480477 read_cmi_args,
481- vec![ "-I" . to_string( ) , "." . to_string( ) ] ,
478+ vec![ "-I" . to_string( ) , "../ocaml " . to_string( ) ] ,
482479 deps. concat( ) ,
483- gentype_arg,
484- jsx_args,
485- jsx_module_args,
486- jsx_mode_args,
487480 uncurried_args,
488481 bsc_flags. to_owned( ) ,
489482 warning_args,
483+ gentype_arg,
490484 // vec!["-warn-error".to_string(), "A".to_string()],
491485 // ^^ this one fails for bisect-ppx
492486 // this is the default
@@ -497,6 +491,7 @@ pub fn compiler_args(
497491 // "-I".to_string(),
498492 // abs_node_modules_path.to_string() + "/rescript/ocaml",
499493 // ],
494+ vec![ "-bs-v" . to_string( ) , format!( "{}" , version) ] ,
500495 vec![ ast_path. to_string( ) ] ,
501496 ]
502497 . concat ( )
@@ -515,6 +510,7 @@ fn compile_file(
515510 workspace_root : & Option < String > ,
516511 build_dev_deps : bool ,
517512) -> Result < Option < String > > {
513+ let ocaml_build_path_abs = package. get_ocaml_build_path ( ) ;
518514 let build_path_abs = package. get_build_path ( ) ;
519515 let implementation_file_path = match & module. source_type {
520516 SourceType :: SourceFile ( ref source_file) => Ok ( & source_file. implementation . path ) ,
@@ -539,7 +535,6 @@ fn compile_file(
539535 & Some ( packages) ,
540536 build_dev_deps,
541537 ) ;
542-
543538 let to_mjs = Command :: new ( bsc_path)
544539 . current_dir ( helpers:: canonicalize_string_path ( & build_path_abs. to_owned ( ) ) . unwrap ( ) )
545540 . args ( to_mjs_args)
@@ -566,35 +561,41 @@ fn compile_file(
566561 // perhaps we can do this copying somewhere else
567562 if !is_interface {
568563 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 ( ) )
571565 . join ( dir)
572566 // because editor tooling doesn't support namespace entries yet
573567 // we just remove the @ for now. This makes sure the editor support
574568 // doesn't break
575569 . join ( module_name. to_owned ( ) + ".cmi" ) ,
570+ ocaml_build_path_abs. to_string ( ) + "/" + & module_name + ".cmi" ,
576571 ) ;
577572 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 ( ) )
580574 . join ( dir)
581575 . join ( module_name. to_owned ( ) + ".cmj" ) ,
576+ ocaml_build_path_abs. to_string ( ) + "/" + & module_name + ".cmj" ,
582577 ) ;
583578 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 ( ) )
586580 . join ( dir)
587581 // because editor tooling doesn't support namespace entries yet
588582 // we just remove the @ for now. This makes sure the editor support
589583 // doesn't break
590584 . join ( module_name. to_owned ( ) + ".cmt" ) ,
585+ ocaml_build_path_abs. to_string ( ) + "/" + & module_name + ".cmt" ,
591586 ) ;
592587 } else {
593588 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 ( ) )
596590 . join ( dir)
597591 . 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" ,
598599 ) ;
599600 }
600601 match & module. source_type {
@@ -611,7 +612,7 @@ fn compile_file(
611612 // and in lib/ocaml when referencing modules in other packages
612613 let _ = std:: fs:: copy (
613614 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) ,
615616 )
616617 . expect ( "copying source file failed" ) ;
617618
@@ -672,7 +673,7 @@ pub fn mark_modules_with_expired_deps_dirty(build_state: &mut BuildState) {
672673 let dependent_module = build_state. modules . get ( dependent) . unwrap ( ) ;
673674 match dependent_module. source_type {
674675 SourceType :: SourceFile ( _) => {
675- match ( module. last_compiled_cmt , module. last_compiled_cmi ) {
676+ match ( module. last_compiled_cmt , module. last_compiled_cmt ) {
676677 ( None , None ) | ( Some ( _) , None ) | ( None , Some ( _) ) => {
677678 // println!(
678679 // "🛑 {} 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) {
686687 // we compare the last compiled time of the dependent module with the last
687688 // compile of the interface of the module it depends on, if the interface
688689 // 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 ) {
690691 ( Some ( last_compiled_dependent) , Some ( last_compiled) ) => {
691692 if last_compiled_dependent < last_compiled {
692693 // println!(
@@ -719,7 +720,7 @@ pub fn mark_modules_with_expired_deps_dirty(build_state: &mut BuildState) {
719720 let dependent_module = build_state. modules . get ( dependent_of_namespace) . unwrap ( ) ;
720721
721722 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 )
723724 {
724725 if last_compiled_dependent < last_compiled {
725726 modules_with_expired_deps. insert ( dependent. to_string ( ) ) ;
0 commit comments