cli/commands/build/
mod.rs1pub mod android;
2pub mod apple;
3mod build_context;
4
5pub use build_context::*;
6
7use android::AndroidBuildCommand;
8use apple::AppleBuildCommand;
9
10use crate::error::Result;
11use clap::Clap;
12use creator_tools::{types::Profile, utils::Config};
13use std::path::PathBuf;
14
15#[derive(Clap, Clone, Debug)]
16pub enum BuildCommand {
17 Android(AndroidBuildCommand),
19 Apple(AppleBuildCommand),
21}
22
23impl BuildCommand {
24 pub fn handle_command(&self, config: &Config) -> Result<()> {
25 match &self {
26 Self::Android(cmd) => cmd.run(config),
27 Self::Apple(cmd) => cmd.run(config),
28 }
29 }
30}
31
32#[derive(Clap, Clone, Debug)]
33pub struct SharedBuildCommand {
34 #[clap(long)]
36 pub example: Option<String>,
37 #[clap(long)]
41 pub features: Vec<String>,
42 #[clap(long)]
44 pub all_features: bool,
45 #[clap(long)]
47 pub no_default_features: bool,
48 #[clap(long)]
50 pub release: bool,
51 #[clap(long)]
53 pub target_dir: Option<PathBuf>,
54}
55
56impl SharedBuildCommand {
57 pub fn profile(&self) -> Profile {
58 match self.release {
59 true => Profile::Release,
60 false => Profile::Debug,
61 }
62 }
63}