1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use super::reroot_path;
use clap::*;
use move_package::{Architecture, BuildConfig};
use std::path::PathBuf;
#[derive(Parser)]
#[clap(name = "build")]
pub struct Build;
impl Build {
pub fn execute(self, path: Option<PathBuf>, config: BuildConfig) -> anyhow::Result<()> {
let rerooted_path = reroot_path(path)?;
let architecture = config.architecture.unwrap_or(Architecture::Move);
match architecture {
Architecture::Move | Architecture::AsyncMove => {
config.compile_package(&rerooted_path, &mut std::io::stderr())?;
}
Architecture::Ethereum => {
#[cfg(feature = "evm-backend")]
config.compile_package_evm(&rerooted_path, &mut std::io::stderr())?;
#[cfg(not(feature = "evm-backend"))]
anyhow::bail!("The Ethereum architecture is not supported because move-cli was not compiled with feature flag `evm-backend`.");
}
}
Ok(())
}
}