Skip to content
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

Polish & fix editor help cache generation #84354

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

RandomShaper
Copy link
Member

  • Isolated the generation of extensions's docs. They're now not cached and refreshed as needed.
  • Removed superfluous sorting of the class list.
  • Removed some superfluous/unused elements.
  • Renamed some items for clarity.

Fixes #82817.

@RandomShaper RandomShaper added this to the 4.2 milestone Nov 2, 2023
@RandomShaper RandomShaper requested a review from a team as a code owner November 2, 2023 10:19
@akien-mga
Copy link
Member

The Mono glue generation is crashing: https://github.com/godotengine/godot/actions/runs/6731199052/job/18295441262?pr=84354

It reports that it's missing GlobalScope, not sure if that's the source of the crash.

- Isolated the generation of extensions's docs. They're now not cached and refreshed as needed.
- Removed superfluous sorting of the class list.
- Removed some superfluous/unused elements.
- Renamed some items for clarity.
@RandomShaper
Copy link
Member Author

Should be fixed now.

@@ -2415,14 +2419,15 @@ void EditorHelp::_gen_doc_thread(void *p_udata) {
}
}

void EditorHelp::_gen_extensions_docs() {
Copy link
Contributor

@YuriSizov YuriSizov Nov 2, 2023

Choose a reason for hiding this comment

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

I think this can be a public method (called generate_extension_docs), and I think to fully support extensions this needs to be called whenever the GDExtension manager hot reloads any library. IIUC, this right now only loads extension docs when loading the cache or generating it anew.

Though that said, we would have to also invalidate old records somehow. DocData should keep track if it's an extension class or not, if it doesn't already, and we should be able to nuke it all.

Copy link
Contributor

Choose a reason for hiding this comment

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

In @Riteo's PR to allow GDExtensions to add fuller documentation, he's got a separate DocTools * just for the extension documentation in order to keep track of which is from extensions:

https://github.com/godotengine/godot/pull/83747/files#diff-7f898e9b24837a348e2209c5a7e5d2b686d91580787069a6bab6ea78a5d38dba

Perhaps that approach could work here?

(May not actually make sense, I don't know the documentation system that well :-))

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this would be necessary for this particular purpose (and besides, when we generate everything anew, we don't differentiate between sources of each class). ClassDB already has the API type stored, we can just read it and add it to the documentation entry.

Copy link
Contributor

Choose a reason for hiding this comment

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

A bit late to the party but yeah, the separate DocTools is actually just a way to persist that non-generated data between regens.

Copy link
Contributor

@YuriSizov YuriSizov left a comment

Choose a reason for hiding this comment

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

I can confirm this fixes the issue, if we don't consider hot reloading. Code changes also look good to me.

I think hot reloading can be fixed separately in a future PR (for 4.3 + maybe a 4.2.x cherry-pick). The implementation would be pretty straightforward, IMO. We can utilize DocTools::remove_doc and remove all docs related to extensions at the start of GDExtensionManager::reload_extension, and then regenerate them all after it is done. A bit excessive, but will get the job done.

We could probably use DocTools::remove_doc on individual classes before we reload the extension, if we can figure out which classes belong to it. But I believe a full (extension only) regen would be quick enough here already. If we do manage to remove individual classes, though, we should also make sure to regenerate only the newly added classes.

@YuriSizov YuriSizov merged commit b733901 into godotengine:master Nov 2, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@RandomShaper RandomShaper deleted the gdext_no_cache_doc branch November 3, 2023 08:40
@Riteo
Copy link
Contributor

Riteo commented Nov 4, 2023

We could probably use DocTools::remove_doc on individual classes before we reload the extension, if we can figure out which classes belong to it.

FTR, this approach is implemented #83747.

Note that the individual regen part is not implemented in said PR but I can make one after GodotCon.

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.

GDExtension documentation no longer updating
5 participants