-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Support workspaces and package selection on every nargo command (
#1992) * feat!: Support workspaces and package selection on every nargo command * add package name to contract directory * print package name at the beginning of any stdout messages * Remove circuit_name from compile command and use package name * remove resolve_workspace_in_directory * avoid resolving dependencies as a Workspace struct by always requiring it to be a Package * chore: ensure workspace packages are distinct * Update crates/nargo_cli/src/git.rs * remove proof name argument and use package name, remove stdout printing of proof * fix tests * rename functions to be more descriptive * add issue number to todo --------- Co-authored-by: Tom French <tom@tomfren.ch> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
- Loading branch information
1 parent
3a42368
commit 940b189
Showing
55 changed files
with
1,004 additions
and
896 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
18 changes: 9 additions & 9 deletions
18
crates/nargo_cli/src/constants.rs → crates/nargo/src/constants.rs
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,23 +1,23 @@ | ||
// Directories | ||
/// The directory for the `nargo contract` command output | ||
pub(crate) const CONTRACT_DIR: &str = "contract"; | ||
pub const CONTRACT_DIR: &str = "contract"; | ||
/// The directory to store serialized circuit proofs. | ||
pub(crate) const PROOFS_DIR: &str = "proofs"; | ||
pub const PROOFS_DIR: &str = "proofs"; | ||
/// The directory to store Noir source files | ||
pub(crate) const SRC_DIR: &str = "src"; | ||
pub const SRC_DIR: &str = "src"; | ||
/// The directory to store circuits' serialized ACIR representations. | ||
pub(crate) const TARGET_DIR: &str = "target"; | ||
pub const TARGET_DIR: &str = "target"; | ||
|
||
// Files | ||
/// The file from which Nargo pulls prover inputs | ||
pub(crate) const PROVER_INPUT_FILE: &str = "Prover"; | ||
pub const PROVER_INPUT_FILE: &str = "Prover"; | ||
/// The file from which Nargo pulls verifier inputs | ||
pub(crate) const VERIFIER_INPUT_FILE: &str = "Verifier"; | ||
pub const VERIFIER_INPUT_FILE: &str = "Verifier"; | ||
/// The package definition file for a Noir project. | ||
pub(crate) const PKG_FILE: &str = "Nargo.toml"; | ||
pub const PKG_FILE: &str = "Nargo.toml"; | ||
|
||
// Extensions | ||
/// The extension for files containing circuit proofs. | ||
pub(crate) const PROOF_EXT: &str = "proof"; | ||
pub const PROOF_EXT: &str = "proof"; | ||
/// The extension for files containing proof witnesses. | ||
pub(crate) const WITNESS_EXT: &str = "tr"; | ||
pub const WITNESS_EXT: &str = "tr"; |
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 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::{collections::BTreeMap, path::PathBuf}; | ||
|
||
use noirc_frontend::graph::{CrateName, CrateType}; | ||
|
||
use crate::constants::{PROVER_INPUT_FILE, VERIFIER_INPUT_FILE}; | ||
|
||
#[derive(Clone)] | ||
pub enum Dependency { | ||
Local { package: Package }, | ||
Remote { package: Package }, | ||
} | ||
|
||
#[derive(Clone)] | ||
pub struct Package { | ||
pub root_dir: PathBuf, | ||
pub crate_type: CrateType, | ||
pub entry_path: PathBuf, | ||
pub name: CrateName, | ||
pub dependencies: BTreeMap<CrateName, Dependency>, | ||
} | ||
|
||
impl Package { | ||
pub fn prover_input_path(&self) -> PathBuf { | ||
// TODO: This should be configurable, such as if we are looking for .json or .toml or custom paths | ||
// For now it is hard-coded to be toml. | ||
self.root_dir.join(format!("{PROVER_INPUT_FILE}.toml")) | ||
} | ||
pub fn verifier_input_path(&self) -> PathBuf { | ||
// TODO: This should be configurable, such as if we are looking for .json or .toml or custom paths | ||
// For now it is hard-coded to be toml. | ||
self.root_dir.join(format!("{VERIFIER_INPUT_FILE}.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
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
Oops, something went wrong.