diff --git a/ql/extractor/src/extractor.rs b/ql/extractor/src/extractor.rs index 487f1de08a80..b50cae32a01f 100644 --- a/ql/extractor/src/extractor.rs +++ b/ql/extractor/src/extractor.rs @@ -53,7 +53,7 @@ pub fn run(options: Options) -> std::io::Result<()> { trap_dir: options.output_dir, trap_compression: trap::Compression::from_env("CODEQL_QL_TRAP_COMPRESSION"), source_archive_dir: options.source_archive_dir, - file_list: options.file_list, + file_lists: vec![options.file_list], }; extractor.run() diff --git a/shared/tree-sitter-extractor/src/extractor/simple.rs b/shared/tree-sitter-extractor/src/extractor/simple.rs index baf620d19a33..89fa03288a7c 100644 --- a/shared/tree-sitter-extractor/src/extractor/simple.rs +++ b/shared/tree-sitter-extractor/src/extractor/simple.rs @@ -20,7 +20,7 @@ pub struct Extractor { pub languages: Vec, pub trap_dir: PathBuf, pub source_archive_dir: PathBuf, - pub file_list: PathBuf, + pub file_lists: Vec, // Typically constructed via `trap::Compression::from_env`. // This allow us to report the error using our diagnostics system // without exposing it to consumers. @@ -74,7 +74,14 @@ impl Extractor { .build_global() .unwrap(); - let file_list = File::open(&self.file_list)?; + let file_lists: Vec = self + .file_lists + .iter() + .map(|file_list| { + File::open(file_list) + .unwrap_or_else(|_| panic!("Unable to open file list at {:?}", file_list)) + }) + .collect(); let mut schemas = vec![]; for lang in &self.languages { @@ -103,8 +110,10 @@ impl Extractor { ) }; - let lines: std::io::Result> = - std::io::BufReader::new(file_list).lines().collect(); + let lines: std::io::Result> = file_lists + .iter() + .flat_map(|file_list| std::io::BufReader::new(file_list).lines()) + .collect(); let lines = lines?; lines diff --git a/shared/tree-sitter-extractor/tests/integration_test.rs b/shared/tree-sitter-extractor/tests/integration_test.rs index a40f5a3f3619..29058016764f 100644 --- a/shared/tree-sitter-extractor/tests/integration_test.rs +++ b/shared/tree-sitter-extractor/tests/integration_test.rs @@ -30,7 +30,7 @@ fn simple_extractor() { languages: vec![language], trap_dir, source_archive_dir, - file_list, + file_lists: vec![file_list], trap_compression: Ok(trap::Compression::Gzip), }; diff --git a/shared/tree-sitter-extractor/tests/multiple_languages.rs b/shared/tree-sitter-extractor/tests/multiple_languages.rs index 483b90a2d7cd..12a505f01701 100644 --- a/shared/tree-sitter-extractor/tests/multiple_languages.rs +++ b/shared/tree-sitter-extractor/tests/multiple_languages.rs @@ -39,7 +39,7 @@ fn multiple_language_extractor() { languages: vec![lang_ql, lang_json], trap_dir, source_archive_dir, - file_list, + file_lists: vec![file_list], trap_compression: Ok(trap::Compression::Gzip), };