From 4c3cc3cb2abda7019160047f4d388a3c62c8911a Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Sun, 4 Jun 2023 07:49:30 +0200 Subject: [PATCH] try debugging proc-macro erro --- src/docbuilder/caching.rs | 12 +++++++++++- src/docbuilder/rustwide_builder.rs | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/docbuilder/caching.rs b/src/docbuilder/caching.rs index d8a68dba5..3ec57d0e6 100644 --- a/src/docbuilder/caching.rs +++ b/src/docbuilder/caching.rs @@ -6,7 +6,8 @@ use std::{ time::SystemTime, }; use sysinfo::{DiskExt, RefreshKind, System, SystemExt}; -use tracing::{debug, instrument, warn}; +use tracing::{debug, info, instrument, warn}; +use walkdir::WalkDir; static LAST_ACCESSED_FILE_NAME: &str = "docsrs_last_accessed"; @@ -153,6 +154,14 @@ impl ArtifactCache { Ok(()) } + fn print_directory_contents>(path: P) -> Result<()> { + info!("directory contents of {}:", path.as_ref().display()); + for entry in WalkDir::new(path) { + info!("\t{}", entry?.path().display()); + } + Ok(()) + } + /// restore a cached target directory. /// /// Will just move the cache folder into the rustwide @@ -181,6 +190,7 @@ impl ArtifactCache { fs::create_dir_all(target_dir.parent().unwrap())?; fs::rename(cache_dir, target_dir).context("could not move cache directory to target")?; self.cleanup(target_dir)?; + self.print_directory_contents(target_dir)?; Ok(()) } diff --git a/src/docbuilder/rustwide_builder.rs b/src/docbuilder/rustwide_builder.rs index 1e77631a8..6ce7b7a4c 100644 --- a/src/docbuilder/rustwide_builder.rs +++ b/src/docbuilder/rustwide_builder.rs @@ -105,6 +105,12 @@ impl RustwideBuilder { }) } + pub fn init_for_test(context: &dyn Context) -> Result { + let builder = Self::init(context)?; + builder.artifact_cache.purge()?; + Ok(builder) + } + pub fn set_skip_build_if_exists(&mut self, should: bool) { self.skip_build_if_exists = should; }