Skip to content

Commit

Permalink
[devtools] Diem -> Aptos
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnazario committed Mar 11, 2022
1 parent 9faebd5 commit 9588571
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions devtools/x/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ pub struct WorkspaceConfig {
pub test_only: TestOnlyConfig,
/// Exceptions to whitespace linters
pub whitespace_exceptions: Vec<String>,
/// Move to Diem dependencies
pub move_to_aptos_deps: MoveToDiemDepsConfig,
/// Move to Aptos dependencies
pub move_to_aptos_deps: MoveToAptosDepsConfig,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -160,7 +160,7 @@ pub struct DirectDepDupsConfig {
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct MoveToDiemDepsConfig {
pub struct MoveToAptosDepsConfig {
pub aptos_crates_in_language: HashSet<String>,
pub exclude: HashSet<String>,
}
Expand Down
2 changes: 1 addition & 1 deletion devtools/x/src/generate_summaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ fn write_summary(
}
OutputFormat::Toml => {
let mut out = format!(
"# Summary for Diem subset '{}'. @generated by x.\n\
"# Summary for Aptos subset '{}'. @generated by x.\n\
# To regenerate, run 'cargo x generate-summaries'.\n\n",
name
);
Expand Down
22 changes: 11 additions & 11 deletions devtools/x/src/lint/guppy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! Project and package linters that run queries on guppy.
use crate::config::{
BannedDepsConfig, DirectDepDupsConfig, EnforcedAttributesConfig, MoveToDiemDepsConfig,
BannedDepsConfig, DirectDepDupsConfig, EnforcedAttributesConfig, MoveToAptosDepsConfig,
OverlayConfig,
};
use guppy::{
Expand Down Expand Up @@ -590,25 +590,25 @@ impl PackageLinter for CratesInCratesDirectory {
}
}

// Ensure that Move crates do not depend on Diem crates.
// Ensure that Move crates do not depend on Aptos crates.
#[derive(Debug)]
pub struct MoveCratesDontDependOnDiemCrates<'cfg> {
config: &'cfg MoveToDiemDepsConfig,
pub struct MoveCratesDontDependOnAptosCrates<'cfg> {
config: &'cfg MoveToAptosDepsConfig,
}

impl<'cfg> MoveCratesDontDependOnDiemCrates<'cfg> {
pub fn new(config: &'cfg MoveToDiemDepsConfig) -> Self {
impl<'cfg> MoveCratesDontDependOnAptosCrates<'cfg> {
pub fn new(config: &'cfg MoveToAptosDepsConfig) -> Self {
Self { config }
}
}

impl<'cfg> Linter for MoveCratesDontDependOnDiemCrates<'cfg> {
impl<'cfg> Linter for MoveCratesDontDependOnAptosCrates<'cfg> {
fn name(&self) -> &'static str {
"move-crates-dont-depend-on-aptos-crates"
}
}

impl<'cfg> PackageLinter for MoveCratesDontDependOnDiemCrates<'cfg> {
impl<'cfg> PackageLinter for MoveCratesDontDependOnAptosCrates<'cfg> {
fn run<'l>(
&self,
ctx: &PackageContext<'l>,
Expand All @@ -619,10 +619,10 @@ impl<'cfg> PackageLinter for MoveCratesDontDependOnDiemCrates<'cfg> {
let crate_name = metadata.name();
let crate_path = metadata.source().to_string();

// Determine if a crate is considered a Move crate or Diem crate.
// Determine if a crate is considered a Move crate or Aptos crate.
//
// Current criteria:
// 1. All crates outside language are considered Diem crates.
// 1. All crates outside language are considered Aptos crates.
// 2. All crates inside language are considered Move crates, unless marked otherwise.
let is_move_crate = |crate_path: &str, crate_name: &str| {
if crate_path.starts_with("language/") {
Expand All @@ -649,7 +649,7 @@ impl<'cfg> PackageLinter for MoveCratesDontDependOnDiemCrates<'cfg> {
format!(
"depending on non-move crate `{}`\n\
Note: all crates in language/ are considered Move crates by default. \
If you are creating a new Diem crate in language, you need to add its name to the \
If you are creating a new Aptos crate in language, you need to add its name to the \
aptos_crates_in_language list in x.toml to make the linter recognize it.",
dep_name
),
Expand Down
2 changes: 1 addition & 1 deletion devtools/x/src/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn run(args: Args, xctx: XContext) -> crate::Result<()> {
&guppy::PublishedPackagesDontDependOnUnpublishedPackages::new(xctx.core()),
&guppy::OnlyPublishToCratesIo,
&guppy::CratesInCratesDirectory,
&guppy::MoveCratesDontDependOnDiemCrates::new(&workspace_config.move_to_aptos_deps),
&guppy::MoveCratesDontDependOnAptosCrates::new(&workspace_config.move_to_aptos_deps),
&workspace_classify::DefaultOrTestOnly::new(
xctx.core().package_graph()?,
&workspace_config.test_only,
Expand Down
2 changes: 1 addition & 1 deletion devtools/x/src/nextest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Args {
#[structopt(flatten)]
pub(crate) package_args: SelectedPackageArgs,
#[structopt(long, short)]
/// Skip running expensive diem testsuite integration tests
/// Skip running expensive testsuite integration tests
unit: bool,
#[structopt(flatten)]
pub(crate) build_args: BuildArgs,
Expand Down
2 changes: 1 addition & 1 deletion devtools/x/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct Args {
#[structopt(flatten)]
pub(crate) package_args: SelectedPackageArgs,
#[structopt(long, short)]
/// Skip running expensive diem testsuite integration tests
/// Skip running expensive testsuite integration tests
unit: bool,
#[structopt(long)]
/// Only run doctests
Expand Down
4 changes: 2 additions & 2 deletions devtools/x/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ pub fn sccache_should_run(cargo_config: &CargoConfig, warn_if_not_correct_locati
if !correct_location && warn_if_not_correct_location {
warn!("You will not benefit from sccache in this build!!!");
warn!(
"To get the best experience, please move your diem source code to {} and your set your CARGO_HOME to be {}, simply export it in your .profile or .bash_rc",
"To get the best experience, please move your aptos source code to {} and your set your CARGO_HOME to be {}, simply export it in your .profile or .bash_rc",
&sccache_config.required_git_home, &sccache_config.required_cargo_home
);
warn!(
"Current diem root is '{}', and current CARGO_HOME is '{}'",
"Current aptos root is '{}', and current CARGO_HOME is '{}'",
project_root(),
var_os("CARGO_HOME").unwrap_or_default().to_string_lossy()
);
Expand Down

0 comments on commit 9588571

Please sign in to comment.