Skip to content

Commit

Permalink
Merge pull request #22 from Xila-Project/Feature/Drivers
Browse files Browse the repository at this point in the history
Feature/drivers
  • Loading branch information
AlixANNERAUD authored Jul 10, 2024
2 parents 1e4f586 + 1fdd59c commit a8972d5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
15 changes: 10 additions & 5 deletions Build_tool/src/Command.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Command_type {
Build,
Clean,
Expand All @@ -9,6 +9,7 @@ pub enum Command_type {
Clippy,
Check,
Expand,
Help,
}

impl TryFrom<&str> for Command_type {
Expand All @@ -25,14 +26,15 @@ impl TryFrom<&str> for Command_type {
"clippy" => Ok(Command_type::Clippy),
"check" => Ok(Command_type::Check),
"expand" => Ok(Command_type::Expand),
"help" => Ok(Command_type::Help),
_ => Err(format!("Unknown command : {}", s)),
}
}
}

impl Command_type {
pub fn Get_cargo_command(&self) -> String {
match self {
pub fn Get_cargo_command(&self) -> Option<String> {
Some(match self {
Command_type::Build => "build".to_string(),
Command_type::Clean => "clean".to_string(),
Command_type::Run => "run".to_string(),
Expand All @@ -42,12 +44,15 @@ impl Command_type {
Command_type::Clippy => "clippy".to_string(),
Command_type::Check => "check".to_string(),
Command_type::Expand => "expand".to_string(),
}
_ => return None,
})
}

pub fn Is_target_needed(&self) -> bool {
match self {
Command_type::Clean | Command_type::Format | Command_type::Doc => false,
Command_type::Clean | Command_type::Format | Command_type::Doc | Command_type::Help => {
false
}
Command_type::Build
| Command_type::Run
| Command_type::Test
Expand Down
9 changes: 2 additions & 7 deletions Build_tool/src/Target.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, Default)]
pub enum Target_type {
Linux,
Windows,
ESP32,
ESP32_S3,
#[default]
Native,
}

impl Default for Target_type {
fn default() -> Self {
Target_type::Native
}
}

impl TryFrom<&str> for Target_type {
type Error = String;

Expand Down
7 changes: 6 additions & 1 deletion Build_tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn Get_cargo_arguments(
}

// Add the cargo command like build, clean, run, test, fmt, doc
Cargo_arguments.push(Command.Get_cargo_command());
Cargo_arguments.push(Command.Get_cargo_command().expect("Unknown command"));

// Add the target arguments like --target, -Z build-std=std,panic_abort
if let Some(Target) = Target {
Expand All @@ -120,6 +120,11 @@ fn main() -> Result<(), ()> {
}
};

if Command == Command_type::Help {
println!("{}", Get_usage());
return Ok(());
}

// Create a new process::Command
let mut Shell_command = process::Command::new("cargo");

Expand Down
7 changes: 5 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ source Export.sh
4. Build for the corresponding target:

```bash
build_<target>
xila build <target>
```

Currently supported targets are:
- `linux`
- `windows`
- `esp32`
- `esp32_s3`
- `esp32s3`

There are also other commands available, you can see them by running `xila help`.

## ℹ️ About

Expand Down

0 comments on commit a8972d5

Please sign in to comment.