File tree Expand file tree Collapse file tree 5 files changed +21
-13
lines changed Expand file tree Collapse file tree 5 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,15 @@ options:
23
23
title : Controls compression for the TRAP files written by the extractor.
24
24
description : >
25
25
This option is only intended for use in debugging the extractor. Accepted
26
- values are 'gzip' (the default, to write gzip-compressed TRAP) and 'none'
27
- (to write uncompressed TRAP).
26
+ values are 'gzip' (to write gzip-compressed TRAP) and 'none'
27
+ (currently the default, to write uncompressed TRAP).
28
28
type : string
29
29
pattern : " ^(none|gzip)$"
30
- extract_dependencies :
31
- title : Whether to extract dependencies .
30
+ cargo_target_dir :
31
+ title : Directory to use for cargo output files .
32
32
description : >
33
- Extract the source code of dependencies and the standard libraries in addition to
34
- normal source code.
33
+ This value is an optional path to use as `CARGO_TARGET_DIR` for the internal
34
+ cargo commands the extractor uses. Pointing it to a persistent directory may
35
+ reduce execution time of consecutive extractor runs. By default, a new scratch
36
+ directory is used for each run.
35
37
type : string
36
- pattern : " ^(false|true)$"
Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ pub fn extractor_cli_config(_attr: TokenStream, item: TokenStream) -> TokenStrea
21
21
#id: bool ,
22
22
} ;
23
23
}
24
+ if p. path . segments . len ( ) == 1 && p. path . segments [ 0 ] . ident == "Option" {
25
+ return quote ! {
26
+ #[ arg( long) ]
27
+ #id: #ty,
28
+ } ;
29
+ }
24
30
}
25
31
if id == & format_ident ! ( "verbose" ) {
26
32
quote ! {
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ pub struct Config {
37
37
pub scratch_dir : PathBuf ,
38
38
pub trap_dir : PathBuf ,
39
39
pub source_archive_dir : PathBuf ,
40
- pub extract_dependencies : bool ,
40
+ pub cargo_target_dir : Option < PathBuf > ,
41
41
pub verbose : u8 ,
42
42
pub compression : Compression ,
43
43
pub inputs : Vec < PathBuf > ,
Original file line number Diff line number Diff line change @@ -130,8 +130,11 @@ fn main() -> anyhow::Result<()> {
130
130
}
131
131
extractor. extract_without_semantics ( file, "no manifest found" ) ;
132
132
}
133
+ let target_dir = & cfg
134
+ . cargo_target_dir
135
+ . unwrap_or_else ( || cfg. scratch_dir . join ( "target" ) ) ;
133
136
for ( manifest, files) in map. values ( ) . filter ( |( _, files) | !files. is_empty ( ) ) {
134
- if let Some ( ( ref db, ref vfs) ) = RustAnalyzer :: load_workspace ( manifest, & cfg . scratch_dir ) {
137
+ if let Some ( ( ref db, ref vfs) ) = RustAnalyzer :: load_workspace ( manifest, target_dir ) {
135
138
let semantics = Semantics :: new ( db) ;
136
139
for file in files {
137
140
let Some ( id) = path_to_file_id ( file, vfs) else {
Original file line number Diff line number Diff line change @@ -45,13 +45,11 @@ pub struct ParseResult<'a> {
45
45
impl < ' a > RustAnalyzer < ' a > {
46
46
pub fn load_workspace (
47
47
project : & ProjectManifest ,
48
- scratch_dir : & Path ,
48
+ target_dir : & Path ,
49
49
) -> Option < ( RootDatabase , Vfs ) > {
50
50
let config = CargoConfig {
51
51
sysroot : Some ( RustLibSource :: Discover ) ,
52
- target_dir : ra_ap_paths:: Utf8PathBuf :: from_path_buf ( scratch_dir. to_path_buf ( ) )
53
- . map ( |x| x. join ( "target" ) )
54
- . ok ( ) ,
52
+ target_dir : ra_ap_paths:: Utf8PathBuf :: from_path_buf ( target_dir. to_path_buf ( ) ) . ok ( ) ,
55
53
..Default :: default ( )
56
54
} ;
57
55
let progress = |t| ( log:: trace!( "progress: {}" , t) ) ;
You can’t perform that action at this time.
0 commit comments