Skip to content

Make RST: Exclude godot-cpp test project files #103625

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aaronfranke
Copy link
Member

This is required to avoid erroring in the case of multiple third-party modules that can build as both GDExtension and engine modules while those modules also have godot-cpp cloned inside of them. Without this PR, make_rst.py will give an error about duplicate classes from the multiple godot-cpp test projects.

ERROR: modules/1d/addons/nd/src/godot-cpp/test/doc_classes/Example.xml: Duplicate class "Example".
ERROR: modules/2pt5d/addons/2pt5d/src/godot-cpp/test/doc_classes/Example.xml: Duplicate class "Example".
ERROR: modules/4d/addons/nd/src/godot-cpp/test/doc_classes/Example.xml: Duplicate class "Example".
ERROR: modules/nd/addons/nd/src/godot-cpp/test/doc_classes/Example.xml: Duplicate class "Example".

I know this is a niche thing, but it would be nice to have the script working and CI passing in this case.

@@ -731,6 +731,10 @@ def main() -> None:

if os.path.basename(path) in ["modules", "platform"]:
for subdir, dirs, _ in os.walk(path):
# Exclude godot-cpp test project files for the case of
# third-party modules with godot-cpp inside of them.
if "/godot-cpp/test" in subdir:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work even if the "godot-cpp" directory isn't at the top level?

I know most projects put it there, but I've got a couple that put it under "thirdparty" and other folks may do other things as well. Maybe we need a way to provide a list of exclude directories?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in fact that's how I use it. This is just a string match, it will work regardless of how deep it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do paths returned by os.walk() on Windows use forward slashes? If not, this check won't work on Windows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not fond of hardcoding something specific to a thirdparty repository here.
A project might use godot-cpp but with a different folder name (e.g. it may be cloned as godot-cpp.git), and the test folder may not always be there in the future or include documentation.

I think this would be better solved by improving the logic so it doesn't go so deep.

The patterns to support are:

modules/<name>/doc_classes
platform/<name>/doc_classes

So if we limit ourselves to one level of depth it should be fine I expect.

Otherwise, adding a way to pass excludes from the command line might be better than hardcoding exceptions here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akien-mga In my module I am using modules/4d/addons/4d/doc_classes. Thoufh it is possible to infer the maximum depth level if we read the modules config.py files, that would be a larger change than I originally intended.

Copy link
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

@aaronfranke aaronfranke force-pushed the make-rst-no-gdcpp-test branch from bfd626c to a700ad9 Compare May 2, 2025 00:28
@aaronfranke aaronfranke force-pushed the make-rst-no-gdcpp-test branch from a700ad9 to 5551549 Compare June 2, 2025 16:04
@akien-mga akien-mga modified the milestones: 4.5, 4.x Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants