-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: use moc to build distributed canisters; move canister source i…
…nto a single directory (#822) Build the distributed canisters (just assetstorage, at this point) with `moc` directly, rather than with `dfx`. This means we won't have to build `dfx` twice when building, opening a nix shell, etc. Removed the `dfx-minimal` derivation and consolidated the `assets-minimal` derivation into `assets`.
- Loading branch information
1 parent
7a45d07
commit 3ff6757
Showing
7 changed files
with
31 additions
and
110 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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.