feat: switch to cargo-make

This commit is contained in:
Paul Pan 2024-02-16 20:59:09 +08:00
parent daaea9d158
commit e7c1a7a656
14 changed files with 57 additions and 56 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

8
.idea/.gitignore vendored
View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerExplorerSettingsProvider">
<option name="enabled" value="false" />
<option name="url" value="https://godbolt.org" />
<option name="initialNoticeShown" value="true" />
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<includedPredefinedLibrary name="Node.js Core" />
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RsVcsConfiguration">
<option name="rustFmt" value="true" />
</component>
</project>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4"> <module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/kernel/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/kernel/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" /> <excludeFolder url="file://$MODULE_DIR$/kernel/target" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

View File

@ -2,6 +2,5 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

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"
@ -43,6 +49,7 @@ name = "kernel"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.4.2",
"cfg-if",
"lazy_static", "lazy_static",
"log", "log",
"riscv", "riscv",

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",
}, },
]; ];