1
1
2
- //! DocBuilder
3
-
4
- // TODO:
5
- // * Need to get proper version of crate when dealing with local dependencies
6
- // Some crates are using '*' version for their local dependencies. DocBuilder
7
- // or Crate must get proper version information. To do this, I am planning
8
- // to find correct crate file in crates.io-index and generate a crate
9
- // from it. And add a function like find_version to return correct version
10
- // of local dependency.
11
-
12
2
pub mod crte;
13
3
14
4
use std:: io:: prelude:: * ;
@@ -24,7 +14,6 @@ use toml;
24
14
use regex:: Regex ;
25
15
26
16
27
- /// Alright
28
17
pub struct DocBuilder {
29
18
keep_build_directory : bool ,
30
19
destination : PathBuf ,
@@ -35,6 +24,7 @@ pub struct DocBuilder {
35
24
logs_path : PathBuf ,
36
25
skip_if_exists : bool ,
37
26
skip_if_log_exists : bool ,
27
+ build_only_latest_version : bool ,
38
28
debug : bool ,
39
29
}
40
30
@@ -111,6 +101,7 @@ impl Default for DocBuilder {
111
101
keep_build_directory : false ,
112
102
skip_if_exists : false ,
113
103
skip_if_log_exists : false ,
104
+ build_only_latest_version : false ,
114
105
debug : false ,
115
106
}
116
107
}
@@ -194,6 +185,10 @@ impl DocBuilder {
194
185
self . skip_if_log_exists = b;
195
186
}
196
187
188
+ pub fn build_only_latest_version ( & mut self , b : bool ) {
189
+ self . build_only_latest_version = b;
190
+ }
191
+
197
192
198
193
pub fn check_paths ( & self ) -> Result < ( ) , DocBuilderPathError > {
199
194
if !self . destination . exists ( ) {
@@ -263,6 +258,12 @@ impl DocBuilder {
263
258
& crte. name, & crte. versions[ i] , e)
264
259
}
265
260
}
261
+
262
+ // if self.build_only_latest_version is true
263
+ // we are skipping oldest versions of crate
264
+ if self . build_only_latest_version {
265
+ break ;
266
+ }
266
267
}
267
268
}
268
269
0 commit comments