Add rustfmt.toml for OSDK

This commit is contained in:
Jianfeng Jiang
2024-02-29 06:07:27 +00:00
committed by Tate, Hongliang Tian
parent 7d8e8aa07d
commit 853e475d29
5 changed files with 22 additions and 9 deletions

View File

@ -98,7 +98,7 @@ OSDK_CRATES := \
kernel/comps/virtio \
kernel/libs/aster-util
.PHONY: all build tools run test docs check clean update_initramfs
.PHONY: all build tools run test docs check clean update_initramfs install_osdk
all: build

10
osdk/rustfmt.toml Normal file
View File

@ -0,0 +1,10 @@
# This file contains the same content as the rustfmt.toml in the root directory,
# but configurations that rely on nightly Rust are commented out.
# This is needed because unlike the rest of the project,
# OSDK is built with the stable Rust and thus cannot use unstable features.
# Once these rustfmt configurations become stable,
# the corresponding lines can be uncommented.
# imports_granularity="Crate"
# group_imports="StdExternalCrate"
reorder_imports=true

View File

@ -154,8 +154,7 @@ fn install_setup_with_arch(
cmd.arg("--force");
cmd.arg("--root").arg(install_dir.as_ref());
// TODO: Use the latest revision when modifications on the `osdk` branch is merged.
cmd.arg("--git")
.arg(crate::util::ASTER_GIT_LINK);
cmd.arg("--git").arg(crate::util::ASTER_GIT_LINK);
cmd.arg("--rev").arg(crate::util::ASTER_GIT_REV);
cmd.arg("--target").arg(match arch {
SetupInstallArch::X86_64 => "x86_64-unknown-none",

View File

@ -12,7 +12,7 @@ use crate::{
cli::NewArgs,
error::Errno,
error_msg,
util::{cargo_new_lib, get_cargo_metadata, aster_crate_dep},
util::{aster_crate_dep, cargo_new_lib, get_cargo_metadata},
};
pub fn execute_new_command(args: &NewArgs) {
@ -75,7 +75,7 @@ fn create_osdk_manifest(cargo_metadata: &serde_json::Value) {
// The apt OVMF repo installs to `/usr/share/OVMF`
fs::write(
osdk_manifest_path,
r#"\
r#"
[boot]
ovmf = "/usr/share/OVMF"
[qemu]

View File

@ -6,7 +6,6 @@ WORKSPACE_ROOT="$(dirname "$(readlink -f "$0")")/.."
EXCLUDED_CRATES=$(sed -n '/^\[workspace\]/,/^\[.*\]/{/exclude = \[/,/\]/p}' "$WORKSPACE_ROOT/Cargo.toml" | grep -v "exclude = \[" | tr -d '", \]')
CHECK_MODE=false
if [ "$#" -eq 1 ]; then
@ -31,15 +30,20 @@ fi
for CRATE in $EXCLUDED_CRATES; do
CRATE_DIR="$WORKSPACE_ROOT/$CRATE"
# `cargo-component` crate currently is pinned to use Rust nightly-2023-02-05 version,
# and when using this script in the current Docker environment, it will
# additionally download this version of Rust.
# Here temporarily skip processing this crate for now considering that this crate
# is not currently in use or under development.
case "$CRATE" in
# `cargo-component` crate currently is pinned to use Rust nightly-2023-02-05 version,
# and when using this script in the current Docker environment, it will
# additionally download this version of Rust.
*cargo-component*)
continue
;;
# `target/osdk/base` is generated by OSDK and does not need to be formatted. The directory
# does not exist before running `make build`.
*target/osdk/base*)
continue
;;
esac
if [ -d "$CRATE_DIR" ]; then