File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,7 +48,11 @@ impl Skeleton {
4848 base_path : P ,
4949 member : Option < String > ,
5050 ) -> Result < Self , anyhow:: Error > {
51- let graph = extract_package_graph ( base_path. as_ref ( ) ) ?;
51+ // Use `--no-deps` to skip dependency resolution when we don't need the full graph
52+ // (i.e. no `--bin` filtering). We still need full resolution when there's no existing
53+ // Cargo.lock, since `cargo metadata` generates it as a side effect.
54+ let no_deps = member. is_none ( ) && base_path. as_ref ( ) . join ( "Cargo.lock" ) . exists ( ) ;
55+ let graph = extract_package_graph ( base_path. as_ref ( ) , no_deps) ?;
5256
5357 // Read relevant files from the filesystem
5458 let config_file = read:: config ( & base_path) ?;
@@ -311,9 +315,12 @@ fn serialize_manifests(manifests: Vec<ParsedManifest>) -> Result<Vec<Manifest>,
311315 Ok ( serialised_manifests)
312316}
313317
314- fn extract_package_graph ( path : & Path ) -> Result < PackageGraph , anyhow:: Error > {
318+ fn extract_package_graph ( path : & Path , no_deps : bool ) -> Result < PackageGraph , anyhow:: Error > {
315319 let mut cmd = guppy:: MetadataCommand :: new ( ) ;
316320 cmd. current_dir ( path) ;
321+ if no_deps {
322+ cmd. no_deps ( ) ;
323+ }
317324 cmd. build_graph ( ) . context ( "Cannot extract package graph" )
318325}
319326
You can’t perform that action at this time.
0 commit comments