Skip to content
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

feat: rebuild only necessary canisters #3710

Open
wants to merge 388 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
388 commits
Select commit Hold shift + click to select a range
3535510
bug fix
vporton Apr 22, 2024
3104ff6
removed tracing
vporton Apr 22, 2024
a07d998
bug fix
vporton Apr 22, 2024
7033768
bug fix
vporton Apr 22, 2024
9a70bbe
removed commented out code
vporton Apr 22, 2024
a62f989
comment typo
vporton Apr 22, 2024
bc800c1
bug fix
vporton Apr 22, 2024
174eaf6
code formatting
vporton Apr 22, 2024
8792959
fixes
vporton Apr 22, 2024
88f5d98
comment
vporton Apr 22, 2024
88e7b64
misc
vporton Apr 22, 2024
a8f18a2
removed tracing
vporton Apr 23, 2024
3ce3ddc
started to work on automated testing
vporton Apr 23, 2024
c1b6831
test breaking dependency compiling
vporton Apr 23, 2024
65e79f2
fix bug in tests
vporton Apr 23, 2024
18a369d
trying to rectify a test
vporton Apr 23, 2024
3b184ca
misc
vporton Apr 24, 2024
108b233
bug fix
vporton Apr 24, 2024
769f89c
misc
vporton Apr 24, 2024
cd89676
more tests
vporton Apr 24, 2024
b2c7ade
comment typo
vporton Apr 24, 2024
bf7c1c7
refactor
vporton Apr 24, 2024
280fdb7
refactor
vporton Apr 24, 2024
d4a4254
refactor
vporton Apr 24, 2024
4f9daea
refactor
vporton Apr 24, 2024
ac88641
some Clippy fixes
vporton Apr 24, 2024
6c68fc1
clippy recommendations followed
vporton Apr 24, 2024
78625ea
error noted
vporton Apr 24, 2024
b81331a
small test
vporton Apr 24, 2024
32ae10a
comment changed
vporton Apr 24, 2024
98c5251
bug fix
vporton Apr 24, 2024
656715c
tests passed
vporton Apr 24, 2024
547fcf7
merged master
vporton Apr 24, 2024
746a2fe
removed outdated FIXME comments
vporton Apr 24, 2024
8b3ce17
more logging
vporton Apr 24, 2024
4cb5f08
Merge branch 'master' into build-only-necessary-dev
vporton Apr 24, 2024
a7096f2
removed FIXME code
vporton Apr 24, 2024
b02b598
bug fix
vporton Apr 24, 2024
476cb08
refactor
vporton Apr 24, 2024
ab14e40
bug fix
vporton Apr 24, 2024
7025c46
FIXME -> TODO
vporton Apr 24, 2024
4309de1
solving FIXMEs
vporton Apr 24, 2024
2ef1d8f
removed outdated TODO
vporton Apr 24, 2024
a0e6e0c
removed TODO
vporton Apr 24, 2024
d5c219f
removed commented out line
vporton Apr 24, 2024
3885c46
followed clippy's recommendation
vporton Apr 24, 2024
aaa07b0
bug fix
vporton Apr 24, 2024
f564c44
bug fix
vporton Apr 24, 2024
6a98bb3
bug fix
vporton Apr 24, 2024
f52f76a
removed tracing
vporton Apr 24, 2024
afc0262
cargo fmt
vporton Apr 24, 2024
6307b5d
fixing a bug
vporton Apr 25, 2024
e9e196e
removed a confusing comment
vporton Apr 25, 2024
3ef1b1f
cargo fmt
vporton Apr 25, 2024
1e9d90e
bug fix
vporton Apr 25, 2024
d3b07ef
fixing bug
vporton Apr 25, 2024
41b19d1
code reorganized
vporton Apr 25, 2024
5f62f4a
temporarily disabled a test
vporton Apr 25, 2024
293c120
refactor
vporton Apr 25, 2024
2f31661
bug fixes
vporton Apr 25, 2024
f9a4228
bug fixes
vporton Apr 25, 2024
c388547
bug fix
vporton Apr 25, 2024
948bcc1
variables renamed
vporton Apr 25, 2024
09d4aa1
refactor
vporton Apr 25, 2024
428ecfd
misc
vporton Apr 25, 2024
9bc54ee
bug fix
vporton Apr 25, 2024
b3a8697
function renamed
vporton Apr 25, 2024
65dcb23
bug fix
vporton Apr 25, 2024
66129df
more tests
vporton Apr 25, 2024
741a666
bug fix
vporton Apr 25, 2024
250962a
removed tracing
vporton Apr 25, 2024
be650ac
bug fix
vporton Apr 25, 2024
4c26aa1
bug fix
vporton Apr 25, 2024
17bd807
comment
vporton Apr 25, 2024
073054a
make_like.bash tests passed
vporton Apr 25, 2024
6d06759
tracing removed
vporton Apr 25, 2024
662dbe9
debugging
vporton Apr 25, 2024
358881f
bug fixing (does not compile)
vporton Apr 25, 2024
b4ecb96
bug fix (untested)
vporton Apr 25, 2024
50ce05f
rewriting to fix a bug
vporton Apr 25, 2024
f8ca306
bug in a e2e test fixed
vporton Apr 25, 2024
7a187ba
bug in a e2e test fixed
vporton Apr 25, 2024
c855cf4
bug fix in tests
vporton Apr 26, 2024
7c5e027
tests passed
vporton Apr 26, 2024
b7f2109
more tests
vporton Apr 26, 2024
da92149
more tests
vporton Apr 26, 2024
c499e7d
fixing wrong deployment
vporton Apr 26, 2024
3b9b47b
fixing a bug
vporton Apr 26, 2024
4868c2d
bug fix
vporton Apr 26, 2024
5c535ed
removed outdated FIXME
vporton Apr 26, 2024
3b64f01
bug fix
vporton Apr 26, 2024
12b5d0c
removed an outdated TODO
vporton Apr 26, 2024
973df62
eliminate a superfluous condition
vporton Apr 26, 2024
7ab36ec
bug fix
vporton Apr 26, 2024
f150763
bug fix
vporton Apr 26, 2024
dfc8aef
removed a wrong FIXME
vporton Apr 26, 2024
c0db95b
cargo fmt
vporton Apr 26, 2024
882514b
eliminated Clippy warnings
vporton Apr 26, 2024
5ad7844
remove an outdated comment
vporton Apr 26, 2024
85f439a
don't update .did file if not changed
vporton Apr 26, 2024
e1d9e9f
ignore canisters with unchanged .did
vporton Apr 26, 2024
9097b69
docs
vporton Apr 26, 2024
83e908e
rebuild only if Candid changed
vporton Apr 26, 2024
fbf5e4e
added (failed) tests
vporton Apr 26, 2024
8bfedb8
Merge branch 'master' into build-only-necessary
vporton Apr 26, 2024
0d490ad
bug fix
vporton Apr 26, 2024
2638986
tests passed
vporton Apr 26, 2024
61f7bc3
removed tracing
vporton Apr 26, 2024
410c6df
more tests
vporton Apr 26, 2024
79f1faf
bug fix
vporton Apr 26, 2024
c595c35
merged master
vporton Apr 26, 2024
b2b48db
half-done bug fix
vporton Apr 26, 2024
4bd860b
bug fix (untested)
vporton Apr 26, 2024
c42605c
added (failing) test add_dependency.bash
vporton Apr 27, 2024
de1f6c8
Merge branch 'build-only-necessary' of github.com:vporton/sdk into bu…
vporton Apr 27, 2024
fc75b7d
English grammar
vporton Apr 27, 2024
f178964
better test
vporton Apr 27, 2024
4419e5a
Merge branch 'build-only-necessary-dev' into build-only-necessary
vporton Apr 27, 2024
f491334
Merge branch 'build-only-necessary-dev' into preserve-candid
vporton Apr 27, 2024
a918624
Merge branch 'build-only-necessary' into preserve-candid
vporton Apr 27, 2024
df9dd8d
removed an undersophisticated error
vporton Apr 27, 2024
84609b5
removed tracing
vporton Apr 27, 2024
67257e9
bug fix (introduced another bug)
vporton Apr 27, 2024
76a95d1
bug fix (introduced another bug)
vporton Apr 27, 2024
836a737
removed tracing
vporton Apr 28, 2024
af79910
alleged bug fix
vporton Apr 28, 2024
3b00420
bug fixes
vporton Apr 28, 2024
863e6b5
Merge branch 'build-only-necessary-dev' into build-only-necessary
vporton Apr 28, 2024
81ea12f
Merge branch 'build-only-necessary' into preserve-candid
vporton Apr 28, 2024
345bf4f
merged branches
vporton Apr 28, 2024
f568ffb
cargo fmt
vporton Apr 28, 2024
36b0c51
removed unused self parameter
vporton Apr 28, 2024
abd6b6f
Merge branch 'build-only-necessary-dev' into build-only-necessary
vporton Apr 28, 2024
80aac35
merge
vporton Apr 28, 2024
6b3a965
make #3733 bug repeatable
vporton Apr 29, 2024
d3a8812
dfx.json simplified
vporton Apr 29, 2024
14262e4
removed unused source files from sample code
vporton Apr 29, 2024
2fdf11b
simplified sample code
vporton Apr 29, 2024
7ad5e49
yet simplified sample code
vporton Apr 29, 2024
5e5a8de
removed unnecessary configuration from sample
vporton Apr 29, 2024
b39ac77
created a minimal example for bug #3733
vporton Apr 29, 2024
4965c02
renamed
vporton Apr 29, 2024
b27c8a2
Merge remote-tracking branch 'upstream/master' into dont-deploy
vporton Apr 29, 2024
ffd9b4e
merge upstream
vporton May 4, 2024
9a21ebf
merged master
vporton May 6, 2024
9fb8c37
fixing an error (does not compile now)
vporton May 6, 2024
08e4204
made compilable
vporton May 6, 2024
0770004
test wrong_ids.bash passed
vporton May 6, 2024
224fa18
simplified
vporton May 6, 2024
ec41d45
removed tracing
vporton May 6, 2024
8b416b3
removed unused variable
vporton May 6, 2024
16330bc
added test broken_canister_dep.bash
vporton May 6, 2024
8aa8c63
passed a e2e test
vporton May 6, 2024
975c274
Merge branch 'build-only-necessary-dev' into preserve-candid
vporton May 6, 2024
acdf371
CHANGELOG
vporton May 7, 2024
f4fad29
trying to fix bugs
vporton May 7, 2024
544b1a9
misc
vporton May 7, 2024
6c78437
removed tracing
vporton May 7, 2024
0f6fd14
code formatting
vporton May 7, 2024
559869a
cargo fmt & cpilly
vporton May 7, 2024
eed2047
attempted bug fix in `dfx build`
vporton May 7, 2024
c0a7a86
bug fix
vporton May 7, 2024
092d91f
bug fix
vporton May 9, 2024
f9def45
a bug fix introducing new bugs
vporton May 9, 2024
f968255
bug fix
vporton May 9, 2024
cd093c5
removed tracing
vporton May 9, 2024
8fe9f5f
removed unused import
vporton May 9, 2024
27c1b32
cargo clippy
vporton May 9, 2024
9d7770d
cargo fmt
vporton May 9, 2024
bbbdd8a
bug fix
vporton May 9, 2024
61d3441
bug fix
vporton May 9, 2024
4742995
removed tracing
vporton May 9, 2024
011f850
removed tracing
vporton May 9, 2024
22b167b
Revert "removed tracing"
vporton May 9, 2024
fa90db2
reduced tracing
vporton May 9, 2024
126fc0c
FIXME comment
vporton May 9, 2024
4195401
started my graph library
vporton May 9, 2024
3287d4a
refactoring
vporton May 9, 2024
a14a2f3
refactored (probably with errors)
vporton May 9, 2024
8be21aa
bug fixes
vporton May 9, 2024
101f5f5
refactor with possible bugfixes
vporton May 9, 2024
5525f85
small refactor
vporton May 9, 2024
f0ffa2a
bug fix
vporton May 9, 2024
75a828b
misc dev
vporton May 9, 2024
c469252
removed commented out code
vporton May 9, 2024
b219349
bug fix
vporton May 9, 2024
24df5c0
misc debugging
vporton May 9, 2024
f9c51f2
small refactor
vporton May 9, 2024
1fb5ccf
refactor
vporton May 9, 2024
cac0af7
bug fix
vporton May 10, 2024
4d87be9
removed tracing
vporton May 10, 2024
e79b5c0
Merge branch 'master' into build-only-necessary
vporton May 10, 2024
d1caf26
misc
vporton May 10, 2024
a903bad
bug fix and commented code removal
vporton May 10, 2024
cb777c9
removed outdated TODO comment
vporton May 10, 2024
cbd73b1
refactor
vporton May 10, 2024
5810bb0
refactor
vporton May 10, 2024
231fc52
function renamed
vporton May 10, 2024
6eb4106
Merge branch 'build-only-necessary' of github.com:vporton/sdk into bu…
vporton May 10, 2024
2c4a0d2
added `imports` to env
vporton May 10, 2024
ca55305
moved imports data to Environment
vporton May 10, 2024
5134b39
simplified
vporton May 10, 2024
49681b4
comment
vporton May 10, 2024
86589b3
Merge branch 'build-only-necessary-dev' into build-only-necessary
vporton May 10, 2024
51862b4
removed an outdated FIXME comment
vporton May 14, 2024
20eb813
removed an outdated FIXME comment
vporton May 14, 2024
e4afa4c
removed a done TODO comment
vporton May 14, 2024
4a9881a
reafctor
vporton May 14, 2024
c24b3ec
comment
vporton May 14, 2024
1dc9736
messages and comments
vporton May 14, 2024
0971460
removed a wrong TODO
vporton May 14, 2024
1d0b8f8
comments
vporton May 14, 2024
e4c401f
better error message
vporton May 14, 2024
36c69bd
removed unneeded TODO comment
vporton May 14, 2024
4100443
comment
vporton May 14, 2024
8fb62b2
removed unused code
vporton May 14, 2024
b07fe2f
comment correction
vporton May 14, 2024
ecb803d
removed an undoable TODO
vporton May 14, 2024
6d8560d
variable rename
vporton May 14, 2024
9c42521
removed superfluous TODO comment
vporton May 14, 2024
7f9ad79
Merge branch 'build-only-necessary-dev' into build-only-necessary
vporton May 14, 2024
0aec121
better error message
vporton May 14, 2024
027a249
Merge branch 'build-only-necessary-dev' into build-only-necessary
vporton May 14, 2024
d913a7f
Merge remote-tracking branch 'upstream/master' into build-only-necess…
vporton May 14, 2024
dfecd10
removed commented out code
vporton May 15, 2024
6bb29af
removed an inappropriate TODO comment
vporton May 15, 2024
7508357
Merge remote-tracking branch 'upstream/master' into build-only-necess…
vporton May 15, 2024
4d86bda
merge
vporton May 15, 2024
2134dc4
Merge remote-tracking branch 'upstream/master' into build-only-necess…
vporton May 25, 2024
27c9e4d
more error context
vporton May 25, 2024
8e9d0e0
fixed a regression (after adding more error contexts)
vporton May 25, 2024
94e656b
possible bug fix
vporton May 25, 2024
2cfbcf2
debugging
vporton May 25, 2024
39ced7e
debugging
vporton May 25, 2024
33fd5b5
"deploy writes all environment variables to .env" test passed
vporton May 25, 2024
89cbac6
removed warning
vporton May 25, 2024
3b57d0c
removed an overestimated TODO comment
vporton May 25, 2024
c8fe66d
clippy
vporton May 25, 2024
fdd2ce3
cargo fmt
vporton May 25, 2024
222654c
removed commented out code
vporton May 26, 2024
568cd6b
corrected test
vporton May 26, 2024
be01eea
bug fix
vporton May 26, 2024
fb9a28a
Merge branch 'master' into build-only-necessary
vporton May 31, 2024
9338d4b
removed an apparently fixed FIXME
vporton May 31, 2024
80c6f1a
Merge branch 'build-only-necessary' of github.com:vporton/sdk into bu…
vporton May 31, 2024
5731e86
removed an outdated TODO comment
vporton Jun 9, 2024
1e057d0
removed an outdated TODO comment
vporton Jun 9, 2024
78352ae
more logging
vporton Jun 9, 2024
bb51187
TODO comment
vporton Jun 9, 2024
7299111
bug fix
vporton Jun 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

