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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Build command arguments
use clap::{Args, Subcommand, ValueEnum};
/// Build subcommands
#[derive(Subcommand, Debug)]
pub enum BuildCommand {
/// Build robot nodes (runs on the robot hardware)
Robot(BuildTargetArgs),
/// Build remote nodes (runs in the cloud/remote server)
Remote(BuildTargetArgs),
}
/// Version bump type
#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum VersionBump {
/// Bump patch version (0.1.0 -> 0.1.1)
Patch,
/// Bump minor version (0.1.0 -> 0.2.0)
Minor,
/// Bump major version (0.1.0 -> 1.0.0)
Major,
}
/// Target architecture for Docker builds
#[derive(Debug, Clone, Copy, ValueEnum, Default)]
pub enum TargetArch {
/// x86_64 (amd64) - Desktop, servers
#[default]
X86_64,
/// aarch64 (arm64) - Raspberry Pi 4/5, Jetson, Apple Silicon
Aarch64,
}
impl TargetArch {
/// Get the Docker platform for this architecture
pub fn docker_platform(&self) -> &'static str {
match self {
TargetArch::X86_64 => "linux/amd64",
TargetArch::Aarch64 => "linux/arm64",
}
}
/// Get the build arg value for TARGET_ARCH
pub fn build_arg(&self) -> &'static str {
match self {
TargetArch::X86_64 => "x86_64",
TargetArch::Aarch64 => "aarch64",
}
}
}
/// Common arguments for build targets
#[derive(Args, Debug)]
pub struct BuildTargetArgs {
/// Build in release mode with optimizations
#[arg(short, long)]
pub release: bool,
/// Optional target architecture for cross-compilation (cargo only)
#[arg(short, long, conflicts_with = "docker")]
pub target: Option<String>,
/// Build using Docker for cross-compilation
#[arg(short, long)]
pub docker: bool,
/// Target architecture for Docker builds
#[arg(short, long, value_enum, default_value_t = TargetArch::X86_64, requires = "docker")]
pub arch: TargetArch,
/// Bump version before building (patch, minor, major)
#[arg(long, value_enum, conflicts_with = "version")]
pub bump: Option<VersionBump>,
/// Set specific version before building (e.g., 1.2.3)
#[arg(long, conflicts_with = "bump")]
pub version: Option<String>,
/// Build with dev environment (default is production for builds)
#[arg(long)]
pub dev: bool,
}