1
Fork 0

Merge commit '98ed962c7d' into master

This commit is contained in:
Guillaume Gomez 2024-07-10 12:44:23 +02:00
commit 7cbe50e209
68 changed files with 2682 additions and 1135 deletions

View file

@ -2,12 +2,13 @@ use std::env;
use std::process;
mod build;
mod cargo;
mod clean;
mod clone_gcc;
mod config;
mod fmt;
mod info;
mod prepare;
mod rust_tools;
mod rustc_info;
mod test;
mod utils;
@ -26,16 +27,23 @@ macro_rules! arg_error {
fn usage() {
println!(
"\
Available commands for build_system:
rustc_codegen_gcc build system
cargo : Run cargo command
clean : Run clean command
prepare : Run prepare command
build : Run build command
test : Run test command
info : Run info command
clone-gcc : Run clone-gcc command
--help : Show this message"
Usage: build_system [command] [options]
Options:
--help : Displays this help message.
Commands:
cargo : Executes a cargo command.
rustc : Compiles the program using the GCC compiler.
clean : Cleans the build directory, removing all compiled files and artifacts.
prepare : Prepares the environment for building, including fetching dependencies and setting up configurations.
build : Compiles the project.
test : Runs tests for the project.
info : Displays information about the build environment and project configuration.
clone-gcc : Clones the GCC compiler from a specified source.
fmt : Runs rustfmt"
);
}
@ -45,8 +53,10 @@ pub enum Command {
CloneGcc,
Prepare,
Build,
Rustc,
Test,
Info,
Fmt,
}
fn main() {
@ -56,12 +66,14 @@ fn main() {
let command = match env::args().nth(1).as_deref() {
Some("cargo") => Command::Cargo,
Some("rustc") => Command::Rustc,
Some("clean") => Command::Clean,
Some("prepare") => Command::Prepare,
Some("build") => Command::Build,
Some("test") => Command::Test,
Some("info") => Command::Info,
Some("clone-gcc") => Command::CloneGcc,
Some("fmt") => Command::Fmt,
Some("--help") => {
usage();
process::exit(0);
@ -75,13 +87,15 @@ fn main() {
};
if let Err(e) = match command {
Command::Cargo => cargo::run(),
Command::Cargo => rust_tools::run_cargo(),
Command::Rustc => rust_tools::run_rustc(),
Command::Clean => clean::run(),
Command::Prepare => prepare::run(),
Command::Build => build::run(),
Command::Test => test::run(),
Command::Info => info::run(),
Command::CloneGcc => clone_gcc::run(),
Command::Fmt => fmt::run(),
} {
eprintln!("Command failed to run: {e}");
process::exit(1);