supporting changes for deploy

This commit is contained in:
evan-schott 2024-01-05 14:19:38 -08:00
parent 1cbb16936b
commit 0b5bd5793b
6 changed files with 61 additions and 17 deletions

View File

@ -147,6 +147,9 @@ version = "1.0"
[dependencies.serial_test]
version = "3.0.0"
[dependencies.snarkos-cli]
version = "2.2.4"
[dependencies.snarkvm]
workspace = true
features = [ "circuit", "console" ]

View File

@ -178,4 +178,11 @@ create_messages!(
msg: format!("Failed to write file.\nIO Error: {error}"),
help: None,
}
@backtraced
failed_to_read_environment_private_key {
args: (error: impl Display),
msg: format!("Failed to read private key from environment.\nIO Error: {error}"),
help: Some("Pass in private key using `--private-key <PRIVATE-KEY>` or create a .env file with your private key information. See examples for formatting information.".to_string()),
}
);

View File

@ -348,4 +348,19 @@ create_messages!(
msg: format!("Failed to update `program.json` from the provided file path {path} - {error}"),
help: None,
}
@backtraced
failed_to_deserialize_lock_file {
args: (error: impl ErrorArg),
msg: format!("Failed to deserialize `leo.lock` - {error}"),
help: None,
}
@backtraced
invalid_lock_file_formatting {
args: (),
msg: "Invalid `leo.lock` formatting.".to_string(),
help: Some("Delete the lock file and rebuild the project".to_string()),
}
);

View File

@ -43,11 +43,6 @@ pub struct CLI {
///Leo compiler and package manager
#[derive(Parser, Debug)]
enum Commands {
#[clap(about = "Add a new dependency to the current package. Defaults to testnet3 network")]
Add {
#[clap(flatten)]
command: Add,
},
#[clap(about = "Create a new Aleo account")]
Account {
#[clap(subcommand)]
@ -63,16 +58,6 @@ enum Commands {
#[clap(subcommand)]
command: Example,
},
#[clap(about = "Compile the current package as a program")]
Build {
#[clap(flatten)]
command: Build,
},
#[clap(about = "Clean the output directory")]
Clean {
#[clap(flatten)]
command: Clean,
},
#[clap(about = "Run a program with input variables")]
Run {
#[clap(flatten)]
@ -83,6 +68,26 @@ enum Commands {
#[clap(flatten)]
command: Execute,
},
#[clap(about = "Deploy a program")]
Deploy {
#[clap(flatten)]
command: Deploy,
},
#[clap(about = "Add a new dependency to the current package. Defaults to testnet3 network")]
Add {
#[clap(flatten)]
command: Add,
},
#[clap(about = "Compile the current package as a program")]
Build {
#[clap(flatten)]
command: Build,
},
#[clap(about = "Clean the output directory")]
Clean {
#[clap(flatten)]
command: Clean,
},
#[clap(about = "Update the Leo CLI")]
Update {
#[clap(flatten)]
@ -135,6 +140,7 @@ pub fn run_with_args(cli: CLI) -> Result<()> {
command.try_execute(context)
}
Commands::Clean { command } => command.try_execute(context),
Commands::Deploy { command } => command.try_execute(context),
Commands::Example { command } => command.try_execute(context),
Commands::Run { command } => command.try_execute(context),
Commands::Execute { command } => command.try_execute(context),

View File

@ -25,6 +25,9 @@ default-features = false
[dependencies.snarkvm]
workspace = true
[dependencies.snarkos-cli]
version = "2.2.4"
[dependencies.leo-errors]
path = "../../errors"
version = "=1.10.0"

View File

@ -28,13 +28,23 @@ pub struct LockFileEntry {
dependencies: Vec<String>,
}
impl LockFileEntry {
pub fn path(&self) -> Option<&PathBuf> {
self.path.as_ref()
}
pub fn name(&self) -> &str {
&self.name
}
}
impl From<&ProgramContext> for LockFileEntry {
fn from(context: &ProgramContext) -> Self {
LockFileEntry {
name: context.name().to_string(),
name: context.full_name().to_string(),
network: context.network.clone(), // Direct access as per instruction
location: context.location().clone(),
path: context.path.clone(), // Direct access as per instruction
path: context.full_path.clone(), // Direct access as per instruction
checksum: context.checksum().to_string(),
dependencies: context.dependencies().iter().map(|dep| format!("{}.aleo", dep)).collect(),
}