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
5 changes: 1 addition & 4 deletions crates/pop-cli/src/commands/build/contract.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
// SPDX-License-Identifier: GPL-3.0

use crate::cli;
use clap::Args;
use pop_contracts::{build_smart_contract, Verbosity};
use std::path::PathBuf;

#[derive(Args)]
/// Command to build a smart contract with configurable path and release mode.
pub struct BuildContractCommand {
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
/// Path for the contract project [default: current directory]
#[arg(long)]
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.
#[clap(short, long)]
pub(crate) release: bool,
}

Expand Down
12 changes: 3 additions & 9 deletions crates/pop-cli/src/commands/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@ pub(crate) struct BuildArgs {
/// Build profile [default: debug].
#[clap(long, value_enum)]
pub(crate) profile: Option<Profile>,
/// Parachain ID to be used when generating the chain spec files.
#[arg(short = 'i', long = "id")]
#[cfg(feature = "parachain")]
pub(crate) id: Option<u32>,
}

/// Build a parachain, smart contract or Rust package.
/// Build a parachain, smart contract, chain specification or Rust package.
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 Down Expand Up @@ -74,10 +70,9 @@ impl Command {
};
// All commands originating from root command are valid
BuildParachainCommand {
path: args.path,
path: args.path.unwrap_or_else(|| PathBuf::from("./")),
package: args.package,
profile: Some(profile),
id: args.id,
profile,
}
.execute()?;
return Ok("parachain");
Expand Down Expand Up @@ -150,7 +145,6 @@ mod tests {
package: package.clone(),
release,
profile: Some(profile.clone()),
id: None,
},
&mut cli,
)?,
Expand Down
28 changes: 9 additions & 19 deletions crates/pop-cli/src/commands/build/parachain.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
// SPDX-License-Identifier: GPL-3.0

use crate::{cli, style::style};
use clap::Args;
use pop_common::Profile;
use pop_parachains::build_parachain;
use std::path::PathBuf;
#[cfg(not(test))]
use std::{thread::sleep, time::Duration};

#[derive(Args)]
/// Command to build a parachain with configurable path, package, and profile.
pub struct BuildParachainCommand {
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
/// Directory path for your project [default: current directory].
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
#[arg(long)]
pub(crate) path: Option<PathBuf>,
pub(crate) path: PathBuf,
/// The package to be built.
#[arg(short, long)]
pub(crate) package: Option<String>,
/// Build profile [default: debug].
#[clap(long, value_enum)]
pub(crate) profile: Option<Profile>,
/// Parachain ID to be used when generating the chain spec files.
#[arg(short, long)]
pub(crate) id: Option<u32>,
/// Build profile.
pub(crate) profile: Profile,
}

impl BuildParachainCommand {
Expand All @@ -38,18 +31,16 @@ impl BuildParachainCommand {
let project = if self.package.is_some() { "package" } else { "parachain" };
cli.intro(format!("Building your {project}"))?;

let profile = self.profile.unwrap_or(Profile::Debug);
if profile == Profile::Debug {
if self.profile == Profile::Debug {
cli.warning("NOTE: this command now defaults to DEBUG builds. Please use `--release` (or simply `-r`) for a release build...")?;
#[cfg(not(test))]
sleep(Duration::from_secs(3))
}

// Build parachain.
cli.warning("NOTE: this may take some time...")?;
let project_path = self.path.unwrap_or_else(|| PathBuf::from("./"));
let binary = build_parachain(&project_path, self.package, &profile, None)?;
cli.info(format!("The {project} was built in {} mode.", profile))?;
let binary = build_parachain(&self.path, self.package, &self.profile, None)?;
cli.info(format!("The {project} was built in {} mode.", self.profile))?;
cli.outro("Build completed successfully!")?;
let generated_files = [format!("Binary generated at: {}", binary.display())];
let generated_files: Vec<_> = generated_files
Expand Down Expand Up @@ -120,10 +111,9 @@ mod tests {

assert_eq!(
BuildParachainCommand {
path: Some(project_path.clone()),
path: project_path.clone(),
package: package.clone(),
profile: Some(profile.clone()),
id: None,
profile: profile.clone(),
}
.build(&mut cli)?,
project
Expand Down