diff --git a/example-build-script/build.rs b/example-build-script/build.rs index bcc7028..7740970 100644 --- a/example-build-script/build.rs +++ b/example-build-script/build.rs @@ -2,7 +2,10 @@ use conan2::{ConanInstall, ConanVerbosity}; fn main() { ConanInstall::new() - .detect_profile() // Auto-detect "default" profile if not exists + .host_profile("cargo-host") + .build_profile("default") + // Auto-detect "cargo-host" and "default" profiles if none exist + .detect_profile() .build("missing") .verbosity(ConanVerbosity::Error) // Silence Conan warnings .run() diff --git a/tests/integration_test.rs b/tests/integration_test.rs index fc2e705..05fb3fe 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -75,3 +75,18 @@ fn detect_custom_profile() { std::io::stderr().write_all(output.stderr()).unwrap(); assert!(output.is_success()); } + +#[test] +fn host_and_build_profiles() { + let output = ConanInstall::with_recipe(Path::new("tests/conanfile.txt")) + .output_folder(Path::new(env!("CARGO_TARGET_TMPDIR"))) + .host_profile(&format!("{}-dynamic-host-profile", env!("CARGO_PKG_NAME"))) + .build_profile(&format!("{}-dynamic-build-profile", env!("CARGO_PKG_NAME"))) + .detect_profile() + .build("missing") + .verbosity(ConanVerbosity::Debug) + .run(); + + std::io::stderr().write_all(output.stderr()).unwrap(); + assert!(output.is_success()); +}