Introduce an ArchiveBuilderBuilder
This avoids monomorphizing all linker code for each codegen backend and will allow passing in extra information to the archive builder from the codegen backend.
This commit is contained in:
parent
90da3c6f2b
commit
7c6c7e8785
8 changed files with 214 additions and 148 deletions
|
@ -39,16 +39,8 @@ pub(super) fn find_library(
|
|||
));
|
||||
}
|
||||
|
||||
pub trait ArchiveBuilder<'a> {
|
||||
fn new(sess: &'a Session) -> Self;
|
||||
|
||||
fn add_file(&mut self, path: &Path);
|
||||
|
||||
fn add_archive<F>(&mut self, archive: &Path, skip: F) -> io::Result<()>
|
||||
where
|
||||
F: FnMut(&str) -> bool + 'static;
|
||||
|
||||
fn build(self, output: &Path) -> bool;
|
||||
pub trait ArchiveBuilderBuilder {
|
||||
fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box<dyn ArchiveBuilder<'a> + 'a>;
|
||||
|
||||
/// Creates a DLL Import Library <https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-creation#creating-an-import-library>.
|
||||
/// and returns the path on disk to that import library.
|
||||
|
@ -56,9 +48,22 @@ pub trait ArchiveBuilder<'a> {
|
|||
/// `linker_with_args`, which is specialized on `ArchiveBuilder` but
|
||||
/// doesn't take or create an instance of that type.
|
||||
fn create_dll_import_lib(
|
||||
&self,
|
||||
sess: &Session,
|
||||
lib_name: &str,
|
||||
dll_imports: &[DllImport],
|
||||
tmpdir: &Path,
|
||||
) -> PathBuf;
|
||||
}
|
||||
|
||||
pub trait ArchiveBuilder<'a> {
|
||||
fn add_file(&mut self, path: &Path);
|
||||
|
||||
fn add_archive(
|
||||
&mut self,
|
||||
archive: &Path,
|
||||
skip: Box<dyn FnMut(&str) -> bool + 'static>,
|
||||
) -> io::Result<()>;
|
||||
|
||||
fn build(self: Box<Self>, output: &Path) -> bool;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue