@@ -34,9 +34,11 @@ use rattler_build::{
3434use rattler_conda_types:: { Platform , compression_level:: CompressionLevel , package:: ArchiveType } ;
3535
3636use serde:: Deserialize ;
37+ use tracing:: warn;
3738
3839use crate :: {
3940 TargetSelector ,
41+ consts:: DEBUG_OUTPUT_DIR ,
4042 dependencies:: {
4143 convert_binary_dependencies, convert_dependencies, convert_input_variant_configuration,
4244 } ,
@@ -129,6 +131,13 @@ impl<T: GenerateRecipe> IntermediateBackend<T> {
129131 . into_diagnostic ( )
130132 . context ( "failed to parse configuration" ) ?;
131133
134+ if let Some ( path) = config. debug_dir ( ) {
135+ warn ! (
136+ path = %path. display( ) ,
137+ "`debug-dir` backend configuration is deprecated and ignored; debug data is now written to the build work directory."
138+ ) ;
139+ }
140+
132141 let target_config = target_config
133142 . into_iter ( )
134143 . map ( |( target, config) | {
@@ -160,12 +169,6 @@ where
160169 T : GenerateRecipe + Clone + Send + Sync + ' static ,
161170 T :: Config : Send + Sync + ' static ,
162171{
163- fn debug_dir ( configuration : Option < serde_json:: Value > ) -> Option < PathBuf > {
164- configuration
165- . and_then ( |config| serde_json:: from_value :: < T :: Config > ( config) . ok ( ) )
166- . and_then ( |config| config. debug_dir ( ) . map ( |d| d. to_path_buf ( ) ) )
167- }
168-
169172 async fn initialize (
170173 & self ,
171174 params : InitializeParams ,
@@ -217,10 +220,6 @@ where
217220 T : GenerateRecipe + Clone + Send + Sync + ' static ,
218221 T :: Config : BackendConfig + Send + Sync + ' static ,
219222{
220- fn debug_dir ( & self ) -> Option < & Path > {
221- self . config . debug_dir ( )
222- }
223-
224223 async fn conda_outputs (
225224 & self ,
226225 params : CondaOutputsParams ,
@@ -369,18 +368,18 @@ where
369368 ) ;
370369
371370 // Save intermediate recipe and the used variant
372- // in the work dir by hash of the variant
373- // and entire variants.yaml at the root of work_dir
374- let work_dir = & directories. work_dir ;
371+ // in the debug dir by hash of the variant
372+ // and entire variants.yaml at the root of debug_dir
373+ let debug_dir = & directories. build_dir . join ( "debug" ) ;
375374
376- let recipe_path = work_dir . join ( "recipe.yaml" ) ;
377- let variants_path = work_dir . join ( "variants.yaml" ) ;
375+ let recipe_path = debug_dir . join ( "recipe.yaml" ) ;
376+ let variants_path = debug_dir . join ( "variants.yaml" ) ;
378377
379- let package_work_dir = work_dir . join ( "recipe" ) . join ( & hash. hash ) ;
380- let package_recipe_path = package_work_dir . join ( "recipe.yaml" ) ;
381- let package_variant_path = package_work_dir . join ( "variants.yaml" ) ;
378+ let package_debug_dir = debug_dir . join ( "recipe" ) . join ( & hash. hash ) ;
379+ let package_recipe_path = package_debug_dir . join ( "recipe.yaml" ) ;
380+ let package_variant_path = package_debug_dir . join ( "variants.yaml" ) ;
382381
383- tokio_fs:: create_dir_all ( & package_work_dir )
382+ tokio_fs:: create_dir_all ( & package_debug_dir )
384383 . await
385384 . into_diagnostic ( ) ?;
386385
@@ -398,7 +397,7 @@ where
398397 . await
399398 . into_diagnostic ( ) ?;
400399
401- // write the entire variants.yaml at the root of work_dir
400+ // write the entire variants.yaml at the root of debug_dir
402401 if !variants_saved {
403402 let variants = serde_yaml:: to_string ( & variant_config)
404403 . into_diagnostic ( )
@@ -619,21 +618,18 @@ where
619618 ) ;
620619
621620 // Save intermediate recipe and the used variant
622- // in the work dir by hash of the variant
621+ // in the debug dir by hash of the variant
623622 let variant = discovered_output. used_vars ;
624623
625624 // Save intermediate recipe and the used variant
626- // in the work dir by hash of the variant
627- // and entire variants.yaml at the root of work_dir
628- let work_dir = & directories. work_dir ;
625+ // in the debug dir by hash of the variant
626+ // and entire variants.yaml at the root of debug_dir
627+ let debug_dir = & directories. build_dir . join ( DEBUG_OUTPUT_DIR ) ;
629628
630- let recipe_path = work_dir . join ( "recipe.yaml" ) ;
631- let variants_path = work_dir . join ( "variants.yaml" ) ;
629+ let recipe_path = debug_dir . join ( "recipe.yaml" ) ;
630+ let variants_path = debug_dir . join ( "variants.yaml" ) ;
632631
633- let package_dir = directories
634- . work_dir
635- . join ( "recipe" )
636- . join ( & discovered_output. hash . hash ) ;
632+ let package_dir = debug_dir. join ( "recipe" ) . join ( & discovered_output. hash . hash ) ;
637633
638634 let package_recipe_path = package_dir. join ( "recipe.yaml" ) ;
639635 let package_variant_path = package_dir. join ( "variants.yaml" ) ;
@@ -656,7 +652,7 @@ where
656652 . await
657653 . into_diagnostic ( ) ?;
658654
659- // write the entire variants.yaml at the root of work_dir
655+ // write the entire variants.yaml at the root of debug_dir
660656 let variants = serde_yaml:: to_string ( & variant_config)
661657 . into_diagnostic ( )
662658 . context ( "failed to serialize variant config to YAML" ) ?;
0 commit comments