Skip to content

Commit

Permalink
feat: Make build, abi and util modules public (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghimire007 committed Jun 23, 2023
1 parent b3a245f commit 86ecc77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cargo-near/src/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::abi::{AbiCompression, AbiFormat, AbiResult};
use crate::cargo::{manifest::CargoManifestPath, metadata::CrateMetadata};
use crate::util::CompilationArtifact;
use crate::{abi, util, BuildCommand};
use colored::Colorize;
use near_abi::BuildInfo;
Expand All @@ -8,7 +9,7 @@ use std::io::BufRead;

const COMPILATION_TARGET: &str = "wasm32-unknown-unknown";

pub(crate) fn run(args: BuildCommand) -> anyhow::Result<()> {
pub fn run(args: BuildCommand) -> anyhow::Result<CompilationArtifact> {
args.color.apply();

util::handle_step("Checking the host environment...", || {
Expand Down Expand Up @@ -106,5 +107,5 @@ pub(crate) fn run(args: BuildCommand) -> anyhow::Result<()> {
eprintln!(" - {:>width$}: {}", header, message, width = max_width);
}

Ok(())
Ok(wasm_artifact)
}
8 changes: 4 additions & 4 deletions cargo-near/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::{env, str::FromStr};
use camino::Utf8PathBuf;
use clap::{AppSettings, Args, Parser, Subcommand};

mod abi;
mod build;
pub mod abi;
pub mod build;
mod cargo;
mod util;
pub mod util;

#[derive(Debug, Parser)]
#[clap(bin_name = "cargo", version, about)]
Expand Down Expand Up @@ -131,6 +131,6 @@ impl ColorPreference {
pub fn exec(cmd: NearCommand) -> anyhow::Result<()> {
match cmd {
NearCommand::Abi(args) => abi::run(args),
NearCommand::Build(args) => build::run(args),
NearCommand::Build(args) => build::run(args).map(|_| ()),
}
}

0 comments on commit 86ecc77

Please sign in to comment.