-
Notifications
You must be signed in to change notification settings - Fork 381
chore: implement basic workspace file functionality #1913
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
9 commits
Select commit
Hold shift + click to select a range
76f0384
add `workspace` field to `PackageManifest`
dc87c18
cringe imp
e0200db
fix fail
dd6d83a
remove `dbg!`
d231b6e
fix fail [2]
0a51919
add docs
d22bcab
split package and workspace
3510cce
fix panic
ec2682f
add workspace to ssa_refactor folder too
kevaundray 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,13 @@ | ||
| use std::path::Path; | ||
|
|
||
| use nargo::manifest::{InvalidPackageError, PackageManifest}; | ||
| use nargo::manifest::{InvalidPackageError, Manifest}; | ||
|
|
||
| /// Parses a Nargo.toml file from it's path | ||
| /// The path to the toml file must be present. | ||
| /// Calling this function without this guarantee is an ICE. | ||
| pub(crate) fn parse<P: AsRef<Path>>( | ||
| path_to_toml: P, | ||
| ) -> Result<PackageManifest, InvalidPackageError> { | ||
| pub(crate) fn parse<P: AsRef<Path>>(path_to_toml: P) -> Result<Manifest, InvalidPackageError> { | ||
| let toml_as_string = | ||
| std::fs::read_to_string(&path_to_toml).expect("ice: path given for toml file is invalid"); | ||
|
|
||
| PackageManifest::from_toml_str(&toml_as_string) | ||
| Manifest::from_toml_str(&toml_as_string) | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [workspace] | ||
| members = ["crates/a", "crates/b"] |
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,2 @@ | ||
| x = "1" | ||
| y = "0" |
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data/workspace/crates/a/Nargo.toml
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 @@ | ||
| [package] | ||
| authors = [""] | ||
| compiler_version = "0.8.0" | ||
|
|
||
| [dependencies] |
11 changes: 11 additions & 0 deletions
11
crates/nargo_cli/tests/test_data/workspace/crates/a/src/main.nr
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,11 @@ | ||
| fn main(x : Field, y : pub Field) { | ||
| assert(x != y); | ||
| } | ||
|
|
||
| #[test] | ||
| fn a() { | ||
| main(1, 2); | ||
|
|
||
| // Uncomment to make test fail | ||
| // main(1, 1); | ||
| } |
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data/workspace/crates/b/Nargo.toml
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 @@ | ||
| [package] | ||
| authors = [""] | ||
| compiler_version = "0.8.0" | ||
|
|
||
| [dependencies] |
11 changes: 11 additions & 0 deletions
11
crates/nargo_cli/tests/test_data/workspace/crates/b/src/main.nr
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,11 @@ | ||
| fn main(x : Field, y : pub Field) { | ||
| assert(x != y); | ||
| } | ||
|
|
||
| #[test] | ||
| fn b() { | ||
| main(1, 2); | ||
|
|
||
| // Uncomment to make test fail | ||
| // main(1, 1); | ||
| } |
2 changes: 2 additions & 0 deletions
2
crates/nargo_cli/tests/test_data_ssa_refactor/workspace/Nargo.toml
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,2 @@ | ||
| [workspace] | ||
| members = ["crates/a", "crates/b"] |
2 changes: 2 additions & 0 deletions
2
crates/nargo_cli/tests/test_data_ssa_refactor/workspace/Prover.toml
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,2 @@ | ||
| x = "1" | ||
| y = "0" |
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data_ssa_refactor/workspace/crates/a/Nargo.toml
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 @@ | ||
| [package] | ||
| authors = [""] | ||
| compiler_version = "0.8.0" | ||
|
|
||
| [dependencies] |
11 changes: 11 additions & 0 deletions
11
crates/nargo_cli/tests/test_data_ssa_refactor/workspace/crates/a/src/main.nr
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,11 @@ | ||
| fn main(x : Field, y : pub Field) { | ||
| assert(x != y); | ||
| } | ||
|
|
||
| #[test] | ||
| fn a() { | ||
| main(1, 2); | ||
|
|
||
| // Uncomment to make test fail | ||
| // main(1, 1); | ||
| } |
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data_ssa_refactor/workspace/crates/b/Nargo.toml
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 @@ | ||
| [package] | ||
| authors = [""] | ||
| compiler_version = "0.8.0" | ||
|
|
||
| [dependencies] |
11 changes: 11 additions & 0 deletions
11
crates/nargo_cli/tests/test_data_ssa_refactor/workspace/crates/b/src/main.nr
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,11 @@ | ||
| fn main(x : Field, y : pub Field) { | ||
| assert(x != y); | ||
| } | ||
|
|
||
| #[test] | ||
| fn b() { | ||
| main(1, 2); | ||
|
|
||
| // Uncomment to make test fail | ||
| // main(1, 1); | ||
| } |
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
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.