Skip to content

Commit 0a89fe4

Browse files
committed
attempted fix (creates another bug)
1 parent 8045b53 commit 0a89fe4

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/dfx/src/lib/models/canister.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -554,16 +554,22 @@ impl CanisterPool {
554554
}
555555

556556
/// Build only dependencies relevant for `canisters_to_build`.
557-
///
558-
/// FIXME: unused argument.
559557
#[context("Failed to build dependencies graph for canister pool.")]
560-
fn build_dependencies_graph(&self, _canisters_to_build: Option<Vec<String>>) -> DfxResult<DiGraph<CanisterId, ()>> {
558+
fn build_dependencies_graph(&self, canisters_to_build: Option<Vec<String>>) -> DfxResult<DiGraph<CanisterId, ()>> {
559+
// println!("canisters_to_build: {:?}", canisters_to_build);
561560
for canister in &self.canisters { // a little inefficient
562-
let canister_info = &canister.info;
563-
// FIXME: Is `unwrap()` in the next operator correct?
564-
// TODO: Ignored return value is a hack.
565-
let _deps: Vec<CanisterId> = canister.builder.get_dependencies(self, canister_info)?
566-
.into_iter().filter(|d| *d != canister_info.get_canister_id().unwrap()).collect(); // TODO: This is a hack.
561+
let contains = if let Some(canisters_to_build) = &canisters_to_build {
562+
canisters_to_build.iter().contains(&canister.get_info().get_name().to_string()) // TODO: a little slow
563+
} else {
564+
true // because user specified to build all canisters
565+
};
566+
if contains {
567+
let canister_info = &canister.info;
568+
// FIXME: Is `unwrap()` in the next operator correct?
569+
// TODO: Ignored return value is a hack.
570+
let _deps: Vec<CanisterId> = canister.builder.get_dependencies(self, canister_info)?
571+
.into_iter().filter(|d| *d != canister_info.get_canister_id().unwrap()).collect(); // TODO: This is a hack.
572+
}
567573
}
568574

569575
Ok(self.imports.borrow().graph.filter_map(

0 commit comments

Comments
 (0)