Skip to content

Instead of minimal feature, use codegen-full (additive) #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/dodge-the-creeps/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ publish = false
crate-type = ["cdylib"]

[dependencies]
godot = { path = "../../../godot", features = ["minimal"] }
godot = { path = "../../../godot", default-features = false, features = ["formatted", "convenience"] }
rand = "0.8"
6 changes: 4 additions & 2 deletions godot-codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ name = "godot-codegen"
version = "0.1.0"
edition = "2021"
rust-version = "1.63"
license = "MPL-2.0"
keywords = ["gamedev", "godot", "engine", "codegen"]
categories = ["game-engines", "graphics"]

# Note: features not additive, but this is an internal crate
[features]
codegen-fmt = []
minimal = ["codegen-fmt"]
codegen-full = []

[dependencies]
quote = "1"
Expand Down
10 changes: 5 additions & 5 deletions godot-codegen/src/class_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) fn generate_class_files(

let mut modules = vec![];
for class in api.classes.iter() {
#[cfg(feature = "minimal")]
#[cfg(not(feature = "codegen-full"))]
if !crate::SELECTED_CLASSES.contains(&class.name.as_str()) {
continue;
}
Expand Down Expand Up @@ -277,7 +277,7 @@ fn make_enums(enums: &Option<Vec<ClassEnum>>, _class_name: &str, _ctx: &Context)
}
}

#[cfg(feature = "minimal")]
#[cfg(not(feature = "codegen-full"))]
fn is_type_excluded(ty: &str, ctx: &mut Context) -> bool {
let is_class_excluded = |class: &str| !crate::SELECTED_CLASSES.contains(&class);

Expand Down Expand Up @@ -308,7 +308,7 @@ fn is_method_excluded(method: &Method, #[allow(unused_variables)] ctx: &mut Cont
// As such support could be added later (if at all), with possibly safe interfaces (e.g. Vec for void*+size pairs)

// -- FIXME remove when impl complete
#[cfg(feature = "minimal")]
#[cfg(not(feature = "codegen-full"))]
if method
.return_value
.as_ref()
Expand All @@ -333,12 +333,12 @@ fn is_method_excluded(method: &Method, #[allow(unused_variables)] ctx: &mut Cont
.map_or(false, |args| args.iter().any(|arg| arg.type_.contains("*")))
}

#[cfg(not(feature = "minimal"))]
#[cfg(feature = "codegen-full")]
fn is_function_excluded(_function: &UtilityFunction, _ctx: &mut Context) -> bool {
false
}

#[cfg(feature = "minimal")]
#[cfg(not(feature = "codegen-full"))]
fn is_function_excluded(function: &UtilityFunction, ctx: &mut Context) -> bool {
function
.return_type
Expand Down
3 changes: 2 additions & 1 deletion godot-codegen/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ impl<'a> Context<'a> {

for class in api.classes.iter() {
let class_name = class.name.as_str();
#[cfg(feature = "minimal")]

#[cfg(not(feature = "codegen-full"))]
if !crate::SELECTED_CLASSES.contains(&class_name) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion godot-codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ struct GeneratedModule {
// Shared config

// Classes for minimal config
#[cfg(feature = "minimal")]
#[cfg(not(feature = "codegen-full"))]
const SELECTED_CLASSES: &[&str] = &[
"AnimatedSprite2D",
"Area2D",
Expand Down
6 changes: 3 additions & 3 deletions godot-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ keywords = ["gamedev", "godot", "engine", "2d", "3d"] # possibly: "ffi"
categories = ["game-engines", "graphics"]

[features]
default = ["convenience"]
default = []
trace = []
convenience = []
codegen-fmt = ["godot-ffi/codegen-fmt"]
minimal = ["godot-ffi/minimal"]
codegen-full = ["godot-codegen/codegen-full"]
convenience = []
unit-test = ["godot-ffi/unit-test"] # If this crate is built for a downstream unit test

[dependencies]
Expand Down
5 changes: 4 additions & 1 deletion godot-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ name = "godot-ffi"
version = "0.1.0"
edition = "2021"
rust-version = "1.63"
license = "MPL-2.0"
keywords = ["gamedev", "godot", "engine", "ffi"]
categories = ["game-engines", "graphics"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
codegen-fmt = ["godot-codegen/codegen-fmt"]
minimal = ["godot-codegen/minimal"]
#codegen-full = ["godot-codegen/codegen-full"]
unit-test = [] # If this crate is built for a downstream unit test

[dependencies]
Expand Down
3 changes: 3 additions & 0 deletions godot-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "godot-macros"
version = "0.1.0"
edition = "2021"
rust-version = "1.63"
license = "MPL-2.0"
keywords = ["gamedev", "godot", "engine", "derive", "macro"]
categories = ["game-engines", "graphics"]

[lib]
proc-macro = true
Expand Down
13 changes: 9 additions & 4 deletions godot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ name = "godot"
version = "0.1.0"
edition = "2021"
rust-version = "1.63"
license = "MPL-2.0"
keywords = ["gamedev", "godot", "engine", "2d", "3d"] # possibly: "ffi"
categories = ["game-engines", "graphics"]

[features]
default = ["convenience"]
default = ["convenience", "codegen-full"]
convenience = ["godot-core/convenience"]
formatted = ["godot-core/codegen-fmt"]
trace = ["godot-core/trace"]
convenience = []
codegen-fmt = ["godot-core/codegen-fmt"]
minimal = ["godot-core/minimal"]

# Private features, they are under no stability guarantee
codegen-full = ["godot-core/codegen-full"]
unit-test = []

[dependencies]
Expand Down
3 changes: 2 additions & 1 deletion itest/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "itest"
version = "0.1.0"
edition = "2021"
rust-version = "1.63"
publish = false

[lib]
crate-type = ["cdylib"]
Expand All @@ -12,7 +13,7 @@ default = []
trace = ["godot/trace"]

[dependencies]
godot = { path = "../../godot", features = ["minimal"] }
godot = { path = "../../godot", default-features = false, features = ["formatted", "convenience"] }

[build-dependencies]
quote = "1"
Expand Down