mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-26 10:53:25 +00:00
Make essential changes for publishing OSTD
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
77b823edc0
commit
f86583dbce
@ -157,10 +157,9 @@ fn install_setup_with_arch(
|
||||
cmd.arg("install").arg("linux-bzimage-setup");
|
||||
cmd.arg("--force");
|
||||
cmd.arg("--root").arg(install_dir.as_ref());
|
||||
cmd.arg("--git").arg(crate::util::ASTER_GIT_LINK);
|
||||
// FIXME: Uses a fixed tag instaed of relies on remote branch
|
||||
cmd.arg("--tag").arg("v0.5.1");
|
||||
// cmd.arg("--tag").arg(crate::util::ASTER_GIT_TAG);
|
||||
// Remember to upgrade this version if new version of linux-bzimage-setup is released.
|
||||
const LINUX_BZIMAGE_SETUP_VERSION: &str = "0.1.0";
|
||||
cmd.arg("--version").arg(LINUX_BZIMAGE_SETUP_VERSION);
|
||||
cmd.arg("--target").arg(match arch {
|
||||
SetupInstallArch::X86_64 => "x86_64-unknown-none",
|
||||
SetupInstallArch::Other(path) => path.to_str().unwrap(),
|
||||
|
@ -7,7 +7,7 @@ use crate::{
|
||||
config::manifest::ProjectType,
|
||||
error::Errno,
|
||||
error_msg,
|
||||
util::{aster_crate_dep, cargo_new_lib, get_cargo_metadata},
|
||||
util::{cargo_new_lib, get_cargo_metadata, ostd_dep},
|
||||
};
|
||||
|
||||
pub fn execute_new_command(args: &NewArgs) {
|
||||
@ -40,7 +40,7 @@ fn add_manifest_dependencies(cargo_metadata: &serde_json::Value, crate_name: &st
|
||||
|
||||
let dependencies = manifest.get_mut("dependencies").unwrap();
|
||||
|
||||
let ostd_dep = toml::Table::from_str(&aster_crate_dep("ostd")).unwrap();
|
||||
let ostd_dep = toml::Table::from_str(&ostd_dep()).unwrap();
|
||||
dependencies.as_table_mut().unwrap().extend(ostd_dep);
|
||||
|
||||
let content = toml::to_string(&manifest).unwrap();
|
||||
|
@ -12,18 +12,12 @@ use crate::{error::Errno, error_msg};
|
||||
|
||||
use quote::ToTokens;
|
||||
|
||||
/// FIXME: We should publish the asterinas crates to a public registry
|
||||
/// and use the published version in the generated Cargo.toml.
|
||||
pub const ASTER_GIT_LINK: &str = "https://github.com/asterinas/asterinas";
|
||||
/// Make sure it syncs with the builder dependency in Cargo.toml.
|
||||
/// We cannot use `include_str!("../../VERSION")` here
|
||||
/// because `cargo publish` does not allow using files outside of the crate directory.
|
||||
pub const ASTER_GIT_TAG: &str = concat!("v", env!("CARGO_PKG_VERSION"));
|
||||
pub fn aster_crate_dep(crate_name: &str) -> String {
|
||||
format!(
|
||||
"{} = {{ git = \"{}\", tag = \"{}\" }}",
|
||||
crate_name, ASTER_GIT_LINK, ASTER_GIT_TAG
|
||||
)
|
||||
/// The version of OSTD on crates.io.
|
||||
///
|
||||
/// OSTD shares the same version with OSDK, so just use the version of OSDK here.
|
||||
pub const OSTD_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
pub fn ostd_dep() -> String {
|
||||
format!("ostd = {{ version = \"{}\" }}", OSTD_VERSION)
|
||||
}
|
||||
|
||||
fn cargo() -> Command {
|
||||
|
Reference in New Issue
Block a user