mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-30 00:23:24 +00:00
Adjust the format of imports in Asterinas
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
92e488e727
commit
cfcef6965a
@ -4,10 +4,14 @@ use std::path::PathBuf;
|
||||
|
||||
use clap::{crate_version, Args, Parser};
|
||||
|
||||
use crate::commands::{execute_check_command, execute_clippy_command, execute_new_command};
|
||||
use crate::config_manager::boot::{BootLoader, BootProtocol};
|
||||
use crate::config_manager::qemu::QemuMachine;
|
||||
use crate::config_manager::{BuildConfig, RunConfig, TestConfig};
|
||||
use crate::{
|
||||
commands::{execute_check_command, execute_clippy_command, execute_new_command},
|
||||
config_manager::{
|
||||
boot::{BootLoader, BootProtocol},
|
||||
qemu::QemuMachine,
|
||||
BuildConfig, RunConfig, TestConfig,
|
||||
},
|
||||
};
|
||||
|
||||
pub fn main() {
|
||||
let osdk_subcommand = match Cli::parse() {
|
||||
|
@ -2,12 +2,10 @@
|
||||
|
||||
use std::process;
|
||||
|
||||
use crate::commands::utils::create_target_json;
|
||||
use crate::error::Errno;
|
||||
use crate::error_msg;
|
||||
use crate::utils::get_cargo_metadata;
|
||||
|
||||
use super::utils::{cargo, COMMON_CARGO_ARGS};
|
||||
use crate::{
|
||||
commands::utils::create_target_json, error::Errno, error_msg, utils::get_cargo_metadata,
|
||||
};
|
||||
|
||||
pub fn execute_check_command() {
|
||||
let target_json_path = {
|
||||
|
@ -2,11 +2,10 @@
|
||||
|
||||
use std::process;
|
||||
|
||||
use crate::error_msg;
|
||||
use crate::utils::get_cargo_metadata;
|
||||
use crate::{commands::utils::create_target_json, error::Errno};
|
||||
|
||||
use super::utils::{cargo, COMMON_CARGO_ARGS};
|
||||
use crate::{
|
||||
commands::utils::create_target_json, error::Errno, error_msg, utils::get_cargo_metadata,
|
||||
};
|
||||
|
||||
pub fn execute_clippy_command() {
|
||||
let target_json_path = {
|
||||
|
@ -7,6 +7,6 @@ mod clippy;
|
||||
mod new;
|
||||
mod utils;
|
||||
|
||||
pub use self::check::execute_check_command;
|
||||
pub use self::clippy::execute_clippy_command;
|
||||
pub use self::new::execute_new_command;
|
||||
pub use self::{
|
||||
check::execute_check_command, clippy::execute_clippy_command, new::execute_new_command,
|
||||
};
|
||||
|
@ -1,13 +1,13 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use std::{fs, process};
|
||||
use std::{fs, path::PathBuf, process, str::FromStr};
|
||||
|
||||
use crate::cli::NewArgs;
|
||||
use crate::error::Errno;
|
||||
use crate::error_msg;
|
||||
use crate::utils::{cargo_new_lib, get_cargo_metadata, ASTER_FRAME_DEP};
|
||||
use crate::{
|
||||
cli::NewArgs,
|
||||
error::Errno,
|
||||
error_msg,
|
||||
utils::{cargo_new_lib, get_cargo_metadata, ASTER_FRAME_DEP},
|
||||
};
|
||||
|
||||
pub fn execute_new_command(args: &NewArgs) {
|
||||
cargo_new_lib(&args.crate_name);
|
||||
|
@ -1,8 +1,10 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::{
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
};
|
||||
|
||||
pub const COMMON_CARGO_ARGS: &[&str] = &[
|
||||
"-Zbuild-std=core,alloc,compiler_builtins",
|
||||
|
@ -1,10 +1,8 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
use std::{path::PathBuf, process};
|
||||
|
||||
use crate::error::Errno;
|
||||
use crate::error_msg;
|
||||
use crate::{error::Errno, error_msg};
|
||||
|
||||
/// Arguments for creating bootdev image and how to boot with vmm.
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -1,16 +1,15 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
use std::{path::PathBuf, process};
|
||||
|
||||
use regex::Regex;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::error::Errno;
|
||||
use crate::error_msg;
|
||||
|
||||
use super::boot::Boot;
|
||||
use super::qemu::{CfgQemu, Qemu};
|
||||
use super::{
|
||||
boot::Boot,
|
||||
qemu::{CfgQemu, Qemu},
|
||||
};
|
||||
use crate::{error::Errno, error_msg};
|
||||
|
||||
/// The osdk manifest from configuration file and command line arguments.
|
||||
#[derive(Debug)]
|
||||
|
@ -9,18 +9,22 @@ pub mod boot;
|
||||
pub mod manifest;
|
||||
pub mod qemu;
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::{fs, process};
|
||||
use std::{fs, path::PathBuf, process};
|
||||
|
||||
use indexmap::{IndexMap, IndexSet};
|
||||
use which::which;
|
||||
|
||||
use self::boot::BootLoader;
|
||||
use self::manifest::{OsdkManifest, TomlManifest};
|
||||
use crate::cli::{BuildArgs, CargoArgs, OsdkArgs, RunArgs, TestArgs};
|
||||
use crate::error::Errno;
|
||||
use crate::utils::get_cargo_metadata;
|
||||
use crate::{error_msg, warn_msg};
|
||||
use self::{
|
||||
boot::BootLoader,
|
||||
manifest::{OsdkManifest, TomlManifest},
|
||||
};
|
||||
use crate::{
|
||||
cli::{BuildArgs, CargoArgs, OsdkArgs, RunArgs, TestArgs},
|
||||
error::Errno,
|
||||
error_msg,
|
||||
utils::get_cargo_metadata,
|
||||
warn_msg,
|
||||
};
|
||||
|
||||
/// Configurations for build subcommand
|
||||
#[derive(Debug)]
|
||||
|
@ -1,16 +1,14 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::PathBuf;
|
||||
use std::{fmt, process};
|
||||
use std::{collections::BTreeMap, fmt, path::PathBuf, process};
|
||||
|
||||
use serde::de::{self, Visitor};
|
||||
use serde::{Deserialize, Deserializer};
|
||||
|
||||
use crate::error::Errno;
|
||||
use crate::error_msg;
|
||||
use serde::{
|
||||
de::{self, Visitor},
|
||||
Deserialize, Deserializer,
|
||||
};
|
||||
|
||||
use super::get_key;
|
||||
use crate::{error::Errno, error_msg};
|
||||
|
||||
/// Arguments for creating bootdev image and how to boot with vmm.
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -1,13 +1,18 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use crate::config_manager::manifest::{OsdkManifest, TomlManifest, FEATURE_REGEX};
|
||||
|
||||
use crate::cli::CargoArgs;
|
||||
use crate::config_manager::get_feature_strings;
|
||||
use crate::test::utils::{assert_success, cargo_osdk, create_workspace};
|
||||
use crate::{
|
||||
cli::CargoArgs,
|
||||
config_manager::{
|
||||
get_feature_strings,
|
||||
manifest::{OsdkManifest, TomlManifest, FEATURE_REGEX},
|
||||
},
|
||||
test::utils::{assert_success, cargo_osdk, create_workspace},
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn deserialize_osdk_manifest() {
|
||||
|
@ -2,11 +2,14 @@
|
||||
|
||||
//! The common utils for crate unit test
|
||||
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
fs::{self, create_dir_all},
|
||||
path::{Path, PathBuf},
|
||||
process::Output,
|
||||
};
|
||||
|
||||
use assert_cmd::Command;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::{self, create_dir_all};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Output;
|
||||
|
||||
pub fn cargo_osdk<T: AsRef<OsStr>, I: IntoIterator<Item = T>>(args: I) -> Command {
|
||||
let mut command = Command::cargo_bin("cargo-osdk").unwrap();
|
||||
|
@ -1,13 +1,10 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::{ffi::OsStr, path::Path, process::Command};
|
||||
|
||||
use crate::error::Errno;
|
||||
use crate::error_msg;
|
||||
use crate::{error::Errno, error_msg};
|
||||
|
||||
// FIXME: Crates belonging to Asterinas require a different dependency format. The dependency
|
||||
// FIXME: Crates belonging to Asterinas require a different dependency format. The dependency
|
||||
// should be specified using a relative path instead of a URL.
|
||||
pub const ASTER_FRAME_DEP: &str =
|
||||
"aster-frame = { git = \"https://github.com/asterinas/asterinas\", rev = \"f2f991b\" }";
|
||||
|
Reference in New Issue
Block a user