File tree Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,14 @@ exclude = [
15
15
" .rustwide-docker" ,
16
16
]
17
17
18
+ [features ]
19
+ consistency_check = [" crates-index" ]
20
+
18
21
[dependencies ]
19
22
log = " 0.4"
20
23
regex = " 1"
21
24
structopt = " 0.3"
22
- crates-index = " 0.15.1"
25
+ crates-index = { version = " 0.15.1" , optional = true }
23
26
crates-index-diff = " 7.1.1"
24
27
reqwest = { version = " 0.10.6" , features = [" blocking" , " json" ] } # TODO: Remove blocking when async is ready
25
28
semver = { version = " 0.9" , features = [" serde" ] }
Original file line number Diff line number Diff line change @@ -404,6 +404,7 @@ enum DatabaseSubcommand {
404
404
} ,
405
405
406
406
/// Compares the database with the index and resolves inconsistencies
407
+ #[ cfg( feature = "consistency_check" ) ]
407
408
Synchronize {
408
409
/// Don't actually resolve the inconsistencies, just log them
409
410
#[ structopt( long) ]
@@ -455,6 +456,7 @@ impl DatabaseSubcommand {
455
456
. context ( "failed to delete the crate" ) ?,
456
457
Self :: Blacklist { command } => command. handle_args ( ctx) ?,
457
458
459
+ #[ cfg( feature = "consistency_check" ) ]
458
460
Self :: Synchronize { dry_run } => {
459
461
docs_rs:: utils:: consistency:: run_check ( & mut * ctx. conn ( ) ?, & * ctx. index ( ) ?, dry_run) ?;
460
462
}
Original file line number Diff line number Diff line change @@ -2,11 +2,12 @@ use std::{path::PathBuf, process::Command};
2
2
3
3
use url:: Url ;
4
4
5
- use self :: { api:: Api , crates :: Crates } ;
5
+ use self :: api:: Api ;
6
6
use crate :: error:: Result ;
7
7
use failure:: ResultExt ;
8
8
9
9
pub ( crate ) mod api;
10
+ #[ cfg( feature = "consistency_check" ) ]
10
11
mod crates;
11
12
12
13
pub struct Index {
@@ -83,15 +84,16 @@ impl Index {
83
84
Ok ( diff)
84
85
}
85
86
86
- pub ( crate ) fn crates ( & self ) -> Result < Crates > {
87
+ #[ cfg( feature = "consistency_check" ) ]
88
+ pub ( crate ) fn crates ( & self ) -> Result < crates:: Crates > {
87
89
// First ensure the index is up to date, peeking will pull the latest changes without
88
90
// affecting anything else.
89
91
log:: debug!( "Updating index" ) ;
90
92
self . diff ( ) ?. peek_changes ( ) ?;
91
93
// It'd be nice to use `crates_index` directly for interacting with the index, but it
92
94
// doesn't support bare repositories. So we use its `Crate` type but walk the index
93
95
// ourselves.
94
- Ok ( Crates :: new ( git2:: Repository :: open ( & self . path ) ?) )
96
+ Ok ( crates :: Crates :: new ( git2:: Repository :: open ( & self . path ) ?) )
95
97
}
96
98
97
99
pub fn api ( & self ) -> & Api {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ pub(crate) use self::rustc_version::parse_rustc_version;
14
14
pub ( crate ) use self :: cargo_metadata:: { Dependency , Target } ;
15
15
16
16
mod cargo_metadata;
17
+ #[ cfg( feature = "consistency_check" ) ]
17
18
pub mod consistency;
18
19
mod copy;
19
20
mod daemon;
You can’t perform that action at this time.
0 commit comments