mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 16:33:24 +00:00
Update proper dep for builder in OSDK and allow publishing
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
bd0611f1e3
commit
57f4ed778d
@ -2,6 +2,9 @@
|
|||||||
name = "linux-bzimage-builder"
|
name = "linux-bzimage-builder"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
description = "Linux boot compatibility for modern OSes"
|
||||||
|
license = "MPL-2.0"
|
||||||
|
repository = "https://github.com/asterinas/asterinas"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
1
osdk/Cargo.lock
generated
1
osdk/Cargo.lock
generated
@ -321,6 +321,7 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-bzimage-builder"
|
name = "linux-bzimage-builder"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/asterinas/asterinas?rev=cc4111c#cc4111cab227f188a1170dea0aa729b410b1b509"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
@ -5,15 +5,23 @@ edition = "2021"
|
|||||||
description = "Accelerate OS development with Asterinas OSDK"
|
description = "Accelerate OS development with Asterinas OSDK"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
repository = "https://github.com/asterinas/asterinas"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies.linux-bzimage-builder]
|
||||||
|
git = "https://github.com/asterinas/asterinas"
|
||||||
|
# Make sure it syncs with `crate::util::ASTER_GIT_REV`
|
||||||
|
rev = "cc4111c"
|
||||||
|
# When publishing, the crate.io version is used, make sure
|
||||||
|
# the builder is published
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.4.17", features = ["cargo", "derive"] }
|
clap = { version = "4.4.17", features = ["cargo", "derive"] }
|
||||||
env_logger = "0.11.0"
|
env_logger = "0.11.0"
|
||||||
indexmap = "2.2.1"
|
indexmap = "2.2.1"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
linux-bzimage-builder = { path = "../framework/libs/linux-bzimage/builder" }
|
|
||||||
log = "0.4.20"
|
log = "0.4.20"
|
||||||
quote = "1.0.35"
|
quote = "1.0.35"
|
||||||
serde = { version = "1.0.195", features = ["derive"] }
|
serde = { version = "1.0.195", features = ["derive"] }
|
||||||
|
@ -80,6 +80,7 @@ Currently we support following commands:
|
|||||||
- **test**: Execute kernel mode unit test by starting a VMM
|
- **test**: Execute kernel mode unit test by starting a VMM
|
||||||
- **check**: Analyze the current package and report errors
|
- **check**: Analyze the current package and report errors
|
||||||
- **clippy**: Check the current package and catch common mistakes
|
- **clippy**: Check the current package and catch common mistakes
|
||||||
|
- **doc**: Build Rust documentations
|
||||||
|
|
||||||
The following command can be used to discover the available options for each command.
|
The following command can be used to discover the available options for each command.
|
||||||
```bash
|
```bash
|
||||||
@ -92,7 +93,7 @@ cargo osdk help <COMMAND>
|
|||||||
|
|
||||||
### Contributing
|
### Contributing
|
||||||
|
|
||||||
Asterinas OSDK is developed as a sub-project of [Asterinas](https://github.com/asterinas/asterinas). It shares the same repository with the kernel. Please contribute to OSDK according to the contribution guide of Asterinas.
|
Asterinas OSDK is developed as a sub-project of [Asterinas](https://github.com/asterinas/asterinas). It shares the same repository and versioning rules with the kernel. Please contribute to OSDK according to the contribution guide of Asterinas.
|
||||||
|
|
||||||
#### Note for Visual Studio Code users
|
#### Note for Visual Studio Code users
|
||||||
|
|
||||||
|
@ -22,8 +22,12 @@ pub fn execute_new_command(args: &NewArgs) {
|
|||||||
|
|
||||||
/// OSDK assumes that the toolchain used by the kernel should be same same as the toolchain
|
/// OSDK assumes that the toolchain used by the kernel should be same same as the toolchain
|
||||||
/// specified in the asterinas workspace.
|
/// specified in the asterinas workspace.
|
||||||
fn aster_rust_toolchain() -> &'static str {
|
fn aster_rust_toolchain() -> String {
|
||||||
include_str!("../../../../rust-toolchain.toml")
|
// Here we can't just include it in the repository root because that can't be
|
||||||
|
// read when publishing. Please ensure update both files when updating the toolchain.
|
||||||
|
let template = include_str!("./rust-toolchain.toml.template");
|
||||||
|
// Delete first two lines of comments.
|
||||||
|
template.lines().skip(2).collect::<Vec<_>>().join("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_manifest_dependencies(cargo_metadata: &serde_json::Value, crate_name: &str) {
|
fn add_manifest_dependencies(cargo_metadata: &serde_json::Value, crate_name: &str) {
|
||||||
@ -190,7 +194,7 @@ fn get_package_metadata<'a>(
|
|||||||
fn check_rust_toolchain(toolchain: &toml::Table) {
|
fn check_rust_toolchain(toolchain: &toml::Table) {
|
||||||
let expected = {
|
let expected = {
|
||||||
let contents = aster_rust_toolchain();
|
let contents = aster_rust_toolchain();
|
||||||
toml::Table::from_str(contents).unwrap()
|
toml::Table::from_str(&contents).unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
let expected = expected.get("toolchain").unwrap().as_table().unwrap();
|
let expected = expected.get("toolchain").unwrap().as_table().unwrap();
|
||||||
|
5
osdk/src/commands/new/rust-toolchain.toml.template
Normal file
5
osdk/src/commands/new/rust-toolchain.toml.template
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# One should also update asterinas/rust-toolchain.toml when updating this.
|
||||||
|
# The first two lines will be deleted when generating the user's toolchain file.
|
||||||
|
[toolchain]
|
||||||
|
channel = "nightly-2024-01-01"
|
||||||
|
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
@ -14,7 +14,8 @@ use quote::ToTokens;
|
|||||||
/// FIXME: We should publish the asterinas crates to a public registry
|
/// FIXME: We should publish the asterinas crates to a public registry
|
||||||
/// and use the published version in the generated Cargo.toml.
|
/// and use the published version in the generated Cargo.toml.
|
||||||
pub const ASTER_GIT_LINK: &str = "https://github.com/asterinas/asterinas";
|
pub const ASTER_GIT_LINK: &str = "https://github.com/asterinas/asterinas";
|
||||||
pub const ASTER_GIT_REV: &str = "1069006";
|
/// Make sure it syncs with the builder dependency in Cargo.toml.
|
||||||
|
pub const ASTER_GIT_REV: &str = "cc4111c";
|
||||||
pub fn aster_crate_dep(crate_name: &str) -> String {
|
pub fn aster_crate_dep(crate_name: &str) -> String {
|
||||||
format!(
|
format!(
|
||||||
"{} = {{ git = \"{}\", rev = \"{}\" }}",
|
"{} = {{ git = \"{}\", rev = \"{}\" }}",
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# One should also update asterinas/src/commands/new/rust-toolchain.toml.template
|
||||||
|
# when updating this
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2024-01-01"
|
channel = "nightly-2024-01-01"
|
||||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||||
|
Reference in New Issue
Block a user