# UNRELEASED

### feat: rebuild only necessary canisters

Cache `get_imports()` (renamed to `add_imports()`) results.

Read only those `--print-deps` dependencies that are necessary to read.

Don't compile canisters for which all dependencies are elder than the `.wasm` file.
This results in big compilation speedups.

### feat: specify canisters not to deploy

`"deploy": false` canister option makes it not to deploy, unless explicitly specified on the command line.

### chore: Improve help text of `dfx identity new` to include which characters are valid in identity names

# 0.20.2

### fix: `dfx canister delete` fails
Expand Down
2 changes: 2 additions & 0 deletions docs/cli-reference/dfx-build.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Note that you can only run this command from within the project directory struct

The `dfx build` command looks for the source code to compile using the information you have configured under the `canisters` section in the `dfx.json` configuration file.

For compilation speed reasons, `dfx build` (and `dfx deploy`) don't recompile canisters, all dependencies of which are elder than the existing Candid file (from the previous compilation). Moreover, the Candid (`.did`) file is updated only when strictly necessary (that is on public interface change). This makes dependent canisters not recompile when a dependency canister changes without interface change.

## Basic usage

``` bash
Expand Down
2 changes: 1 addition & 1 deletion docs/cli-reference/dfx-deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";

<MarkdownChipRow labels={["Reference"]}/>

Use the `dfx deploy` command to register, build, and deploy a dapp on the local canister execution environment, on the IC or on a specified testnet. By default, all canisters defined in the project `dfx.json` configuration file are deployed.
Use the `dfx deploy` command to register, build, and deploy a dapp on the local canister execution environment, on the IC or on a specified testnet. By default, all canisters defined in the project `dfx.json` configuration file are deployed, except of the canisters with `"deploy": false` option.

This command simplifies the developer workflow by enabling you to run one command instead of running the following commands as separate steps:

Expand Down
6 changes: 6 additions & 0 deletions docs/dfx-json-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@
"type": "string"
}
},
"deploy": {
"title": "Deploy",
"description": "`false` value means not to deploy this canister unless it's explicitly specified in the command line (supposed use: canister that are created by other canisters).",
"default": true,
"type": "boolean"
},
"frontend": {
"title": "Force Frontend URL",
"description": "Mostly unused. If this value is not null, a frontend URL is displayed after deployment even if the canister type is not 'asset'.",
Expand Down
5 changes: 5 additions & 0 deletions e2e/assets/add_dependency/a.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import _ "canister:b"

actor {
public shared func f() {};
}
3 changes: 3 additions & 0 deletions e2e/assets/add_dependency/b.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
actor {
public shared func g() {};
}
14 changes: 14 additions & 0 deletions e2e/assets/add_dependency/dfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"canisters": {
"a": {
"main": "a.mo",
"dependencies": ["c"]
},
"b": {
"main": "b.mo"
},
"c": {
"main": "b.mo"
}
}
}
11 changes: 11 additions & 0 deletions e2e/assets/add_dependency/dfx_corrected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"canisters": {
"a": {
"main": "a.mo",
"dependencies": ["b"]
},
"b": {
"main": "b.mo"
}
}
}
5 changes: 5 additions & 0 deletions e2e/assets/broken_canister_dep/a.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import _ "canister:b"

actor {
public shared func f() {};
}
8 changes: 8 additions & 0 deletions e2e/assets/broken_canister_dep/dfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"canisters": {
"a": {
"type": "motoko",
"main": "a.mo"
}
}
}
1 change: 1 addition & 0 deletions e2e/assets/make_like/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sources are put into src/ to check how it behaves with subdirectories.
19 changes: 19 additions & 0 deletions e2e/assets/make_like/dfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": 1,
"canisters": {
"dependency": {
"main": "src/dependency.mo"
},
"dependent": {
"main": "src/dependent.mo",
"dependencies": [
"dependency"
]
}
},
"networks": {
"local": {
"bind": "127.0.0.1:8000"
}
}
}
7 changes: 7 additions & 0 deletions e2e/assets/make_like/src/dependency.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import L "lib";

actor {
public shared func greet(name: Text) : async Text {
return "Hello, " # name # "!";
}
}
10 changes: 10 additions & 0 deletions e2e/assets/make_like/src/dependency_altered.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import L "lib";

actor {
public shared func greet(name: Text) : async Text {
return "Hello, " # name # "!";
};

public shared func anotherFunction() : async () {
};
}
8 changes: 8 additions & 0 deletions e2e/assets/make_like/src/dependent.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import L "lib";
import D "canister:dependency";

actor {
public shared func greet(name : Text) : async Text {
return "Hello, " # name # "!";
};
};
1 change: 1 addition & 0 deletions e2e/assets/make_like/src/lib.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module {}
8 changes: 8 additions & 0 deletions e2e/assets/wrong_ids/dfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"canisters": {
"pst": {
"main": "src/a.mo",
"type": "motoko"
}
}
}
1 change: 1 addition & 0 deletions e2e/assets/wrong_ids/src/a.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
actor A {};
28 changes: 28 additions & 0 deletions e2e/tests-dfx/add_dependency.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bats

load ../utils/_

setup() {
standard_setup

install_asset add_dependency
}

teardown() {
dfx_stop

standard_teardown
}

# Check that attempt to compile before correcting dependencies does not break further compilation.
@test "compiles after correcting a dependency" {
install_asset base

dfx_start

assert_command_fail dfx deploy

cp dfx_corrected.json dfx.json

assert_command dfx deploy
}
23 changes: 23 additions & 0 deletions e2e/tests-dfx/broken_canister_dep.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bats

load ../utils/_

setup() {
standard_setup

install_asset broken_canister_dep
}

teardown() {
dfx_stop

standard_teardown
}

@test "crash on a broken canister dependency" {
dfx_start

assert_command_fail dfx deploy

assert_not_contains "panicked at"
}
Loading
Loading