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 93e2a00 commit 5e5f3f5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/dfx/src/commands/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ pub fn exec(env1: &dyn Environment, opts: RulesOpts) -> DfxResult {
// We load dependencies before creating the file to minimize the time that the file is half-written.
// Load dependencies for Make rules:
let builder = CustomBuilder::new(env1)?; // TODO: hack // TODO: `&env` instead?
// TODO: hack:
let canister_names = config.get_config().canisters.as_ref().unwrap().keys().map(|k| k.to_string()).collect::<Vec<String>>();
let canisters = &config.get_config().canisters.as_ref();
let canister_names = if let Some(canisters) = canisters {
canisters.keys().map(|k| k.to_string()).collect::<Vec<String>>()
} else {
Vec::new()
};
let pool: CanisterPool = CanisterPool::load(
&env, // if `env1`, fails with "NetworkDescriptor only available from an AgentEnvironment"
false,
&canister_names, // FIXME: `unwrap`
&canister_names,
)?;
builder.read_all_dependencies(
&env,
Expand All @@ -58,7 +62,6 @@ pub fn exec(env1: &dyn Environment, opts: RulesOpts) -> DfxResult {
output_file.write_fmt(format_args!("DEPLOY_FLAGS ?= \n\n"))?;
output_file.write_fmt(format_args!("ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))\n\n"))?;

let canisters = &config.get_config().canisters;
match &canisters {
Some(canisters) => {
let canisters: &BTreeMap<String, ConfigCanistersCanister> = canisters;
Expand Down

0 comments on commit 5e5f3f5

Please sign in to comment.