Add hook file to generator dependency list - #2054
Open
Naros wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should guarantee that when the hook file contents change, the files are regenerated on CMake and don't become stale across rebuilds.
FYI @Togira123
In addition to this, I do have one question. In our implementation what we opted to do was to have the hooks file act as a delegator/reader. In other words our project looks like this:
resource_loader.hpp
resource_loader.cpp
The script knows how to parse these fragments and place the contents where it belongs.
Our CMAKE module watches for any changes to the contents in cmake/bindings/** and if a file changes, this enforces a similar situation to what you see here by adding the hook file as a dependency.
I do wonder whether it would make sense for there to be something like a
GODOTCPP_BINDING_HOOK_DIRand here is where a user would place their python script and any other content, which would be treated as a DEPENDS input here, and any content that changes in this directory enforces a regeneration pass. The other option is just a genericGODOTCPP_BINDING_DEPENDSwhere the extension supplies a list of files, which could include the python script and any other dependencies.For now, we have to generate a SHA256 fingerprint on each file in the directory, and if there are changes, we remove the godot-cpp hpp/cpp files so they get regenerated, which seems like it would be naturally expected to work that way out of the box.