Basic repl
This commit is contained in:
commit
408f351332
19 changed files with 564 additions and 0 deletions
32
xtask/Cargo.toml
Normal file
32
xtask/Cargo.toml
Normal file
|
@ -0,0 +1,32 @@
|
|||
[package]
|
||||
name = "xtask"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.20", features = ["derive"] }
|
||||
|
||||
[profile.dev]
|
||||
rpath = false
|
||||
panic = "abort"
|
||||
lto = "off"
|
||||
opt-level = 0
|
||||
debug = false
|
||||
overflow-checks = false
|
||||
incremental = true
|
||||
codegen-units = 256
|
||||
|
||||
strip = "symbols"
|
||||
debug-assertions = false
|
||||
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 0
|
||||
debug = false
|
||||
overflow-checks = false
|
||||
incremental = true
|
||||
codegen-units = 256
|
||||
|
||||
strip = "symbols"
|
||||
debug-assertions = false
|
||||
|
1
xtask/src/editor.rs
Normal file
1
xtask/src/editor.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub fn build_editor() {}
|
22
xtask/src/engine.rs
Normal file
22
xtask/src/engine.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
use std::process::Stdio;
|
||||
|
||||
|
||||
pub fn build_engine() {
|
||||
|
||||
}
|
||||
|
||||
pub fn build_core() {
|
||||
let threads = format!("-j{}",std::thread::available_parallelism().unwrap().get());
|
||||
let mut run = std::process::Command::new("cargo")
|
||||
.arg("run")
|
||||
|
||||
.arg(threads)
|
||||
.arg("--bin")
|
||||
.arg("zenyx")
|
||||
.stdin(Stdio::inherit())
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.spawn()
|
||||
.unwrap();
|
||||
run.wait().unwrap();
|
||||
}
|
70
xtask/src/main.rs
Normal file
70
xtask/src/main.rs
Normal file
|
@ -0,0 +1,70 @@
|
|||
|
||||
use clap::{CommandFactory, Parser, Subcommand, ValueEnum};
|
||||
pub mod engine;
|
||||
pub mod editor;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(version, about, long_about = None,disable_version_flag = true,disable_help_flag = true)]
|
||||
struct Cli {
|
||||
#[arg(short,long)]
|
||||
release: bool,
|
||||
#[command(subcommand)]
|
||||
command: Option<Commands>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Commands {
|
||||
Run {
|
||||
#[arg()]
|
||||
task: Task
|
||||
},
|
||||
Config,
|
||||
|
||||
}
|
||||
#[derive(Clone,ValueEnum)]
|
||||
enum Task {
|
||||
Engine, // Builds both editor and core
|
||||
Editor, // Builds editor only
|
||||
Core, // Builds engine core only
|
||||
Help,
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn main() {
|
||||
let cli = Cli::parse();
|
||||
|
||||
|
||||
|
||||
|
||||
if cli.release {
|
||||
println!("Running in release mode")
|
||||
}
|
||||
|
||||
match &cli.command {
|
||||
|
||||
None => {
|
||||
Cli::command().print_help().map_err(|e| {
|
||||
println!("Could not run Xtask: {e}");
|
||||
|
||||
}).unwrap();
|
||||
}
|
||||
Some(Commands::Run { task }) => {
|
||||
match task {
|
||||
Task::Engine => engine::build_engine(),
|
||||
Task::Editor => todo!("Editor is not being actively worked on"),
|
||||
Task::Core => {
|
||||
engine::build_core();
|
||||
},
|
||||
Task::Help => {
|
||||
println!("The following options are avalible to run");
|
||||
todo!()
|
||||
},
|
||||
}
|
||||
}
|
||||
Some(Commands::Config) => {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue