Skip to content

Commit b64b537

Browse files
committed
don't trace libraries
1 parent 7881f3d commit b64b537

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

src/dfx/src/lib/builders/motoko.rs

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use crate::lib::metadata::names::{CANDID_ARGS, CANDID_SERVICE};
99
use crate::lib::models::canister::{CanisterPool, ImportsTracker, MotokoImport};
1010
use crate::lib::package_arguments::{self, PackageArguments};
1111
use crate::util::assets::management_idl;
12-
use crate::lib::builders::bail;
13-
use anyhow::{anyhow, Context};
12+
use anyhow::Context;
1413
use candid::Principal as CanisterId;
1514
use dfx_core::config::cache::Cache;
1615
use dfx_core::config::model::dfinity::{MetadataVisibility, Profile};
@@ -222,29 +221,31 @@ impl CanisterBuilder for MotokoBuilder {
222221
None
223222
}
224223
}
225-
MotokoImport::Lib(path) => {
226-
let i = path.find('/');
227-
let pre_path = if let Some(i) = i {
228-
let expanded = Path::new(
229-
package_arguments_map.get(&path[..i]).ok_or_else(|| anyhow!("nonexisting package"))?
230-
);
231-
expanded.join(&path[i+1..])
232-
} else {
233-
Path::new(path.as_str()).to_owned()
234-
};
235-
let path2 = pre_path.to_str().unwrap().to_owned() + ".mo";
236-
let path2 = path2.to_string();
237-
let path2 = Path::new(&path2);
238-
if path2.exists() { // TODO: Is it correct order of two variants?
239-
Some(Path::new(path2).to_owned())
240-
} else {
241-
let path3 = pre_path.join(Path::new("lib.mo"));
242-
if path3.exists() {
243-
Some(path3.to_owned())
244-
} else {
245-
bail!("source file has been deleted");
246-
}
247-
}
224+
MotokoImport::Lib(_path) => {
225+
continue;
226+
// We probably don't need to take into account library dependencies, to save CPU time.
227+
// let i = path.find('/');
228+
// let pre_path = if let Some(i) = i {
229+
// let expanded = Path::new(
230+
// package_arguments_map.get(&path[..i]).ok_or_else(|| anyhow!("nonexisting package"))?
231+
// );
232+
// expanded.join(&path[i+1..])
233+
// } else {
234+
// Path::new(path.as_str()).to_owned()
235+
// };
236+
// let path2 = pre_path.to_str().unwrap().to_owned() + ".mo";
237+
// let path2 = path2.to_string();
238+
// let path2 = Path::new(&path2);
239+
// if path2.exists() { // TODO: Is it correct order of two variants?
240+
// Some(Path::new(path2).to_owned())
241+
// } else {
242+
// let path3 = pre_path.join(Path::new("lib.mo"));
243+
// if path3.exists() {
244+
// Some(path3.to_owned())
245+
// } else {
246+
// bail!("source file has been deleted");
247+
// }
248+
// }
248249
}
249250
MotokoImport::Relative(path) => {
250251
Some(Path::new(&path).to_owned())

0 commit comments

Comments
 (0)