Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions crates/lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use lsp_types::{
PublishDiagnosticsParams, Range, ServerCapabilities, TextDocumentSyncOptions,
};
use nargo::prepare_package;
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_driver::check_crate;
use noirc_errors::{DiagnosticKind, FileDiagnostic};
use noirc_frontend::hir::FunctionNameMatch;
Expand Down Expand Up @@ -156,7 +156,7 @@ fn on_code_lens_request(
return future::ready(Ok(None));
}
};
let workspace = match resolve_workspace_from_toml(&toml_path, None) {
let workspace = match resolve_workspace_from_toml(&toml_path, PackageSelection::All) {
Ok(workspace) => workspace,
Err(err) => {
// If we found a manifest, but the workspace is invalid, we raise an error about it
Expand Down Expand Up @@ -281,7 +281,7 @@ fn on_did_save_text_document(
return ControlFlow::Continue(());
}
};
let workspace = match resolve_workspace_from_toml(&toml_path, None) {
let workspace = match resolve_workspace_from_toml(&toml_path, PackageSelection::All) {
Ok(workspace) => workspace,
Err(err) => {
// If we found a manifest, but the workspace is invalid, we raise an error about it
Expand Down
13 changes: 10 additions & 3 deletions crates/nargo_cli/src/cli/check_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use acvm::Backend;
use clap::Args;
use iter_extended::btree_map;
use nargo::{package::Package, prepare_package};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_abi::{AbiParameter, AbiType, MAIN_RETURN_NAME};
use noirc_driver::{check_crate, compute_function_signature, CompileOptions};
use noirc_frontend::{
Expand All @@ -18,9 +18,13 @@ use super::NargoConfig;
#[derive(Debug, Clone, Args)]
pub(crate) struct CheckCommand {
/// The name of the package to check
#[clap(long)]
#[clap(long, conflicts_with = "workspace")]
package: Option<CrateName>,

/// Check all packages in the workspace
#[clap(long, conflicts_with = "package")]
workspace: bool,

#[clap(flatten)]
compile_options: CompileOptions,
}
Expand All @@ -31,7 +35,10 @@ pub(crate) fn run<B: Backend>(
config: NargoConfig,
) -> Result<(), CliError<B>> {
let toml_path = find_package_manifest(&config.program_dir)?;
let workspace = resolve_workspace_from_toml(&toml_path, args.package)?;
let default_selection =
if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll };
let selection = args.package.map_or(default_selection, PackageSelection::Selected);
let workspace = resolve_workspace_from_toml(&toml_path, selection)?;

for package in &workspace {
check_package(package, &args.compile_options)?;
Expand Down
13 changes: 10 additions & 3 deletions crates/nargo_cli/src/cli/codegen_verifier_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@ use nargo::{
ops::{codegen_verifier, preprocess_program},
package::Package,
};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_driver::CompileOptions;
use noirc_frontend::graph::CrateName;

/// Generates a Solidity verifier smart contract for the program
#[derive(Debug, Clone, Args)]
pub(crate) struct CodegenVerifierCommand {
/// The name of the package to codegen
#[clap(long)]
#[clap(long, conflicts_with = "workspace")]
package: Option<CrateName>,

/// Codegen all packages in the workspace
#[clap(long, conflicts_with = "package")]
workspace: bool,

#[clap(flatten)]
compile_options: CompileOptions,
}
Expand All @@ -41,7 +45,10 @@ pub(crate) fn run<B: Backend>(
config: NargoConfig,
) -> Result<(), CliError<B>> {
let toml_path = find_package_manifest(&config.program_dir)?;
let workspace = resolve_workspace_from_toml(&toml_path, args.package)?;
let default_selection =
if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll };
let selection = args.package.map_or(default_selection, PackageSelection::Selected);
let workspace = resolve_workspace_from_toml(&toml_path, selection)?;

for package in &workspace {
let circuit_build_path = workspace.package_build_path(package);
Expand Down
13 changes: 10 additions & 3 deletions crates/nargo_cli/src/cli/compile_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use nargo::artifacts::debug::DebugArtifact;
use nargo::package::Package;
use nargo::prepare_package;
use nargo::{artifacts::contract::PreprocessedContract, NargoError};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_driver::{
compile_contracts, compile_main, CompileOptions, CompiledContract, CompiledProgram,
ErrorsAndWarnings, Warnings,
Expand Down Expand Up @@ -46,9 +46,13 @@ pub(crate) struct CompileCommand {
output_debug: bool,

/// The name of the package to compile
#[clap(long)]
#[clap(long, conflicts_with = "workspace")]
package: Option<CrateName>,

/// Compile all packages in the workspace
#[clap(long, conflicts_with = "package")]
workspace: bool,

#[clap(flatten)]
compile_options: CompileOptions,
}
Expand All @@ -59,7 +63,10 @@ pub(crate) fn run<B: Backend>(
config: NargoConfig,
) -> Result<(), CliError<B>> {
let toml_path = find_package_manifest(&config.program_dir)?;
let workspace = resolve_workspace_from_toml(&toml_path, args.package)?;
let default_selection =
if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll };
let selection = args.package.map_or(default_selection, PackageSelection::Selected);
let workspace = resolve_workspace_from_toml(&toml_path, selection)?;
let circuit_dir = workspace.target_directory_path();

let mut common_reference_string = read_cached_common_reference_string();
Expand Down
13 changes: 10 additions & 3 deletions crates/nargo_cli/src/cli/execute_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use clap::Args;
use nargo::constants::PROVER_INPUT_FILE;
use nargo::package::Package;
use nargo::NargoError;
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_abi::input_parser::{Format, InputValue};
use noirc_abi::{Abi, InputMap};
use noirc_driver::{CompileOptions, CompiledProgram};
Expand All @@ -29,9 +29,13 @@ pub(crate) struct ExecuteCommand {
prover_name: String,

/// The name of the package to execute
#[clap(long)]
#[clap(long, conflicts_with = "workspace")]
package: Option<CrateName>,

/// Execute all packages in the workspace
#[clap(long, conflicts_with = "package")]
workspace: bool,

#[clap(flatten)]
compile_options: CompileOptions,
}
Expand All @@ -42,7 +46,10 @@ pub(crate) fn run<B: Backend>(
config: NargoConfig,
) -> Result<(), CliError<B>> {
let toml_path = find_package_manifest(&config.program_dir)?;
let workspace = resolve_workspace_from_toml(&toml_path, args.package)?;
let default_selection =
if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll };
let selection = args.package.map_or(default_selection, PackageSelection::Selected);
let workspace = resolve_workspace_from_toml(&toml_path, selection)?;
let witness_dir = &workspace.target_directory_path();

for package in &workspace {
Expand Down
13 changes: 10 additions & 3 deletions crates/nargo_cli/src/cli/info_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use acvm::Backend;
use clap::Args;
use iter_extended::try_vecmap;
use nargo::{package::Package, prepare_package};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_driver::{compile_contracts, CompileOptions};
use noirc_frontend::graph::CrateName;
use prettytable::{row, Table};
Expand All @@ -22,9 +22,13 @@ use super::{
#[derive(Debug, Clone, Args)]
pub(crate) struct InfoCommand {
/// The name of the package to detail
#[clap(long)]
#[clap(long, conflicts_with = "workspace")]
package: Option<CrateName>,

/// Detail all packages in the workspace
#[clap(long, conflicts_with = "package")]
workspace: bool,

#[clap(flatten)]
compile_options: CompileOptions,
}
Expand All @@ -35,7 +39,10 @@ pub(crate) fn run<B: Backend>(
config: NargoConfig,
) -> Result<(), CliError<B>> {
let toml_path = find_package_manifest(&config.program_dir)?;
let workspace = resolve_workspace_from_toml(&toml_path, args.package)?;
let default_selection =
if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll };
let selection = args.package.map_or(default_selection, PackageSelection::Selected);
let workspace = resolve_workspace_from_toml(&toml_path, selection)?;

let mut package_table = Table::new();
package_table.add_row(
Expand Down
13 changes: 10 additions & 3 deletions crates/nargo_cli/src/cli/prove_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use nargo::artifacts::program::PreprocessedProgram;
use nargo::constants::{PROVER_INPUT_FILE, VERIFIER_INPUT_FILE};
use nargo::ops::{preprocess_program, prove_execution, verify_proof};
use nargo::package::Package;
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_abi::input_parser::Format;
use noirc_driver::CompileOptions;
use noirc_frontend::graph::CrateName;
Expand Down Expand Up @@ -40,9 +40,13 @@ pub(crate) struct ProveCommand {
verify: bool,

/// The name of the package to prove
#[clap(long)]
#[clap(long, conflicts_with = "workspace")]
package: Option<CrateName>,

/// Prove all packages in the workspace
#[clap(long, conflicts_with = "package")]
workspace: bool,

#[clap(flatten)]
compile_options: CompileOptions,
}
Expand All @@ -53,7 +57,10 @@ pub(crate) fn run<B: Backend>(
config: NargoConfig,
) -> Result<(), CliError<B>> {
let toml_path = find_package_manifest(&config.program_dir)?;
let workspace = resolve_workspace_from_toml(&toml_path, args.package)?;
let default_selection =
if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll };
let selection = args.package.map_or(default_selection, PackageSelection::Selected);
let workspace = resolve_workspace_from_toml(&toml_path, selection)?;
let proof_dir = workspace.proofs_directory_path();

for package in &workspace {
Expand Down
13 changes: 10 additions & 3 deletions crates/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::io::Write;
use acvm::{acir::native_types::WitnessMap, Backend};
use clap::Args;
use nargo::{ops::execute_circuit, package::Package, prepare_package};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_driver::{compile_no_check, CompileOptions};
use noirc_frontend::{
graph::CrateName,
Expand Down Expand Up @@ -31,9 +31,13 @@ pub(crate) struct TestCommand {
exact: bool,

/// The name of the package to test
#[clap(long)]
#[clap(long, conflicts_with = "workspace")]
package: Option<CrateName>,

/// Test all packages in the workspace
#[clap(long, conflicts_with = "package")]
workspace: bool,

#[clap(flatten)]
compile_options: CompileOptions,
}
Expand All @@ -44,7 +48,10 @@ pub(crate) fn run<B: Backend>(
config: NargoConfig,
) -> Result<(), CliError<B>> {
let toml_path = find_package_manifest(&config.program_dir)?;
let workspace = resolve_workspace_from_toml(&toml_path, args.package)?;
let default_selection =
if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll };
let selection = args.package.map_or(default_selection, PackageSelection::Selected);
let workspace = resolve_workspace_from_toml(&toml_path, selection)?;

let pattern = match &args.test_name {
Some(name) => {
Expand Down
13 changes: 10 additions & 3 deletions crates/nargo_cli/src/cli/verify_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use clap::Args;
use nargo::constants::{PROOF_EXT, VERIFIER_INPUT_FILE};
use nargo::ops::{preprocess_program, verify_proof};
use nargo::{artifacts::program::PreprocessedProgram, package::Package};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_abi::input_parser::Format;
use noirc_driver::CompileOptions;
use noirc_frontend::graph::CrateName;
Expand All @@ -32,9 +32,13 @@ pub(crate) struct VerifyCommand {
verifier_name: String,

/// The name of the package verify
#[clap(long)]
#[clap(long, conflicts_with = "workspace")]
package: Option<CrateName>,

/// Verify all packages in the workspace
#[clap(long, conflicts_with = "package")]
workspace: bool,

#[clap(flatten)]
compile_options: CompileOptions,
}
Expand All @@ -45,7 +49,10 @@ pub(crate) fn run<B: Backend>(
config: NargoConfig,
) -> Result<(), CliError<B>> {
let toml_path = find_package_manifest(&config.program_dir)?;
let workspace = resolve_workspace_from_toml(&toml_path, args.package)?;
let default_selection =
if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll };
let selection = args.package.map_or(default_selection, PackageSelection::Selected);
let workspace = resolve_workspace_from_toml(&toml_path, selection)?;
let proofs_dir = workspace.proofs_directory_path();

for package in &workspace {
Expand Down
Loading