Skip to content

Commit

Permalink
try debugging proc-macro erro
Browse files Browse the repository at this point in the history
  • Loading branch information
syphar committed Jun 4, 2023
1 parent 2bc2cab commit 4c3cc3c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/docbuilder/caching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -153,6 +154,14 @@ impl ArtifactCache {
Ok(())
}

fn print_directory_contents<P: AsRef<Path>>(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
Expand Down Expand Up @@ -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(())
}

Expand Down
6 changes: 6 additions & 0 deletions src/docbuilder/rustwide_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ impl RustwideBuilder {
})
}

pub fn init_for_test(context: &dyn Context) -> Result<Self> {
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;
}
Expand Down

0 comments on commit 4c3cc3c

Please sign in to comment.