-
Notifications
You must be signed in to change notification settings - Fork 98
feat: build granularity #974
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 all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ed07098
Initial changes
41ee453
update test
d525d5b
add e2e/bats/build-granular.bash
91f7d4c
remove --skip-frontend
54ca271
fmt clippy and other misc
977d4b9
Merge branch 'master' into pshahi/build-granularity
p-shahi c3ea617
build transitive deps and some cleanup
d748f4a
Merge branch 'pshahi/build-granularity' of github.com:dfinity-lab/sdk…
08f2829
Merge branch 'master' of github.com:dfinity-lab/sdk into pshahi/build…
ceea151
warn on cyclic dep and prevent stack overflow on recursion
e17511d
remove --all requirement
ee5fdc0
Merge branch 'master' into pshahi/build-granularity
p-shahi 4f4fcc4
add back --all this time with conflicts_with
745aa97
Merge branch 'pshahi/build-granularity' of github.com:dfinity-lab/sdk…
f5dcb8c
Merge branch 'master' into pshahi/build-granularity
p-shahi 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 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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Namaste, " # name # "!"; | ||
| }; | ||
| }; |
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Hola, " # name # "!"; | ||
| }; | ||
| }; |
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Hello, " # name # "!"; | ||
| }; | ||
| }; |
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Hello, " # name # "!"; | ||
| }; | ||
| }; |
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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| { | ||
| "canisters": { | ||
| "canister_a": { | ||
| "main": "./a/main.mo", | ||
| "type": "motoko" | ||
| }, | ||
| "canister_b": { | ||
| "dependencies": ["canister_a"], | ||
| "main": "./b/main.mo", | ||
| "type": "motoko" | ||
| }, | ||
| "canister_c": { | ||
| "dependencies": ["canister_b"], | ||
| "main": "./c/main.mo", | ||
| "type": "motoko" | ||
| }, | ||
| "canister_d": { | ||
| "dependencies": ["canister_e"], | ||
| "main": "./d/main.mo", | ||
| "type": "motoko" | ||
| }, | ||
| "canister_e": { | ||
| "dependencies": ["canister_d"], | ||
| "main": "./e/main.mo", | ||
| "type": "motoko" | ||
| } | ||
| }, | ||
| "defaults": { | ||
| "build": { | ||
| "packtool": "" | ||
| } | ||
| }, | ||
| "networks": { | ||
| "local": { | ||
| "bind": "127.0.0.1:8000" | ||
| } | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Hello, " # name # "!"; | ||
| }; | ||
| }; |
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Do nothing |
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 |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| load utils/_ | ||
|
|
||
| setup() { | ||
| # We want to work from a temporary directory, different for every test. | ||
| cd $(mktemp -d -t dfx-e2e-XXXXXXXX) | ||
|
|
||
| dfx_new | ||
| } | ||
|
|
||
| teardown() { | ||
| dfx_stop | ||
| } | ||
|
|
||
| @test "direct dependencies are built" { | ||
| dfx_start | ||
| dfx canister create --all | ||
| #specify build for only assets_canister | ||
| dfx build e2e_project_assets | ||
|
|
||
| #validate direct dependency built and is callable | ||
| assert_command dfx canister install e2e_project | ||
| assert_command dfx canister call e2e_project greet World | ||
| } | ||
|
|
||
| @test "transitive dependencies are built" { | ||
| install_asset transitive_deps_canisters | ||
| dfx_start | ||
| dfx canister create --all | ||
| #install of tertiary dependency canister will fail since its not built | ||
| assert_command_fail dfx canister install canister_a | ||
| #specify build for primary canister | ||
| dfx build canister_c | ||
|
|
||
| #validate tertiary transitive dependency is built and callable | ||
| assert_command dfx canister install canister_a | ||
| assert_command dfx canister call canister_a greet World | ||
| assert_match '("Namaste, World!")' | ||
| } | ||
|
|
||
| @test "unspecified dependencies are not built" { | ||
| dfx_start | ||
| dfx canister create --all | ||
| # only build motoko canister | ||
| dfx build e2e_project | ||
| # validate assets canister wasn't built and can't be installed | ||
| assert_command_fail dfx canister install e2e_project_assets | ||
| assert_match "No such file or directory" | ||
| } | ||
|
|
||
|
|
||
| @test "manual build of specified canisters succeeds" { | ||
| install_asset assetscanister | ||
|
|
||
| dfx_start | ||
| dfx canister create e2e_project | ||
| dfx build e2e_project | ||
| assert_command dfx canister install e2e_project | ||
| assert_command dfx canister call e2e_project greet World | ||
|
|
||
| assert_command_fail dfx canister install e2e_project_assets | ||
| assert_match "Cannot find canister id. Please issue 'dfx canister create e2e_project_assets'." | ||
| dfx canister create e2e_project_assets | ||
| dfx build e2e_project_assets | ||
| dfx canister install e2e_project_assets | ||
|
|
||
| assert_command dfx canister call --query e2e_project_assets retrieve '("binary/noise.txt")' | ||
| assert_eq '(vec { 184; 1; 32; 128; 10; 119; 49; 50; 32; 0; 120; 121; 10; 75; 76; 11; 10; 106; 107; })' | ||
|
|
||
| assert_command dfx canister call --query e2e_project_assets retrieve '("text-with-newlines.txt")' | ||
| assert_eq '(vec { 99; 104; 101; 114; 114; 105; 101; 115; 10; 105; 116; 39; 115; 32; 99; 104; 101; 114; 114; 121; 32; 115; 101; 97; 115; 111; 110; 10; 67; 72; 69; 82; 82; 73; 69; 83; })' | ||
|
|
||
| } | ||
|
|
||
| @test "cyclic dependencies are detected" { | ||
| install_asset transitive_deps_canisters | ||
| dfx_start | ||
| dfx canister create --all | ||
| assert_command dfx build canister_e | ||
| assert_match "Possible circular dependency detected during evaluation of canister_d's dependency on canister_e." | ||
| } | ||
|
|
||
| @test "the all flag builds everything" { | ||
| dfx_start | ||
| dfx canister create --all | ||
| assert_command dfx build --all | ||
| assert_command dfx canister install --all | ||
| } | ||
|
|
||
|
|
||
| @test "the all flags conflicts with canister name" { | ||
| dfx_start | ||
| dfx canister create --all | ||
| assert_command_fail dfx build e2e_project --all | ||
| } |
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 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 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
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.
Uh oh!
There was an error while loading. Please reload this page.