-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: implement basic workspace file functionality (#1913)
* add `workspace` field to `PackageManifest` * cringe imp * fix fail * remove `dbg!` * fix fail [2] * add docs * split package and workspace * fix panic * add workspace to ssa_refactor folder too --------- Co-authored-by: kevaundray <[email protected]>
- Loading branch information
1 parent
2b4237d
commit 4969da7
Showing
21 changed files
with
193 additions
and
21 deletions.
There are no files selected for viewing
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 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 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,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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[workspace] | ||
members = ["crates/a", "crates/b"] |
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 |
---|---|---|
@@ -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 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 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 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 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 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 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 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 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 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 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 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 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