-
Notifications
You must be signed in to change notification settings - Fork 98
build: use moc to build distributed canisters; move canister source into a single directory #822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4faa02c
build: use moc to build distributed canisters; move canister source i…
87e7c41
build with --release rather than --debug
0a498dc
Merge branch 'master' into ericswanson-680-distributed-canisters-moc
26ed444
Merge branch 'master' into ericswanson-680-distributed-canisters-moc
15faac6
Merge branch 'master' into ericswanson-680-distributed-canisters-moc
ac39f82
Merge branch 'master' into ericswanson-680-distributed-canisters-moc
9a3228b
Merge branch 'master' into ericswanson-680-distributed-canisters-moc
f2d88f7
Merge branch 'master' into ericswanson-680-distributed-canisters-moc
0a45ab5
Merge branch 'master' into ericswanson-680-distributed-canisters-moc
fb9afcd
Merge branch 'master' into ericswanson-680-distributed-canisters-moc
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,32 @@ | ||
| { pkgs ? import ./nix {} | ||
| , assets-minimal ? import ./assets-minimal.nix { inherit pkgs; } | ||
| , dfx-minimal ? import ./dfx-minimal.nix { inherit pkgs assets-minimal; } | ||
| }: | ||
| let | ||
| distributed = lib.noNixFiles (lib.gitOnlySource ./. ./src/distributed); | ||
| lib = pkgs.lib; | ||
|
|
||
| workspace = pkgs.runCommandNoCC "distributed-canisters-workspace" {} '' | ||
| # We want $HOME/.cache to be in a writable temporary directory. | ||
| export HOME=$(mktemp -d -t dfx-distributed-canisters-home-XXXX) | ||
| mkdir -p $out | ||
| for source_root in ${distributed}/*; do | ||
| canister_name=$(basename $source_root) | ||
| build_dir=$out/$canister_name | ||
| mkdir -p $build_dir | ||
| cp -R $source_root/* $build_dir | ||
| ( cd $build_dir ; DFX_ASSETS=${assets-minimal} ${dfx-minimal}/bin/dfx build --check ) | ||
| done | ||
| ''; | ||
|
|
||
| in | ||
| pkgs.runCommandNoCCLocal "distributed-canisters" {} '' | ||
| for canister_root in ${workspace}/*; do | ||
| canister_name=$(basename $canister_root) | ||
| output_dir=$out/$canister_name | ||
| mkdir -p $output_dir | ||
| for ext in did wasm | ||
| do | ||
| cp $canister_root/.dfx/local/canisters/$canister_name/$canister_name.$ext $output_dir | ||
| done | ||
| pkgs.runCommandNoCCLocal "distributed-canisters" { | ||
| inherit (pkgs.motoko) didc rts; | ||
| moc = pkgs.motoko.moc-bin; | ||
| base = pkgs.motoko.base-src; | ||
| } '' | ||
| mkdir -p $out | ||
| for canister_mo in ${distributed}/*.mo; do | ||
| canister_name=$(basename -s .mo $canister_mo) | ||
| build_dir=$out/$canister_name | ||
| mkdir -p $build_dir | ||
| $moc/bin/moc \ | ||
| $canister_mo \ | ||
| -o $build_dir/$canister_name.did \ | ||
| --idl \ | ||
| --package base $base | ||
| MOC_RTS=$rts/rts/mo-rts.wasm $moc/bin/moc \ | ||
| $canister_mo \ | ||
| -o $build_dir/$canister_name.wasm \ | ||
| -c --release \ | ||
| --package base $base | ||
| done | ||
| '' | ||
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we currently have a single Motoko file in
distributed. Is this directory expected to grow quite a bit? If so it's probably more efficient to have multiple derivations that build a single Motoko file instead of a single derivation that builds multiple Motoko files.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, but it does make sense that if we had more than a few of these, it could be better to use a parameterized derivation.