File tree 1 file changed +14
-2
lines changed 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ pub struct Builder {
19
19
lib : Option < ( path:: PathBuf , Option < String > ) > ,
20
20
lib_cargo : Option < Cargo > ,
21
21
std_types : bool ,
22
+ lockfile : Option < path:: PathBuf > ,
22
23
}
23
24
24
25
impl Builder {
@@ -29,6 +30,7 @@ impl Builder {
29
30
lib : None ,
30
31
lib_cargo : None ,
31
32
std_types : true ,
33
+ lockfile : None ,
32
34
}
33
35
}
34
36
@@ -248,6 +250,14 @@ impl Builder {
248
250
self
249
251
}
250
252
253
+ #[ allow( unused) ]
254
+ pub fn with_lockfile < P : AsRef < path:: Path > > ( mut self , lockfile : P ) -> Builder {
255
+ debug_assert ! ( self . lockfile. is_none( ) ) ;
256
+ debug_assert ! ( self . lib_cargo. is_none( ) ) ;
257
+ self . lockfile = Some ( path:: PathBuf :: from ( lockfile. as_ref ( ) ) ) ;
258
+ self
259
+ }
260
+
251
261
pub fn generate ( self ) -> Result < Bindings , Error > {
252
262
let mut result = Parse :: new ( ) ;
253
263
@@ -260,18 +270,20 @@ impl Builder {
260
270
}
261
271
262
272
if let Some ( ( lib_dir, binding_lib_name) ) = self . lib . clone ( ) {
273
+ let lockfile = self . lockfile . as_ref ( ) . and_then ( |p| p. to_str ( ) ) ;
274
+
263
275
let cargo = if let Some ( binding_lib_name) = binding_lib_name {
264
276
Cargo :: load (
265
277
& lib_dir,
266
- None ,
278
+ lockfile ,
267
279
Some ( & binding_lib_name) ,
268
280
self . config . parse . parse_deps ,
269
281
self . config . parse . clean ,
270
282
) ?
271
283
} else {
272
284
Cargo :: load (
273
285
& lib_dir,
274
- None ,
286
+ lockfile ,
275
287
None ,
276
288
self . config . parse . parse_deps ,
277
289
self . config . parse . clean ,
You can’t perform that action at this time.
0 commit comments