Skip to content

Commit bdb243f

Browse files
authored
Merge pull request #390 from godot-rust/qol/restructure-modules
Clean up file structure in `godot-macros` and `itest` crates
2 parents bb2be22 + 64d059e commit bdb243f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+918
-890
lines changed

.github/workflows/full-ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,15 @@ jobs:
7979
# Note: could use `-- --no-deps` to not lint dependencies, however it doesn't really speed up and also skips deps in workspace.
8080
- name: "Check clippy"
8181
run: |
82-
cargo clippy --all-targets $GDEXT_FEATURES ${{ matrix.rust-extra-args }} -- \
83-
-D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
84-
-D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented -D warnings
82+
cargo clippy --all-targets $GDEXT_FEATURES -- \
83+
-D clippy::suspicious \
84+
-D clippy::style \
85+
-D clippy::complexity \
86+
-D clippy::perf \
87+
-D clippy::dbg_macro \
88+
-D clippy::todo \
89+
-D clippy::unimplemented \
90+
-D warnings
8591
8692
unit-test:
8793
name: unit-test (${{ matrix.name }}${{ matrix.rust-special }})

.github/workflows/minimal-ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,15 @@ jobs:
8383

8484
- name: "Check clippy"
8585
run: |
86-
cargo clippy --all-targets $GDEXT_FEATURES ${{ matrix.rust-extra-args }} -- \
87-
-D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
88-
-D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented -D warnings
86+
cargo clippy --all-targets $GDEXT_FEATURES -- \
87+
-D clippy::suspicious \
88+
-D clippy::style \
89+
-D clippy::complexity \
90+
-D clippy::perf \
91+
-D clippy::dbg_macro \
92+
-D clippy::todo \
93+
-D clippy::unimplemented \
94+
-D warnings
8995
9096
9197
unit-test:

check.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ function cmd_dok() {
158158
# Argument parsing
159159
################################################################################
160160

161-
# By default, disable `codegen-full` to reduce compile times and prevent flip-flopping
162-
# between `itest` compilations and `check.sh` runs.
161+
# By default, disable `codegen-full` to reduce compile times and prevent flip-flopping between
162+
# `itest` compilations and `check.sh` runs. Note that this means some runs are different from CI.
163163
extraCargoArgs=("--no-default-features")
164164
cmds=()
165165
nextArgIsFilter=false
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
*/
6+
7+
use crate::class::{FieldExport, FieldVar};
8+
use proc_macro2::{Ident, TokenStream};
9+
10+
pub struct Field {
11+
pub name: Ident,
12+
pub ty: venial::TyExpr,
13+
pub default: Option<TokenStream>,
14+
pub var: Option<FieldVar>,
15+
pub export: Option<FieldExport>,
16+
}
17+
18+
impl Field {
19+
pub fn new(field: &venial::NamedField) -> Self {
20+
Self {
21+
name: field.name.clone(),
22+
ty: field.ty.clone(),
23+
default: None,
24+
var: None,
25+
export: None,
26+
}
27+
}
28+
}
29+
30+
pub struct Fields {
31+
/// All fields except `base_field`.
32+
pub all_fields: Vec<Field>,
33+
34+
/// The field annotated with `#[base]`.
35+
pub base_field: Option<Field>,
36+
}

godot-macros/src/derive_godot_class/property/field_export.rs renamed to godot-macros/src/class/data_models/field_export.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
66

7+
use proc_macro2::{Ident, TokenStream};
8+
use quote::quote;
79
use std::collections::HashSet;
810

11+
use crate::class::FieldHint;
912
use crate::util::{KvParser, ListParser};
1013
use crate::ParseResult;
11-
use proc_macro2::{Ident, TokenStream};
12-
use quote::quote;
13-
14-
use super::FieldHint;
1514

1615
/// Store info from `#[export]` attribute.
1716
pub enum FieldExport {

godot-macros/src/derive_godot_class/property/field_var.rs renamed to godot-macros/src/class/data_models/field_var.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
66

7-
use crate::derive_godot_class::{make_existence_check, Field, FieldHint};
8-
use crate::method_registration::make_method_registration;
9-
use crate::method_registration::FuncDefinition;
10-
use crate::util::KvParser;
11-
use crate::{util, ParseResult};
127
use proc_macro2::{Ident, TokenStream};
138
use quote::{format_ident, quote};
149

10+
use crate::class::{
11+
make_existence_check, make_method_registration, Field, FieldHint, FuncDefinition,
12+
};
13+
use crate::util::KvParser;
14+
use crate::{util, ParseResult};
15+
1516
/// Store info from `#[var]` attribute.
1617
#[derive(Default, Clone, Debug)]
1718
pub struct FieldVar {
@@ -144,7 +145,7 @@ impl GetSet {
144145
}
145146

146147
#[derive(Clone, Debug)]
147-
pub(super) struct GetterSetterImpl {
148+
pub struct GetterSetterImpl {
148149
pub function_name: Ident,
149150
pub function_impl: TokenStream,
150151
pub export_token: TokenStream,

0 commit comments

Comments
 (0)