I created an MR to DFX: Now it recompiles only Motoko canisters with changed source files. (This behavior is similar to behavior of Unix Make utility.) Moreover, it does not consider as updated canisters for which the .did
file didn’t change, for the purpose of inter-canister dependencies.
Actually, with big source bases, it saves much developer’s time on recompilations. I have Motoko software that compiles ~30min.
The MR also has the following effects:
- When deploying a canister, deploy also all its dependencies.
- When
.did
of a canister changed, the dependent canisters are recompiled, if specified to be compiled in command line. - It adds
"deploy": false
to canister options for canisters than need to be compiled but not deployed. That’s an unrelated change, but for me is very difficult to test changes separately.
The code seems working (more testing is needed, please participate in testing), but my code contains multiple TODO
comments.
Please, give me further directions on making the MR.
The MR heavily uses graph algorithms (not lib::graph that I added, in particular), constructing first a DAG of file dependencies, then reducing this DAG to smaller DAG of canister dependencies. Not all the code is optimized, but it isn’t terribly inefficient.
Also, I requested a $5k grant for this change. Please, review the grant.
I probably, should interrupt my other works and more battle-test DFX for my Motoko project.