Skip to content
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

chore: release v0.6.0 #394

Merged
merged 11 commits into from
Dec 19, 2024
13 changes: 6 additions & 7 deletions crates/pop-cli/src/commands/build/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ use crate::cli;
use pop_contracts::{build_smart_contract, Verbosity};
use std::path::PathBuf;

/// Command to build a smart contract with configurable path and release mode.
pub struct BuildContractCommand {
/// Path for the contract project [default: current directory]
/// Represents the configuration for building a smart contract.
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
pub struct BuildContract {
/// Path for the contract project.
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
pub(crate) path: Option<PathBuf>,
/// The default compilation includes debug functionality, increasing contract size and gas
/// usage. For production, always build in release mode to exclude debug features.
/// Build profile: `true` for release mode, `false` for debug mode.
pub(crate) release: bool,
}

impl BuildContractCommand {
impl BuildContract {
/// Executes the command.
pub(crate) fn execute(self) -> anyhow::Result<&'static str> {
self.build(&mut cli::Cli)
Expand Down Expand Up @@ -55,7 +54,7 @@ mod tests {
.expect_outro("Build completed successfully!");

assert_eq!(
BuildContractCommand { path: Some(path.join(name)), release }.build(&mut cli)?,
BuildContract { path: Some(path.join(name)), release }.build(&mut cli)?,
"contract"
);

Expand Down
14 changes: 7 additions & 7 deletions crates/pop-cli/src/commands/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
use crate::cli::{self, Cli};
use clap::{Args, Subcommand};
#[cfg(feature = "contract")]
use contract::BuildContractCommand;
use contract::BuildContract;
use duct::cmd;
use pop_common::Profile;
use std::path::PathBuf;
#[cfg(feature = "parachain")]
use {parachain::BuildParachainCommand, spec::BuildSpecCommand};
use {parachain::BuildParachain, spec::BuildSpecCommand};

#[cfg(feature = "contract")]
pub(crate) mod contract;
Expand Down Expand Up @@ -37,7 +37,7 @@ pub(crate) struct BuildArgs {
pub(crate) profile: Option<Profile>,
}

/// Build a parachain, smart contract, chain specification or Rust package.
/// Build a chain specification and its genesis artifacts.
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
#[derive(Subcommand)]
pub(crate) enum Command {
/// Build a chain specification and its genesis artifacts.
Expand All @@ -52,12 +52,12 @@ impl Command {
// If only contract feature enabled, build as contract
#[cfg(feature = "contract")]
if pop_contracts::is_supported(args.path.as_deref())? {
// All commands originating from root command are valid
// All arguments originating from root command are valid
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
let release = match args.profile {
Some(profile) => profile.into(),
None => args.release,
};
BuildContractCommand { path: args.path, release }.execute()?;
BuildContract { path: args.path, release }.execute()?;
return Ok("contract");
}

Expand All @@ -68,8 +68,8 @@ impl Command {
Some(profile) => profile,
None => args.release.into(),
};
// All commands originating from root command are valid
BuildParachainCommand {
// All arguments originating from root command are valid.
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
BuildParachain {
path: args.path.unwrap_or_else(|| PathBuf::from("./")),
package: args.package,
profile,
Expand Down
12 changes: 6 additions & 6 deletions crates/pop-cli/src/commands/build/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ use std::path::PathBuf;
#[cfg(not(test))]
use std::{thread::sleep, time::Duration};

/// Command to build a parachain with configurable path, package, and profile.
pub struct BuildParachainCommand {
/// Directory path for your project [default: current directory].
// Represents the configuration for building a parachain.
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
pub struct BuildParachain {
/// Directory path for your project.
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
pub(crate) path: PathBuf,
/// The package to be built.
pub(crate) package: Option<String>,
/// Build profile.
pub(crate) profile: Profile,
}

impl BuildParachainCommand {
/// Executes the command.
impl BuildParachain {
/// Executes the build process.
pub(crate) fn execute(self) -> anyhow::Result<&'static str> {
self.build(&mut cli::Cli)
}
Expand Down Expand Up @@ -110,7 +110,7 @@ mod tests {
}

assert_eq!(
BuildParachainCommand {
BuildParachain {
path: project_path.clone(),
package: package.clone(),
profile: profile.clone(),
Expand Down
Loading