-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathextractor.rs
More file actions
44 lines (36 loc) · 1.28 KB
/
Copy pathextractor.rs
File metadata and controls
44 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use clap::Args;
use std::path::PathBuf;
use codeql_extractor::extractor::simple;
use codeql_extractor::trap;
use crate::languages;
#[derive(Args)]
pub struct Options {
/// Sets a custom source archive folder
#[arg(long)]
source_archive_dir: PathBuf,
/// Sets a custom trap folder
#[arg(long)]
output_dir: PathBuf,
/// A text file containing the paths of the files to extract
#[arg(long)]
file_list: PathBuf,
}
pub fn run(options: Options) -> std::io::Result<()> {
codeql_extractor::extractor::set_tracing_level("unified");
// The generated dbscheme/QL library uses the unified_* relation namespace.
// Keep per-language specs for parser/rules/file globs, but normalize the
// extraction table prefix so emitted TRAP relations match the dbscheme.
let mut languages = languages::all_language_specs();
for lang in &mut languages {
lang.prefix = "unified";
}
let extractor = simple::Extractor {
prefix: "unified".to_string(),
languages,
trap_dir: options.output_dir,
trap_compression: trap::Compression::from_env("CODEQL_EXTRACTOR_UNIFIED_OPTION_TRAP_COMPRESSION"),
source_archive_dir: options.source_archive_dir,
file_lists: vec![options.file_list],
};
extractor.run()
}