Skip to content

Commit 232139e

Browse files
committed
feat:add command to main and format
1 parent 47a9a20 commit 232139e

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

bin/pcl/src/main.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ use pcl_core::{
1414
ConfigArgs,
1515
},
1616
};
17-
use pcl_phoundry::phorge_test::PhorgeTest;
17+
use pcl_phoundry::{
18+
build::BuildArgs,
19+
phorge_test::PhorgeTest,
20+
};
1821
use serde_json::json;
1922

2023
const VERSION_MESSAGE: &str = concat!(
@@ -50,6 +53,8 @@ enum Commands {
5053
Auth(AuthCommand),
5154
#[command(about = "Manage configuration")]
5255
Config(ConfigArgs),
56+
#[command(name = "build")]
57+
Build(BuildArgs),
5358
}
5459

5560
#[tokio::main]
@@ -85,6 +90,9 @@ async fn main() -> Result<()> {
8590
Commands::Config(config_cmd) => {
8691
config_cmd.run(&mut config)?;
8792
}
93+
Commands::Build(build_cmd) => {
94+
build_cmd.run()?;
95+
}
8896
};
8997
config.write_to_file(&cli.args)?;
9098
Ok::<_, Report>(())

crates/phoundry/src/build_and_flatten.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,16 @@ impl BuildAndFlattenArgs {
135135

136136
/// Builds the project and returns the compilation output.
137137
fn build(&self) -> Result<ProjectCompileOutput, Box<PhoundryError>> {
138-
let build_opts =
139-
BuildOpts {
140-
project_paths: ProjectPathOpts {
141-
root: self.root.clone(),
142-
// FIXME(Odysseas): this essentially hard-codes the location of the assertions to live in
143-
// assertions/src
144-
contracts: Some(PathBuf::from("assertions/src")),
145-
..Default::default()
146-
},
138+
let build_opts = BuildOpts {
139+
project_paths: ProjectPathOpts {
140+
root: self.root.clone(),
141+
// FIXME(Odysseas): this essentially hard-codes the location of the assertions to live in
142+
// assertions/src
143+
contracts: Some(PathBuf::from("assertions/src")),
147144
..Default::default()
148-
};
145+
},
146+
..Default::default()
147+
};
149148

150149
crate::compile::compile(build_opts)
151150
}

crates/phoundry/src/compile.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ use crate::error::PhoundryError;
88

99
/// Compiles the project and returns the compilation output.
1010
pub fn compile(build_opts: BuildOpts) -> Result<ProjectCompileOutput, Box<PhoundryError>> {
11-
let build_cmd = BuildArgs { build: build_opts, ..Default::default() };
11+
let build_cmd = BuildArgs {
12+
build: build_opts,
13+
..Default::default()
14+
};
1215

1316
let config = build_cmd.load_config()?;
1417

crates/phoundry/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub mod build;
22
pub mod build_and_flatten;
3+
pub mod compile;
34
pub mod error;
45
pub mod phorge_test;
5-
pub mod compile;

0 commit comments

Comments
 (0)