feat: switch to cargo-make

This commit is contained in:
Paul Pan 2024-02-16 20:59:09 +08:00
parent 613512e329
commit 35a77f39ab
8 changed files with 55 additions and 25 deletions

View File

@ -10,17 +10,21 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
- name: Install Qemu
uses: ConorMacBride/install-package@v1
with:
apt: qemu-system
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with: with:
toolchain: nightly toolchain: nightly
targets: riscv64imac-unknown-none-elf targets: riscv64imac-unknown-none-elf
components: clippy components: clippy
- uses: ConorMacBride/install-package@v1
with: - name: Install cargo-make
apt: qemu-system run: cargo install cargo-make
- name: Clippy
run: cargo clippy - name: Run CI Flow
- name: Build run: cargo make ci-flow
run: cargo build --verbose
- name: Test
run: cargo test

1
.gitignore vendored
View File

@ -1 +1,2 @@
/.idea
/target /target

View File

@ -1,3 +0,0 @@
[workspace]
resolver = "2"
members = ["kernel"]

18
Makefile.toml Normal file
View File

@ -0,0 +1,18 @@
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_WORKSPACE_EMULATION = true
CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = [
"kernel"
]
[tasks.clipppy]
install_crate = "clippy"
command = "cargo"
args = ["clippy"]
dependencies = ["fmt"]
[tasks.build]
args = ["build"]
[tasks.test]
args = ["test"]

2
kernel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/.idea
/target

View File

@ -26,6 +26,12 @@ version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "critical-section" name = "critical-section"
version = "1.1.2" version = "1.1.2"
@ -42,14 +48,15 @@ checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89"
name = "kernel" name = "kernel"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.4.2",
"lazy_static", "cfg-if",
"log", "lazy_static",
"riscv", "log",
"sbi-rt", "riscv",
"spin 0.9.8", "sbi-rt",
"static_assertions", "spin 0.9.8",
"uart_16550", "static_assertions",
"uart_16550",
] ]
[[package]] [[package]]

View File

@ -13,7 +13,6 @@ arch_riscv32 = []
board_default = [] board_default = []
board_virt = [] board_virt = []
board_thead = []
log_color = [] log_color = []
@ -25,9 +24,10 @@ panic = "abort"
[profile.release] [profile.release]
panic = "abort" panic = "abort"
lto = "thin"
[dependencies] [dependencies]
bitflags = "2.4.1" bitflags = "2.4.2"
lazy_static = { version = "1.4.0", features = ["spin_no_std"] } lazy_static = { version = "1.4.0", features = ["spin_no_std"] }
log = "0.4" log = "0.4"
riscv = { version = "0.11.1", features = ["s-mode"] } riscv = { version = "0.11.1", features = ["s-mode"] }
@ -35,3 +35,4 @@ sbi-rt = { version = "0.0.3", features = ["legacy"] }
spin = "0.9.8" spin = "0.9.8"
static_assertions = "1.1.0" static_assertions = "1.1.0"
uart_16550 = "0.3" uart_16550 = "0.3"
cfg-if = "1.0.0"

View File

@ -9,11 +9,11 @@ fn main() {
const TARGET_LDS: &[TargetConfig] = &[ const TARGET_LDS: &[TargetConfig] = &[
TargetConfig { TargetConfig {
target: "riscv64", target: "riscv64",
lds: "kernel/src/arch/riscv/linker.ld", lds: "src/arch/riscv/linker.ld",
}, },
TargetConfig { TargetConfig {
target: "riscv32", target: "riscv32",
lds: "kernel/src/arch/riscv/linker.ld", lds: "src/arch/riscv/linker.ld",
}, },
]; ];