refactor(ast_tools): rename oxc_ast_codegen to oxc_ast_tools. (#4846)

This PR renames the `oxc_ast_codegen` crate to `oxc_ast_tools`, It improves the readability and organization of the codebase by giving the crate a name that better reflects its purpose and contents.

It also improves the error message in CI.
This commit is contained in:
rzvxa 2024-08-12 14:33:58 +00:00
parent 0a23610d9a
commit 8e8fcd0584
39 changed files with 31 additions and 31 deletions

View file

@ -1,4 +1,4 @@
# To edit this generated file you have to edit `tasks/ast_codegen/src/main.rs`
# To edit this generated file you have to edit `tasks/ast_tools/src/main.rs`
# Auto-generated code, DO NOT EDIT DIRECTLY!
src:

View file

@ -280,12 +280,12 @@ jobs:
if: steps.filter.outputs.src == 'true'
with:
components: rustfmt
cache-key: codegen
cache-key: ast_changes
save-cache: ${{ github.ref_name == 'main' }}
- name: Check AST Changes
if: steps.filter.outputs.src == 'true'
run: |
cargo run -p oxc_ast_codegen
echo 'AST changes must be commited to the repo.'
git diff --exit-code
cargo run -p oxc_ast_tools
git diff --exit-code ||
echo 'AST changes caused the "generated" code to get outdated. Have you forgotten to run the `just ast` command and/or commit generated codes?'

20
Cargo.lock generated
View file

@ -1475,7 +1475,16 @@ dependencies = [
]
[[package]]
name = "oxc_ast_codegen"
name = "oxc_ast_macros"
version = "0.24.2"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "oxc_ast_tools"
version = "0.0.0"
dependencies = [
"bpaf",
@ -1491,15 +1500,6 @@ dependencies = [
"syn",
]
[[package]]
name = "oxc_ast_macros"
version = "0.24.2"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "oxc_benchmark"
version = "0.0.0"

View file

@ -1,6 +1,6 @@
// NB: `#[span]`, `#[scope(...)]` and `#[visit(...)]` do NOT do anything to the code.
// They are purely markers for codegen used in
// `tasks/ast_codegen` and `crates/oxc_traverse/scripts`. See docs in those crates.
// `tasks/ast_tools` and `crates/oxc_traverse/scripts`. See docs in those crates.
// Silence erroneous warnings from Rust Analyser for `#[derive(Tsify)]`
#![allow(non_snake_case)]

View file

@ -2,7 +2,7 @@
// NB: `#[span]`, `#[scope(...)]` and `#[visit(...)]` do NOT do anything to the code.
// They are purely markers for codegen used in
// `tasks/ast_codegen` and `crates/oxc_traverse/scripts`. See docs in those crates.
// `tasks/ast_tools` and `crates/oxc_traverse/scripts`. See docs in those crates.
// Silence erroneous warnings from Rust Analyser for `#[derive(Tsify)]`
#![allow(non_snake_case)]

View file

@ -2,7 +2,7 @@
// NB: `#[span]`, `#[scope(...)]` and `#[visit(...)]` do NOT do anything to the code.
// They are purely markers for codegen used in
// `tasks/ast_codegen` and `crates/oxc_traverse/scripts`. See docs in those crates.
// `tasks/ast_tools` and `crates/oxc_traverse/scripts`. See docs in those crates.
// Silence erroneous warnings from Rust Analyser for `#[derive(Tsify)]`
#![allow(non_snake_case)]

View file

@ -5,7 +5,7 @@
// NB: `#[span]`, `#[scope(...)]` and `#[visit(...)]` do NOT do anything to the code.
// They are purely markers for codegen used in
// `tasks/ast_codegen` and `crates/oxc_traverse/scripts`. See docs in those crates.
// `tasks/ast_tools` and `crates/oxc_traverse/scripts`. See docs in those crates.
// Silence erroneous warnings from Rust Analyser for `#[derive(Tsify)]`
#![allow(non_snake_case)]

View file

@ -1,5 +1,5 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_codegen/src/generators/assert_layouts.rs`
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/assert_layouts.rs`
use std::mem::{align_of, offset_of, size_of};

View file

@ -1,5 +1,5 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_codegen/src/generators/ast_builder.rs`
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/ast_builder.rs`
#![allow(
clippy::default_trait_access,

View file

@ -1,5 +1,5 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_codegen/src/generators/ast_kind.rs`
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/ast_kind.rs`
use oxc_span::{GetSpan, Span};

View file

@ -1,5 +1,5 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_codegen/src/generators/derive_clone_in.rs`
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/derive_clone_in.rs`
#![allow(clippy::default_trait_access)]

View file

@ -1,5 +1,5 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_codegen/src/generators/derive_get_span.rs`
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/derive_get_span.rs`
#![allow(clippy::match_same_arms)]

View file

@ -1,5 +1,5 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_codegen/src/generators/derive_get_span.rs`
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/derive_get_span.rs`
#![allow(clippy::match_same_arms)]

View file

@ -1,5 +1,5 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_codegen/src/generators/visit.rs`
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/visit.rs`
//! Visitor Pattern
//!

View file

@ -1,5 +1,5 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_codegen/src/generators/visit.rs`
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/visit.rs`
//! Visitor Pattern
//!

View file

@ -174,5 +174,5 @@ website path:
# sync ast changes
ast:
cargo run -p oxc_ast_codegen
cargo run -p oxc_ast_tools
just check

View file

@ -1,5 +1,5 @@
[package]
name = "oxc_ast_codegen"
name = "oxc_ast_tools"
version = "0.0.0"
publish = false
edition.workspace = true
@ -9,7 +9,7 @@ license.workspace = true
workspace = true
[[bin]]
name = "oxc_ast_codegen"
name = "oxc_ast_tools"
test = false
doctest = false

View file

@ -17,7 +17,7 @@ use super::{define_pass, Pass};
/// We use compiler to infer 64bit type layouts.
#[cfg(not(target_pointer_width = "64"))]
compile_error!("`oxc_ast_codegen::calc_layout` only supports 64 architectures.");
compile_error!("This module only supports 64bit architectures.");
type WellKnown = HashMap<&'static str, PlatformLayout>;