@@ -7,9 +7,9 @@ use crate::{
77 core:: ConfigExperimental ,
88 elements:: {
99 ArchiveConfig , CustomTestGroup , DefaultJunitImpl , GlobalTimeout , JunitConfig ,
10- JunitImpl , LeakTimeout , MaxFail , RetryPolicy , SlowTimeout , TestGroup , TestGroupConfig ,
11- TestThreads , ThreadsRequired , deserialize_fail_fast, deserialize_leak_timeout ,
12- deserialize_retry_policy, deserialize_slow_timeout,
10+ JunitImpl , LeakTimeout , MaxFail , RetryPolicy , SlowTimeout , StoreConfigImpl , TestGroup ,
11+ TestGroupConfig , TestThreads , ThreadsRequired , deserialize_fail_fast,
12+ deserialize_leak_timeout , deserialize_retry_policy, deserialize_slow_timeout,
1313 } ,
1414 overrides:: {
1515 CompiledByProfile , CompiledData , CompiledDefaultFilter , DeserializedOverride ,
@@ -794,19 +794,16 @@ impl NextestConfig {
794794 fn make_profile ( & self , name : & str ) -> Result < EarlyProfile < ' _ > , ProfileNotFound > {
795795 let custom_profile = self . inner . get_profile ( name) ?;
796796
797- // The profile was found: construct it.
798- let mut store_dir = self . workspace_root . join ( & self . inner . store . dir ) ;
799- store_dir. push ( name) ;
800-
801- // Grab the compiled data as well.
797+ // Grab the compiled data.
802798 let compiled_data = match self . compiled . other . get ( name) {
803799 Some ( data) => data. clone ( ) . chain ( self . compiled . default . clone ( ) ) ,
804800 None => self . compiled . default . clone ( ) ,
805801 } ;
806802
807803 Ok ( EarlyProfile {
808804 name : name. to_owned ( ) ,
809- store_dir,
805+ workspace_root : self . workspace_root . clone ( ) ,
806+ store : & self . inner . store ,
810807 default_profile : & self . inner . default_profile ,
811808 custom_profile,
812809 test_groups : & self . inner . test_groups ,
@@ -871,7 +868,8 @@ pub(crate) struct FinalConfig {
871868/// Returned by [`NextestConfig::profile`].
872869pub struct EarlyProfile < ' cfg > {
873870 name : String ,
874- store_dir : Utf8PathBuf ,
871+ workspace_root : Utf8PathBuf ,
872+ store : & ' cfg StoreConfigImpl ,
875873 default_profile : & ' cfg DefaultProfileImpl ,
876874 custom_profile : Option < & ' cfg CustomProfileImpl > ,
877875 test_groups : & ' cfg BTreeMap < CustomTestGroup , TestGroupConfig > ,
@@ -882,24 +880,18 @@ pub struct EarlyProfile<'cfg> {
882880}
883881
884882impl < ' cfg > EarlyProfile < ' cfg > {
885- /// Returns the absolute profile-specific store directory.
886- pub fn store_dir ( & self ) -> & Utf8Path {
887- & self . store_dir
888- }
889-
890883 /// Returns the global test group configuration.
891884 pub fn test_group_config ( & self ) -> & ' cfg BTreeMap < CustomTestGroup , TestGroupConfig > {
892885 self . test_groups
893886 }
894887
895- /// Applies build platforms to make the profile ready for evaluation.
888+ /// Converts this profile into an evaluatable profile by applying build
889+ /// platforms.
896890 ///
897- /// This is a separate step from parsing the config and reading a profile so that cargo-nextest
898- /// can tell users about configuration parsing errors before building the binary list.
899- pub fn apply_build_platforms (
900- self ,
901- build_platforms : & BuildPlatforms ,
902- ) -> EvaluatableProfile < ' cfg > {
891+ /// This is a separate step from parsing the config and reading a profile so
892+ /// that cargo-nextest can tell users about configuration parsing errors
893+ /// before building the binary list.
894+ pub fn into_evaluatable ( self , build_platforms : & BuildPlatforms ) -> EvaluatableProfile < ' cfg > {
903895 let compiled_data = self . compiled_data . apply_build_platforms ( build_platforms) ;
904896
905897 let resolved_default_filter = {
@@ -921,7 +913,8 @@ impl<'cfg> EarlyProfile<'cfg> {
921913
922914 EvaluatableProfile {
923915 name : self . name ,
924- store_dir : self . store_dir ,
916+ workspace_root : self . workspace_root ,
917+ store : self . store ,
925918 default_profile : self . default_profile ,
926919 custom_profile : self . custom_profile ,
927920 scripts : self . scripts ,
@@ -934,11 +927,12 @@ impl<'cfg> EarlyProfile<'cfg> {
934927
935928/// A configuration profile for nextest. Contains most configuration used by the nextest runner.
936929///
937- /// Returned by [`EarlyProfile::apply_build_platforms `].
930+ /// Returned by [`EarlyProfile::into_evaluatable `].
938931#[ derive( Clone , Debug ) ]
939932pub struct EvaluatableProfile < ' cfg > {
940933 name : String ,
941- store_dir : Utf8PathBuf ,
934+ workspace_root : Utf8PathBuf ,
935+ store : & ' cfg StoreConfigImpl ,
942936 default_profile : & ' cfg DefaultProfileImpl ,
943937 custom_profile : Option < & ' cfg CustomProfileImpl > ,
944938 test_groups : & ' cfg BTreeMap < CustomTestGroup , TestGroupConfig > ,
@@ -958,8 +952,18 @@ impl<'cfg> EvaluatableProfile<'cfg> {
958952 }
959953
960954 /// Returns the absolute profile-specific store directory.
961- pub fn store_dir ( & self ) -> & Utf8Path {
962- & self . store_dir
955+ ///
956+ /// The target directory must be provided to resolve the store directory
957+ /// when it is configured relative to the target directory.
958+ ///
959+ /// The store directory might not exist yet. The caller is responsible for
960+ /// creating it.
961+ pub fn store_dir ( & self , target_dir : & Utf8Path ) -> Utf8PathBuf {
962+ let mut store_dir = self
963+ . store
964+ . resolve_store_dir ( & self . workspace_root , target_dir) ;
965+ store_dir. push ( & self . name ) ;
966+ store_dir
963967 }
964968
965969 /// Returns the context in which to evaluate filtersets.
@@ -1102,7 +1106,6 @@ impl<'cfg> EvaluatableProfile<'cfg> {
11021106 /// Returns the JUnit configuration for this profile.
11031107 pub fn junit ( & self ) -> Option < JunitConfig < ' cfg > > {
11041108 JunitConfig :: new (
1105- self . store_dir ( ) ,
11061109 self . custom_profile . map ( |p| & p. junit ) ,
11071110 & self . default_profile . junit ,
11081111 )
@@ -1210,12 +1213,6 @@ impl NextestConfigDeserialize {
12101213 }
12111214}
12121215
1213- #[ derive( Clone , Debug , Deserialize ) ]
1214- #[ serde( rename_all = "kebab-case" ) ]
1215- struct StoreConfigImpl {
1216- dir : Utf8PathBuf ,
1217- }
1218-
12191216#[ derive( Clone , Debug ) ]
12201217pub ( in crate :: config) struct DefaultProfileImpl {
12211218 default_filter : String ,
0 commit comments