@@ -578,19 +578,19 @@ impl CanisterPool {
578
578
579
579
// FIXME: Verify after graph creation (and that creation does not stuck in an infinite loop).
580
580
// Verify the graph has no cycles.
581
- if let Err ( err) = petgraph:: algo:: toposort ( & graph, None ) {
582
- let message = match graph. node_weight ( err. node_id ( ) ) {
583
- Some ( canister_id) => match self . get_canister_info ( canister_id) {
584
- Some ( info) => info. get_name ( ) . to_string ( ) ,
585
- None => format ! ( "<{}>" , canister_id. to_text( ) ) ,
586
- } ,
587
- None => "<Unknown>" . to_string ( ) ,
588
- } ;
589
- return Err ( DfxError :: new ( BuildError :: DependencyError ( format ! (
590
- "Found circular dependency: {}" ,
591
- message
592
- ) ) ) )
593
- }
581
+ // if let Err(err) = petgraph::algo::toposort(&graph, None) {
582
+ // let message = match graph.node_weight(err.node_id()) {
583
+ // Some(canister_id) => match self.get_canister_info(canister_id) {
584
+ // Some(info) => info.get_name().to_string(),
585
+ // None => format!("<{}>", canister_id.to_text()),
586
+ // },
587
+ // None => "<Unknown>".to_string(),
588
+ // };
589
+ // return Err(DfxError::new(BuildError::DependencyError(format!(
590
+ // "Found circular dependency: {}",
591
+ // message
592
+ // ))))
593
+ // }
594
594
595
595
// Traverse, creating the graph of dependencies starting from `real_canisters_to_build` set.
596
596
let mut current_canisters_to_build =
@@ -604,8 +604,6 @@ impl CanisterPool {
604
604
// println!("self.canisters.len(): {}", self.canisters.len());
605
605
for canister in & self . canisters { // a little inefficient
606
606
// FIXME: Remove:
607
- println ! ( "current_canisters_to_build={:?} canister={}" ,
608
- current_canisters_to_build. keys( ) . map( |c| c. to_text( ) ) . collect:: <Vec <_>>( ) , canister. canister_id( ) ) ;
609
607
if !current_canisters_to_build. contains_key ( & canister. canister_id ( ) ) {
610
608
continue ;
611
609
}
@@ -614,14 +612,16 @@ impl CanisterPool {
614
612
// FIXME: Is `unwrap()` in the next operator correct?
615
613
let deps: Vec < CanisterId > = canister. builder . get_dependencies ( self , canister_info) ?
616
614
. into_iter ( ) . filter ( |d| * d != canister_info. get_canister_id ( ) . unwrap ( ) ) . collect ( ) ; // TODO: This is a hack.
617
- println ! ( "deps.len() : {}" , deps. len ( ) ) ;
615
+ // println!("PARENT : {}, DEPS: {:?} ", canister.get_info().get_canister_id()?.to_text(), deps.iter().map(|c| c.to_text()).collect::<Vec<_>>()); // FIXME
618
616
let node_ix = * id_set. entry ( canister_id) . or_insert_with ( || graph. add_node ( canister_id) ) ;
619
617
for d in deps {
620
618
let dep_ix = * id_set. entry ( d) . or_insert_with ( || graph. add_node ( d) ) ;
621
619
graph. add_edge ( node_ix, dep_ix, ( ) ) ;
622
620
current_canisters_to_build2. insert ( d, ( ) ) ;
621
+ println ! ( "canister_id={} -> d={}" , canister_id, d) ;
623
622
}
624
623
}
624
+ println ! ( "NEXT CYCLE" ) ; // FIXME: Remove.
625
625
if current_canisters_to_build2. is_empty ( ) { // passed to the end of the graph
626
626
break ;
627
627
}
0 commit comments