Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vporton committed Jan 29, 2025
1 parent 9c40e3c commit 7c23640
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/dfx/src/commands/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub struct RulesOpts {
output: Option<String>,
}

// TODO: When deploying a canister, deploy its dependendencies, even if `--no-compile``.
pub fn exec(env1: &dyn Environment, opts: RulesOpts) -> DfxResult {
let env = create_anonymous_agent_environment(env1, None)?;
// let log = env.get_logger();
Expand Down Expand Up @@ -158,19 +157,26 @@ pub fn exec(env1: &dyn Environment, opts: RulesOpts) -> DfxResult {
output_file.write_fmt(format_args!("{}:\n\t{}\n\n", make_target(graph, *node.1)?, command))?;
}
if let Import::Canister(canister_name) = node.0 {
output_file.write_fmt(format_args!("\ndeploy@{}: canister@{}\n", canister_name, canister_name))?;
output_file.write_fmt(format_args!("\ndeploy@{}: canister@{}", canister_name, canister_name))?;
let canister: std::sync::Arc<crate::lib::models::canister::Canister> = pool.get_first_canister_with_name(&canister_name).unwrap();
let deps = canister.as_ref().get_info().get_dependencies();
if !deps.is_empty() && !canister.as_ref().get_info().is_assets() {
output_file.write_fmt(format_args!(
" \\\n {}",
deps.iter().map(|name| format!("deploy@{}", name)).join(" "),
))?;
}
output_file.write_fmt(format_args!( // TODO: Use `canister install` instead.
"\tdfx deploy --no-compile --network $(NETWORK) $(DEPLOY_FLAGS) $(DEPLOY_FLAGS.{}) {}\n\n", canister_name, canister_name
"\n\tdfx deploy --no-compile --network $(NETWORK) $(DEPLOY_FLAGS) $(DEPLOY_FLAGS.{}) {}\n\n", canister_name, canister_name
))?;
// If the canister is assets, add `generate@` dependencies.
let canister = pool.get_first_canister_with_name(&canister_name).unwrap();
if canister.as_ref().get_info().is_assets() {
let deps = canister.as_ref().get_info().get_dependencies();
if !deps.is_empty() {
output_file.write_fmt(format_args!(
"\ncanister@{}: {}\n",
"\ncanister@{}: \\ {} \\ {}\n",
canister_name,
deps.iter().map(|name| format!("generate@{}", name)).join(" "),
deps.iter().map(|name| format!("deploy@{}", name)).join(" "),
))?;
}
}
Expand Down

0 comments on commit 7c23640

Please sign in to comment.