Skip to content

Commit

Permalink
Remove the source archive functionality of ArchiveWriter
Browse files Browse the repository at this point in the history
We now build archives through strictly additive means rather than taking
an existing archive and potentially substracting parts.
  • Loading branch information
bjorn3 committed Jun 19, 2022
1 parent abb9b60 commit 73b3ae0
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,16 @@ pub(crate) struct ArArchiveBuilder<'a> {
}

impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
fn new(sess: &'a Session, output: &Path, input: Option<&Path>) -> Self {
let (src_archives, entries) = if let Some(input) = input {
let read_cache = ReadCache::new(File::open(input).unwrap());
let archive = ArchiveFile::parse(&read_cache).unwrap();
let mut entries = Vec::new();

for entry in archive.members() {
let entry = entry.unwrap();
entries.push((
entry.name().to_vec(),
ArchiveEntry::FromArchive { archive_index: 0, file_range: entry.file_range() },
));
}

(vec![read_cache.into_inner()], entries)
} else {
(vec![], Vec::new())
};

fn new(sess: &'a Session, output: &Path) -> Self {
ArArchiveBuilder {
sess,
dst: output.to_path_buf(),
use_gnu_style_archive: sess.target.archive_format == "gnu",
// FIXME fix builtin ranlib on macOS
no_builtin_ranlib: sess.target.is_like_osx,

src_archives,
entries,
src_archives: vec![],
entries: vec![],
}
}

Expand Down

0 comments on commit 73b3ae0

Please sign in to comment.