pushing proper better thing

This commit is contained in:
Able 2021-11-16 22:52:17 -06:00
parent 0eb69ba676
commit 50e8444c69
4 changed files with 165 additions and 80 deletions

143
repbuild/Cargo.lock generated
View file

@ -2,15 +2,6 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
"winapi",
]
[[package]]
name = "anyhow"
version = "1.0.45"
@ -28,6 +19,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bitflags"
version = "1.3.2"
@ -36,19 +33,41 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "clap"
version = "2.33.3"
version = "3.0.0-beta.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
checksum = "feff3878564edb93745d58cf63e17b63f24142506e7a20c87a5521ed7bfb1d63"
dependencies = [
"ansi_term",
"atty",
"bitflags",
"clap_derive",
"indexmap",
"lazy_static",
"os_str_bytes",
"strsim",
"termcolor",
"textwrap",
"unicode-width",
"vec_map",
"unicase",
]
[[package]]
name = "clap_derive"
version = "3.0.0-beta.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b15c6b4f786ffb6192ffe65a36855bc1fc2444bcd0945ae16748dcd6ed7d0d3"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "heck"
version = "0.3.3"
@ -67,6 +86,16 @@ dependencies = [
"libc",
]
[[package]]
name = "indexmap"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -79,6 +108,21 @@ version = "0.2.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
[[package]]
name = "memchr"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "os_str_bytes"
version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "addaa943333a514159c80c97ff4a93306530d965d27e139188283cd13e06a799"
dependencies = [
"memchr",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
@ -123,42 +167,18 @@ dependencies = [
[[package]]
name = "repbuild"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"anyhow",
"structopt",
"clap",
"xshell",
]
[[package]]
name = "strsim"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "structopt"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c"
dependencies = [
"clap",
"lazy_static",
"structopt-derive",
]
[[package]]
name = "structopt-derive"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
@ -172,14 +192,32 @@ dependencies = [
]
[[package]]
name = "textwrap"
version = "0.11.0"
name = "termcolor"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
dependencies = [
"unicode-width",
]
[[package]]
name = "unicase"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check",
]
[[package]]
name = "unicode-segmentation"
version = "1.8.0"
@ -198,12 +236,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.9.3"
@ -226,6 +258,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"

View file

@ -1,12 +1,10 @@
cargo-features = ["edition2021"]
[package]
name = "repbuild"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
authors = ["Able", "NotAble"]
[dependencies]
anyhow = "1.0.39"
structopt = "0.3.21"
clap = "3.0.0-beta.5"
xshell = "0.1.9"
anyhow = "*"

View file

@ -1,2 +1,5 @@
# AbleOS Build system
The ableOS build system was ripped from repnops xtask build system in the risc-v kernel (hence the name)
# Release
Fail if not compiling on all platforms

View file

@ -1,34 +1,76 @@
use structopt::StructOpt;
use clap::Parser;
#[derive(StructOpt)]
#[derive(clap::Parser, Debug)]
#[clap(version = clap::crate_version!(), author = clap::crate_authors!("\n"))]
/// Hello Remember this is a feature
enum Command {
Run {
#[structopt(long)]
#[clap(long, short)]
debug: bool,
#[clap(long, short, arg_enum)]
machine: Option<MachineType>,
},
}
fn build_kernel() -> anyhow::Result<()> {
let _dir = xshell::pushd("./ableos");
// Used for the x86-64 variant only
xshell::cmd!("cargo run --release").run()?;
// xshell::cmd!("cargo build --release").run()?;
Ok(())
#[derive(clap::ArgEnum, Debug, Clone)]
enum MachineType {
X86,
/// hi
RISCV,
ARM,
}
fn main() -> anyhow::Result<()> {
let args = Command::from_args();
let args = Command::parse();
match args {
Command::Run { debug } => {
build_kernel()?;
Command::Run { debug, machine } => {
let _dir = xshell::pushd("./ableos");
let debug_log: &[&str] = match debug {
let _debug_log: &[&str] = match debug {
true => &["-D", "debug.log"],
false => &[],
};
match machine.unwrap_or(MachineType::X86) {
MachineType::X86 => {
// Used for the x86-64 variant only
xshell::cmd!("cargo run --release").run()?;
}
MachineType::ARM => {
xshell::cmd!("cargo build --release --target=json_targets/aarch64-ableos.json")
.run()?;
#[rustfmt::skip]
xshell::cmd!(
"qemu-system-aarch64
-machine virt
-m 1024M
-cpu cortex-a53
-kernel target/aarch64-ableos/release/ableos
-device virtio-keyboard
"
)
.run()?;
}
MachineType::RISCV => {
xshell::cmd!("cargo build --release --target=riscv64gc-unknown-none-elf")
.run()?;
#[rustfmt::skip]
xshell::cmd!(
"
qemu-system-riscv64
-machine virt
-cpu rv64
-smp 8
-m 128M
-bios opensbi-riscv64-generic-fw_jump.bin
-kernel blog_os/target/riscv64gc-unknown-none-elf/release/blog_os
"
)
.run()?;
}
}
/*
#[rustfmt::skip]
xshell::cmd!("
qemu-system-x86_64
@ -36,6 +78,7 @@ fn main() -> anyhow::Result<()> {
{debug_log...}
"
).run()?;
*/
}
}