Skip to content

Commit ae1b62f

Browse files
committed
fix small issues
1 parent a366200 commit ae1b62f

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

src/build/compile.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

@@ -475,7 +475,7 @@ pub fn compiler_args(
475475
vec![
476476
namespace_args,
477477
read_cmi_args,
478-
vec!["-I".to_string(), ".".to_string()],
478+
vec!["-I".to_string(), "../ocaml".to_string()],
479479
deps.concat(),
480480
uncurried_args,
481481
bsc_flags.to_owned(),
@@ -510,6 +510,7 @@ fn compile_file(
510510
workspace_root: &Option<String>,
511511
build_dev_deps: bool,
512512
) -> Result<Option<String>> {
513+
let ocaml_build_path_abs = package.get_ocaml_build_path();
513514
let build_path_abs = package.get_build_path();
514515
let implementation_file_path = match &module.source_type {
515516
SourceType::SourceFile(ref source_file) => Ok(&source_file.implementation.path),
@@ -566,13 +567,13 @@ fn compile_file(
566567
// we just remove the @ for now. This makes sure the editor support
567568
// doesn't break
568569
.join(module_name.to_owned() + ".cmi"),
569-
build_path_abs.to_string() + "/" + &module_name + ".cmi",
570+
ocaml_build_path_abs.to_string() + "/" + &module_name + ".cmi",
570571
);
571572
let _ = std::fs::copy(
572573
std::path::Path::new(&package.get_build_path())
573574
.join(dir)
574575
.join(module_name.to_owned() + ".cmj"),
575-
build_path_abs.to_string() + "/" + &module_name + ".cmj",
576+
ocaml_build_path_abs.to_string() + "/" + &module_name + ".cmj",
576577
);
577578
let _ = std::fs::copy(
578579
std::path::Path::new(&package.get_build_path())
@@ -581,20 +582,20 @@ fn compile_file(
581582
// we just remove the @ for now. This makes sure the editor support
582583
// doesn't break
583584
.join(module_name.to_owned() + ".cmt"),
584-
build_path_abs.to_string() + "/" + &module_name + ".cmt",
585+
ocaml_build_path_abs.to_string() + "/" + &module_name + ".cmt",
585586
);
586587
} else {
587588
let _ = std::fs::copy(
588589
std::path::Path::new(&package.get_build_path())
589590
.join(dir)
590591
.join(module_name.to_owned() + ".cmti"),
591-
build_path_abs.to_string() + "/" + &module_name + ".cmti",
592+
ocaml_build_path_abs.to_string() + "/" + &module_name + ".cmti",
592593
);
593594
let _ = std::fs::copy(
594595
std::path::Path::new(&package.get_build_path())
595596
.join(dir)
596597
.join(module_name.to_owned() + ".cmi"),
597-
build_path_abs.to_string() + "/" + &module_name + ".cmi",
598+
ocaml_build_path_abs.to_string() + "/" + &module_name + ".cmi",
598599
);
599600
}
600601
match &module.source_type {

src/build/packages.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@ pub fn get_build_path(canonical_path: &str) -> String {
6666
format!("{}/lib/bs", canonical_path)
6767
}
6868

69+
pub fn get_ocaml_build_path(canonical_path: &str) -> String {
70+
format!("{}/lib/ocaml", canonical_path)
71+
}
72+
6973
impl Package {
7074
pub fn get_ocaml_build_path(&self) -> String {
71-
format!("{}/lib/ocaml", self.path)
75+
get_ocaml_build_path(&self.path)
7276
}
7377

7478
pub fn get_build_path(&self) -> String {

src/build/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ fn generate_ast(
358358
if let Ok((ast_path, _)) = &result {
359359
let _ = std::fs::copy(
360360
Path::new(&build_path_abs).join(&ast_path),
361-
std::path::Path::new(&package.get_build_path()).join(ast_path.file_name().unwrap()),
361+
std::path::Path::new(&package.get_ocaml_build_path()).join(ast_path.file_name().unwrap()),
362362
);
363363
}
364364
result

0 commit comments

Comments
 (0)