Add an `extra_dist_files` field to the `ParsedArguments` struct, so compilers can add additional files to be included for each distributed compilation

This commit is contained in:
ptaylor 2024-10-03 16:54:56 -07:00 коммит произвёл Sylvestre Ledru
Родитель b537db02e8
Коммит 33dd86bc78
5 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -105,6 +105,8 @@ pub struct ParsedArguments {
pub arch_args: Vec<OsString>,
/// Commandline arguments for the preprocessor or the compiler that don't affect the computed hash.
pub unhashed_args: Vec<OsString>,
/// Extra files that need to be sent along with dist compiles.
pub extra_dist_files: Vec<PathBuf>,
/// Extra files that need to have their contents hashed.
pub extra_hash_files: Vec<PathBuf>,
/// Whether or not the `-showIncludes` argument is passed on MSVC
@ -1188,6 +1190,7 @@ impl<T: CommandCreatorSync, I: CCompilerImpl> Compilation<T> for CCompilation<I>
input_path,
preprocessed_input,
path_transformer,
extra_dist_files: parsed_args.extra_dist_files,
extra_hash_files: parsed_args.extra_hash_files,
});
let toolchain_packager = Box::new(CToolchainPackager {
@ -1217,6 +1220,7 @@ struct CInputsPackager {
input_path: PathBuf,
path_transformer: dist::PathTransformer,
preprocessed_input: Vec<u8>,
extra_dist_files: Vec<PathBuf>,
extra_hash_files: Vec<PathBuf>,
}
@ -1227,6 +1231,7 @@ impl pkg::InputsPackager for CInputsPackager {
input_path,
mut path_transformer,
preprocessed_input,
extra_dist_files,
extra_hash_files,
} = *self;
@ -1244,8 +1249,8 @@ impl pkg::InputsPackager for CInputsPackager {
builder.append(&file_header, preprocessed_input.as_slice())?;
}
for input_path in extra_hash_files {
let input_path = pkg::simplify_path(&input_path)?;
for input_path in extra_hash_files.iter().chain(extra_dist_files.iter()) {
let input_path = pkg::simplify_path(input_path)?;
if !super::CAN_DIST_DYLIBS
&& input_path

Просмотреть файл

@ -309,6 +309,7 @@ where
common_args,
arch_args: vec![],
unhashed_args: vec![],
extra_dist_files: vec![],
extra_hash_files: vec![],
msvc_show_includes: false,
profile_generate: false,
@ -783,6 +784,7 @@ mod test {
common_args: vec![],
arch_args: vec![],
unhashed_args: vec![],
extra_dist_files: vec![],
extra_hash_files: vec![],
msvc_show_includes: false,
profile_generate: false,

Просмотреть файл

@ -679,6 +679,7 @@ where
common_args,
arch_args,
unhashed_args,
extra_dist_files: vec![],
extra_hash_files,
msvc_show_includes: false,
profile_generate,
@ -2148,6 +2149,7 @@ mod test {
common_args: vec![],
arch_args: vec![],
unhashed_args: vec![],
extra_dist_files: vec![],
extra_hash_files: vec![],
msvc_show_includes: false,
profile_generate: false,

Просмотреть файл

@ -832,6 +832,7 @@ pub fn parse_arguments(
common_args,
arch_args: vec![],
unhashed_args,
extra_dist_files: vec![],
extra_hash_files,
msvc_show_includes: show_includes,
profile_generate,
@ -2462,6 +2463,7 @@ mod test {
common_args: vec![],
arch_args: vec![],
unhashed_args: vec![],
extra_dist_files: vec![],
extra_hash_files: vec![],
msvc_show_includes: false,
profile_generate: false,
@ -2551,6 +2553,7 @@ mod test {
common_args: vec![],
arch_args: vec![],
unhashed_args: vec![],
extra_dist_files: vec![],
extra_hash_files: vec![],
msvc_show_includes: false,
profile_generate: false,

Просмотреть файл

@ -288,6 +288,7 @@ where
common_args,
arch_args: vec![],
unhashed_args: vec![],
extra_dist_files: vec![],
extra_hash_files: vec![],
msvc_show_includes: false,
profile_generate: false,
@ -774,6 +775,7 @@ mod test {
common_args: vec![],
arch_args: vec![],
unhashed_args: ovec!["--threads", "2"],
extra_dist_files: vec![],
extra_hash_files: vec![],
msvc_show_includes: false,
profile_generate: false,