Skip to content

Commit 9cb5211

Browse files
committed
refactor(ws): Separately define default build-dir/target-dir
Kind of confusing to have them defined in terms of each other but - When we move the defualt `build-dir`, I expect we'll just delete the conditional and make the cargo script default `build-dir` the only default `build-dir` - I plan to change the cargo script default `target-dir`
1 parent fe131fc commit 9cb5211

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/cargo/core/workspace.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,18 @@ impl<'gctx> Workspace<'gctx> {
442442
self.build_dir
443443
.clone()
444444
.or_else(|| self.target_dir.clone())
445-
.unwrap_or_else(|| self.default_target_dir())
445+
.unwrap_or_else(|| self.default_build_dir())
446446
}
447447

448448
fn default_target_dir(&self) -> Filesystem {
449+
if self.root_maybe().is_embedded() {
450+
self.default_build_dir()
451+
} else {
452+
Filesystem::new(self.root().join("target"))
453+
}
454+
}
455+
456+
fn default_build_dir(&self) -> Filesystem {
449457
if self.root_maybe().is_embedded() {
450458
let default = ConfigRelativePath::new(
451459
"{cargo-cache-home}/build/{workspace-path-hash}"
@@ -456,7 +464,7 @@ impl<'gctx> Workspace<'gctx> {
456464
.custom_build_dir(&default, self.root_manifest())
457465
.expect("template is correct")
458466
} else {
459-
Filesystem::new(self.root().join("target"))
467+
self.default_target_dir()
460468
}
461469
}
462470

0 commit comments

Comments
 (0)