Skip to content

Commit

Permalink
Consistently name all related features register-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon committed Nov 5, 2024
1 parent 650c2ad commit fba9f61
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion godot-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage = "https://godot-rust.github.io"

[features]
default = []
docs = []
register-docs = []
codegen-rustfmt = ["godot-ffi/codegen-rustfmt", "godot-codegen/codegen-rustfmt"]
codegen-full = ["godot-codegen/codegen-full"]
codegen-lazy-fptrs = [
Expand Down
2 changes: 1 addition & 1 deletion godot-core/src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ unsafe fn gdext_on_level_init(level: InitLevel) {
unsafe { ensure_godot_features_compatible() };
}
InitLevel::Editor => {
#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
// SAFETY: Godot binding is initialized, and this is called from the main thread.
unsafe {
crate::docs::register();
Expand Down
6 changes: 3 additions & 3 deletions godot-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
pub mod builder;
pub mod builtin;
pub mod classes;
#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
pub mod docs;
#[doc(hidden)]
pub mod possibly_docs {
#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
pub use crate::docs::*;
}
pub mod global;
Expand All @@ -35,7 +35,7 @@ pub use godot_ffi as sys;
// ----------------------------------------------------------------------------------------------------------------------------------------------
// Validations (see also godot/lib.rs)

#[cfg(all(feature = "docs", before_api = "4.3"))]
#[cfg(all(feature = "register-docs", before_api = "4.3"))]
compile_error!("Generating editor docs for Rust symbols requires at least Godot 4.3.");

// ----------------------------------------------------------------------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions godot-core/src/registry/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ fn fill_class_info(item: PluginItem, c: &mut ClassRegistrationInfo) {
is_editor_plugin,
is_internal,
is_instantiable,
#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
docs: _,
} => {
c.parent_class_name = Some(base_class_name);
Expand Down Expand Up @@ -296,7 +296,7 @@ fn fill_class_info(item: PluginItem, c: &mut ClassRegistrationInfo) {
PluginItem::InherentImpl(InherentImpl {
register_methods_constants_fn,
register_rpcs_fn: _,
#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
docs: _,
}) => {
c.register_methods_constants_fn = Some(register_methods_constants_fn);
Expand All @@ -315,7 +315,7 @@ fn fill_class_info(item: PluginItem, c: &mut ClassRegistrationInfo) {
user_free_property_list_fn,
user_property_can_revert_fn,
user_property_get_revert_fn,
#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
virtual_method_docs: _,
} => {
c.user_register_fn = user_register_fn;
Expand Down
8 changes: 4 additions & 4 deletions godot-core/src/registry/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
use crate::docs::*;
use crate::init::InitLevel;
use crate::meta::ClassName;
Expand Down Expand Up @@ -65,7 +65,7 @@ pub struct InherentImpl {
///
/// This function is called in [`UserClass::__before_ready()`](crate::obj::UserClass::__before_ready) definitions generated by the `#[derive(GodotClass)]` macro.
pub register_rpcs_fn: Option<ErasedRegisterRpcsFn>,
#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
pub docs: InherentImplDocs,
}

Expand Down Expand Up @@ -121,7 +121,7 @@ pub enum PluginItem {

/// Whether the class has a default constructor.
is_instantiable: bool,
#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
docs: Option<StructDocs>,
},

Expand All @@ -130,7 +130,7 @@ pub enum PluginItem {

/// Collected from `#[godot_api] impl I... for MyClass`.
ITraitImpl {
#[cfg(all(since_api = "4.3", feature = "docs"))]
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
/// Virtual method documentation.
virtual_method_docs: &'static str,
/// Callback to user-defined `register_class` function.
Expand Down
2 changes: 1 addition & 1 deletion godot-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage = "https://godot-rust.github.io"

[features]
api-custom = ["godot-bindings/api-custom"]
docs = ["dep:markdown"]
register-docs = ["dep:markdown"]
codegen-full = ["godot/__codegen-full"]

[lib]
Expand Down
4 changes: 2 additions & 2 deletions godot-macros/src/class/data_models/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Field {
pub var: Option<FieldVar>,
pub export: Option<FieldExport>,
pub is_onready: bool,
#[cfg(feature = "docs")]
#[cfg(feature = "register-docs")]
pub attributes: Vec<venial::Attribute>,
}

Expand All @@ -28,7 +28,7 @@ impl Field {
var: None,
export: None,
is_onready: false,
#[cfg(feature = "docs")]
#[cfg(feature = "register-docs")]
attributes: field.attributes.clone(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions godot-macros/src/class/data_models/inherent_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ pub fn transform_inherent_impl(mut impl_block: venial::Impl) -> ParseResult<Toke
let (funcs, signals) = process_godot_fns(&class_name, &mut impl_block)?;
let consts = process_godot_constants(&mut impl_block)?;

#[cfg(all(feature = "docs", since_api = "4.3"))]
#[cfg(all(feature = "register-docs", since_api = "4.3"))]
let docs = crate::docs::make_inherent_impl_docs(&funcs, &consts, &signals);
#[cfg(not(all(feature = "docs", since_api = "4.3")))]
#[cfg(not(all(feature = "register-docs", since_api = "4.3")))]
let docs = quote! {};

let signal_registrations = make_signal_registrations(signals, &class_name_obj);
Expand Down
4 changes: 2 additions & 2 deletions godot-macros/src/class/data_models/interface_trait_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ pub fn transform_trait_impl(original_impl: venial::Impl) -> ParseResult<TokenStr
let mut virtual_method_names = vec![];

let prv = quote! { ::godot::private };
#[cfg(all(feature = "docs", since_api = "4.3"))]
#[cfg(all(feature = "register-docs", since_api = "4.3"))]
let docs = crate::docs::make_virtual_impl_docs(&original_impl.body_items);
#[cfg(not(all(feature = "docs", since_api = "4.3")))]
#[cfg(not(all(feature = "register-docs", since_api = "4.3")))]
let docs = quote! {};
for item in original_impl.body_items.iter() {
let method = if let venial::ImplMember::AssocFunction(f) = item {
Expand Down
4 changes: 2 additions & 2 deletions godot-macros/src/class/derive_godot_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ pub fn derive_godot_class(item: venial::Item) -> ParseResult<TokenStream> {

let is_internal = struct_cfg.is_internal;
let base_ty = &struct_cfg.base_ty;
#[cfg(all(feature = "docs", since_api = "4.3"))]
#[cfg(all(feature = "register-docs", since_api = "4.3"))]
let docs = crate::docs::make_definition_docs(
base_ty.to_string(),
&class.attributes,
&fields.all_fields,
);
#[cfg(not(all(feature = "docs", since_api = "4.3")))]
#[cfg(not(all(feature = "register-docs", since_api = "4.3")))]
let docs = quote! {};
let base_class = quote! { ::godot::classes::#base_ty };
let base_class_name_obj = util::class_name_obj(&base_class);
Expand Down
2 changes: 1 addition & 1 deletion godot-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
mod bench;
mod class;
mod derive;
#[cfg(all(feature = "docs", since_api = "4.3"))]
#[cfg(all(feature = "register-docs", since_api = "4.3"))]
mod docs;
mod gdextension;
mod itest;
Expand Down
2 changes: 1 addition & 1 deletion godot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ codegen-rustfmt = ["godot-core/codegen-rustfmt"]
lazy-function-tables = ["godot-core/codegen-lazy-fptrs"]
serde = ["godot-core/serde"]

register-docs = ["godot-macros/docs", "godot-core/docs"]
register-docs = ["godot-macros/register-docs", "godot-core/register-docs"]

api-custom = ["godot-core/api-custom"]
# [version-sync] [[
Expand Down

0 comments on commit fba9f61

Please sign in to comment.