DFX deploy with custom Motoko version

Is there an easy way to let dfx use $(vessel bin)/moc instead of $(dfx cache show)/moc to build motoko canisters?

3 Likes

I wanted that too recently. Probably "type":"custom" and "build":"some script" will work, but that doesn’t really qualify as an “easy” way.

1 Like

Is there a reason why vessel uses a different moc version than dfx? It’s kinda confusing.

What if I use one version of Motoko to build my canister (i.e. dfx’s version), but use another version of Motoko to build my dependencies (i.e. vessel’s version)? Or does vessel not actually build/compile dependencies?

1 Like

Actually, now that I look into the vessel source code, I don’t quite see the purpose of specifying a compiler in your project’s vessel.dhall to begin with.

That compiler version in vessel.dhall isn’t used by any vessel command except vessel bin. It’s not used by vessel verify (you still need to pass in a --moc or --version flag manually) or, as OP noted, by dfx build.

So it’s not really useful at all but just an easier way to install a moc binary onto your local filesystem.

DFX_MOC_PATH="$(vessel bin)/moc" dfx deploy
4 Likes

is this documented somewhere or did you go through the source code?

is this documented somewhere or did you go through the source code?

I found this by going through the source code.

1 Like