Skip to content

Commit

Permalink
Improve support for bench/dev/test profiles (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
Porges authored Sep 23, 2024
1 parent b468537 commit 0c1f080
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/skeleton/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,17 @@ fn panic(_: &core::panic::PanicInfo) -> ! {
Some(target_dir) => target_dir,
};

let profile = match profile {
OptimisationProfile::Release => "release".to_string(),
OptimisationProfile::Debug => "debug".to_string(),
// https://doc.rust-lang.org/cargo/guide/build-cache.html
// > For historical reasons, the `dev` and `test` profiles are stored
// > in the `debug` directory, and the `release` and `bench` profiles are
// > stored in the `release` directory. User-defined profiles are
// > stored in a directory with the same name as the profile.

let profile_dir = match &profile {
OptimisationProfile::Release => "release",
OptimisationProfile::Debug => "debug",
OptimisationProfile::Other(profile) if profile == "bench" => "release",
OptimisationProfile::Other(profile) if profile == "dev" || profile == "test" => "debug",
OptimisationProfile::Other(custom_profile) => custom_profile,
};

Expand All @@ -234,7 +242,7 @@ fn panic(_: &core::panic::PanicInfo) -> ! {
.collect()
})
.iter()
.map(|path| path.join(&profile))
.map(|path| path.join(profile_dir))
.collect();

for manifest in &self.manifests {
Expand Down

0 comments on commit 0c1f080

Please sign in to comment.