cpclib_runner/runner/assembler/
rasm.rs

1use std::fmt::Display;
2
3use crate::delegated::{
4    ArchiveFormat, CompilableInformation, DownloadableInformation, ExecutableInformation,
5    GithubCompilableApplication, GithubInformation
6};
7
8pub const RASM_CMD: &str = "rasm";
9
10#[derive(Clone, Debug, PartialEq, Eq, Hash, Default)]
11pub enum RasmVersion {
12    #[default]
13    Beacon2025, // 2.3.6
14    Consolidation2024 // V2_2_5
15}
16
17impl GithubCompilableApplication for RasmVersion {}
18
19impl Display for RasmVersion {
20    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21        write!(f, "rasm {}", self.version_name())
22    }
23}
24
25impl GithubInformation for RasmVersion {
26    fn version_name(&self) -> &'static str {
27        match self {
28            Self::Beacon2025 => "Beacon",
29            Self::Consolidation2024 => "Consolidation"
30        }
31    }
32
33    fn project(&self) -> &'static str {
34        "rasm"
35    }
36
37    fn owner(&self) -> &'static str {
38        "EdouardBERGE"
39    }
40
41    fn linux_key(&self) -> Option<&'static str> {
42        Some("Source code (zip)")
43    }
44
45    fn windows_key(&self) -> Option<&'static str> {
46        Some("rasm_x64.exe")
47    }
48}
49
50impl ExecutableInformation for RasmVersion {
51    fn target_os_folder(&self) -> &'static str {
52        match self {
53            Self::Beacon2025 => "rasm_beacon",
54            Self::Consolidation2024 => "rasm_consolidation"
55        }
56    }
57
58    fn target_os_exec_fname(&self) -> &'static str {
59        #[cfg(target_os = "windows")]
60        return "rasm_w64.exe";
61        #[cfg(target_os = "macos")]
62        unimplemented!();
63        #[cfg(target_os = "linux")]
64        return "rasm";
65    }
66}
67
68impl CompilableInformation for RasmVersion {
69    fn target_os_commands(&self) -> Option<&'static [&'static [&'static str]]> {
70        if cfg!(target_os = "linux") {
71            Some(&[&["make"], &["mv", "rasm.exe", "rasm"]])
72        }
73        else {
74            None
75        }
76    }
77}
78
79impl DownloadableInformation for RasmVersion {
80    fn target_os_archive_format(&self) -> ArchiveFormat {
81        #[cfg(target_os = "linux")]
82        return ArchiveFormat::Zip;
83        #[cfg(target_os = "windows")]
84        return ArchiveFormat::Raw;
85    }
86}