(archive_path: &Path, entry_name: &str)
| 5754 | } |
| 5755 | |
| 5756 | fn archive_entry_bytes(archive_path: &Path, entry_name: &str) -> Result<Vec<u8>> { |
| 5757 | let file = |
| 5758 | fs::File::open(archive_path).with_context(|| format!("open {}", archive_path.display()))?; |
| 5759 | let decoder = zstd::stream::read::Decoder::new(file) |
| 5760 | .with_context(|| format!("create zstd decoder for {}", archive_path.display()))?; |
| 5761 | let mut archive = tar::Archive::new(decoder); |
| 5762 | for entry in archive |
| 5763 | .entries() |
| 5764 | .with_context(|| format!("read {}", archive_path.display()))? |
| 5765 | { |
| 5766 | let mut entry = |
| 5767 | entry.with_context(|| format!("read entry from {}", archive_path.display()))?; |
| 5768 | let path = entry |
| 5769 | .path() |
| 5770 | .with_context(|| format!("read path from {}", archive_path.display()))? |
| 5771 | .to_string_lossy() |
| 5772 | .trim_start_matches("./") |
| 5773 | .to_owned(); |
| 5774 | if path == entry_name { |
| 5775 | let mut bytes = Vec::new(); |
| 5776 | io::copy(&mut entry, &mut bytes) |
| 5777 | .with_context(|| format!("read {entry_name} from {}", archive_path.display()))?; |
| 5778 | return Ok(bytes); |
| 5779 | } |
| 5780 | } |
| 5781 | bail!( |
| 5782 | "{} is missing archive entry {entry_name}", |
| 5783 | archive_path.display() |
| 5784 | ) |
| 5785 | } |
| 5786 | |
| 5787 | fn check_no_committed_aot_artifacts() -> Result<()> { |
| 5788 | let tracked = command_output("git", &["ls-files", "crates/aot"], Path::new("."))?; |
no test coverage detected