diff --git a/cpclib-bndbuild/src/executor.rs b/cpclib-bndbuild/src/executor.rs index 9d422574..766a7190 100644 --- a/cpclib-bndbuild/src/executor.rs +++ b/cpclib-bndbuild/src/executor.rs @@ -8,9 +8,10 @@ use crate::runners::disc::DiscManagerRunner; use crate::runners::echo::EchoRunner; use crate::runners::imgconverter::ImgConverterRunner; use crate::runners::r#extern::ExternRunner; +use crate::runners::martine::MartineVersion; use crate::runners::rm::RmRunner; use crate::runners::xfer::XferRunner; -use crate::runners::Runner; +use crate::runners::{martine, Runner}; use crate::task::Task; pub static BASM_RUNNER: LazyLock = LazyLock::new(BasmRunner::default); @@ -51,6 +52,10 @@ pub fn execute(task: &Task) -> Result<(), String> { Task::Echo(_) => ECHO_RUNNER.run(task.args()), Task::Extern(_) => EXTERN_RUNNER.run(task.args()), Task::ImgConverter(_) => IMGCONV_RUNNER.run(task.args()), + Task::Martine(_) => DelegatedRunner { + app: MartineVersion::default().configuration(), + cmd: MartineVersion::default().get_command().to_owned() + }.run(task.args()), Task::Rm(_) => RM_RUNNER.run(task.args()), Task::Xfer(_) => XFER_RUNNER.run(task.args()) } diff --git a/cpclib-bndbuild/src/runners/martine.rs b/cpclib-bndbuild/src/runners/martine.rs new file mode 100644 index 00000000..d0a79ddd --- /dev/null +++ b/cpclib-bndbuild/src/runners/martine.rs @@ -0,0 +1,61 @@ +use crate::{delegated::{ArchiveFormat, DelegateApplicationDescription}, task::MARTINE_CMDS}; + +pub enum MartineVersion { + V0_39 +} + +impl Default for MartineVersion { + fn default() -> Self { + MartineVersion::V0_39 + } +} + +impl MartineVersion { + pub fn get_command(&self) -> &str { + MARTINE_CMDS[0] + } +} + +cfg_match! { + cfg(target_os = "linux") => + { + impl MartineVersion { + pub fn configuration(&self) -> DelegateApplicationDescription { + match self { + MartineVersion::V0_39 => + DelegateApplicationDescription { + download_url: "https://github.com/jeromelesaux/martine/releases/download/v0.39/martine-0.39-linux-amd64.zip", // we assume a modern CPU + folder : "martine_0_39", + archive_format: ArchiveFormat::Zip, + exec_fname: "martine.linux", + compile: None + } + } + } + } + } + cfg(target_os = "windows") => + { + impl MartineVersion { + pub fn configuration(&self) -> DelegateApplicationDescription { + match self { + MartineVersion::V0_39 => + DelegateApplicationDescription { + download_url: "https://github.com/jeromelesaux/martine/releases/download/v0.39/martine-0.39-windows-amd64.zip", + folder : "martine_0_39", + archive_format: ArchiveFormat::Zip, + exec_fname: "martine.exe", + compile: None + } + } + } + } + + } + cfg(target_os = "macos") => + { + + } + _ => { + } +} \ No newline at end of file diff --git a/cpclib-bndbuild/src/runners/mod.rs b/cpclib-bndbuild/src/runners/mod.rs index bdff50b8..0f060c60 100644 --- a/cpclib-bndbuild/src/runners/mod.rs +++ b/cpclib-bndbuild/src/runners/mod.rs @@ -10,6 +10,7 @@ pub mod echo; pub mod emulator; pub mod r#extern; pub mod imgconverter; +pub mod martine; pub mod rm; pub mod xfer; diff --git a/cpclib-bndbuild/src/task.rs b/cpclib-bndbuild/src/task.rs index 853529cc..214952e5 100644 --- a/cpclib-bndbuild/src/task.rs +++ b/cpclib-bndbuild/src/task.rs @@ -17,6 +17,7 @@ pub enum Task { Emulator(Emulator, StandardTask), Extern(StandardTask), ImgConverter(StandardTask), + Martine(StandardTask), Rm(StandardTask), Xfer(StandardTask) } @@ -32,6 +33,7 @@ pub const DISC_CMDS: &[&str] = &["dsk", "disc"]; pub const ECHO_CMDS: &[&str] = &["echo", "print"]; pub const EXTERN_CMDS: &[&str] = &["extern"]; pub const IMG2CPC_CMDS: &[&str] = &["img2cpc", "imgconverter"]; +pub const MARTINE_CMDS: &[&str] = &["martine"]; pub const RASM_CMDS: &[&str] = &["rasm"]; pub const RM_CMDS: &[&str] = &["rm", "del"]; pub const XFER_CMDS: &[&str] = &["xfer", "cpcwifi", "m4"]; @@ -48,7 +50,8 @@ impl Display for Task { Task::ImgConverter(s) => (IMG2CPC_CMDS[0], s), Task::Rm(s) => (RM_CMDS[0], s), Task::Xfer(s) => (XFER_CMDS[0], s), - Task::Emulator(e, s) => (e.get_command(), s) + Task::Emulator(e, s) => (e.get_command(), s), + Task::Martine(s) => (MARTINE_CMDS[0], s), }; write!( @@ -124,6 +127,9 @@ impl<'de> Deserialize<'de> for Task { else if IMG2CPC_CMDS.iter().contains(&code) { Ok(Task::ImgConverter(std)) } + else if MARTINE_CMDS.iter().contains(&code) { + Ok(Task::Martine(std)) + } else if RM_CMDS.iter().contains(&code) { Ok(Task::Rm(std)) } @@ -172,14 +178,15 @@ impl Task { fn standard_task(&self) -> &StandardTask { match self { Task::Assembler(_, t) - | Task::Rm(t) + | Task::BndBuild(t) + | Task::Cp(t) + | Task::Disc(t) | Task::Echo(t) + | Task::Extern(t) | Task::ImgConverter(t) + | Task::Martine(t) + | Task::Rm(t) | Task::Xfer(t) - | Task::Extern(t) - | Task::Disc(t) - | Task::BndBuild(t) - | Task::Cp(t) | Task::Emulator(_, t) => t } } @@ -194,6 +201,7 @@ impl Task { | Task::Extern(t) | Task::Disc(t) | Task::BndBuild(t) + | Task::Martine(t) | Task::Cp(t) | Task::Emulator(_, t) => t } @@ -220,6 +228,7 @@ impl Task { Task::Echo(_) => true, Task::Emulator(..) => true, Task::Xfer(_) => true, // wrong when downloading files + Task::Martine(t) => false, Task::ImgConverter(_) => false, Task::Extern(_) => false, Task::BndBuild(_) => false, diff --git a/cpclib-bndbuild/tests/delegated/.gitignore b/cpclib-bndbuild/tests/delegated/.gitignore new file mode 100644 index 00000000..707bb5d6 --- /dev/null +++ b/cpclib-bndbuild/tests/delegated/.gitignore @@ -0,0 +1,2 @@ +martine.scr +show.sna diff --git a/cpclib-bndbuild/tests/delegated/build.bnd b/cpclib-bndbuild/tests/delegated/build.bnd new file mode 100644 index 00000000..3a27772a --- /dev/null +++ b/cpclib-bndbuild/tests/delegated/build.bnd @@ -0,0 +1,23 @@ +# This project only use delegated commands. +# No one comes from benediction + +- tgt: ace + dep: show.sna + cmd: ace show.sna + +- tgt: show.sna + dep: martine.scr/MARTIN.SCR martine.scr/MARTIN.PAL show.asm + cmd: rasm show.asm -oi show.sna -map + +- tgt: martine.scr/MARTIN.SCR martine.scr/MARTIN.PAL + dep: martine-logo.png + cmd: martine -in martine-logo.png -mode 1 -noheader -out martine.scr + +- tgt: clean + pnony: true + cmd: -rm martine.scr # ATM it is buggy as it is a folderand not handled + +- tgt: distclean + dep: clean + phony: true + cmd: -rm show.sna \ No newline at end of file diff --git a/cpclib-bndbuild/tests/delegated/martine-logo.png b/cpclib-bndbuild/tests/delegated/martine-logo.png new file mode 100644 index 00000000..eb5a89e0 Binary files /dev/null and b/cpclib-bndbuild/tests/delegated/martine-logo.png differ diff --git a/cpclib-bndbuild/tests/delegated/show.asm b/cpclib-bndbuild/tests/delegated/show.asm new file mode 100644 index 00000000..ae4c7368 --- /dev/null +++ b/cpclib-bndbuild/tests/delegated/show.asm @@ -0,0 +1,27 @@ + BUILDSNA ; Mandatory for rasm + BANKSET 0 ; Mandatory for rasm + + org 0xc000 + incbin "martine.scr/MARTIN.SCR" + + org 0x4000 + run $ + + di + ld bc, 0x7f00 + ld hl, PAL + + repeat 4 + ld a, (hl) + out (c), c : out (c), a + inc a + inc hl + rend + + jp $ + +PAL + incbin "martine.scr/MARTIN.PAL", 3, 1 + incbin "martine.scr/MARTIN.PAL", 3+12, 1 + incbin "martine.scr/MARTIN.PAL", 3+12+12, 1 + incbin "martine.scr/MARTIN.PAL", 3+12+12+12, 1 \ No newline at end of file