-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Splitting up long files (utils/core) #153
Comments
Additionally, perhaps it would be a good idea to also split up mod_loader.gd? Especially the public API methods. And just as the utility funcs could have a directory called Here's a table with my notes on class names and grouping (all applies to mod_loader.gd except
Using As mentioned before, this would be completely breaking for a lot of mods, but we can take the deprecation approach mentioned in the original post above ("Breaking Changes"). |
I largely agree. Those are some good splits. A few things: Splitting the ModLoader is another thing. If we use |
For the utils classes, would it be better to get rid of the Utils prefix? That would make them a bit shorter, so faster to type. Eg:
Perhaps then we could have the utility funcs in the @Qubus0 How come |
Shorter seems fine to me. |
I think that we should publish a release before we start work on a large refactor like this. We're going to lose a lot of commit history by moving things around, so it would be really good to have a point in time (ie., a release tag) that we can refer back to if we want to see the pre-refactor history. Edit: Actually, we have the recent 5.0.1, so it's probably fine |
Sorry, I'm late to the party. |
|
Based on the discussion in GodotModding#153 - Some compromises had to be done to prevent cyclic reference errors. No `ModLoaderUtils` functions could be used.
* refactor: ♻️ created LogManager and LogEntry Class Moved most of the logging logic from `ModLoaderUtils` into `LogManager`. New `LogEntry` Class to store log message info. Added log storing in `LogManager`. works towards #140 * refactor: ♻️ Moved log functions to `ModLoaderLog` Based on the discussion in #153 - Some compromises had to be done to prevent cyclic reference errors. No `ModLoaderUtils` functions could be used. * refactor: ♻️ move `MOD_LOG_PATH` into *log.gd* * refactor: ♻️ copied `ModLoaderUtils` into *mod_loader_setup.gd* Had to copy the required utility functions into the setup script, because `ModLoaderUtils` depends now on other Classes that don't get loaded. * refactor: ♻️ Moved `ModLoaderLogEntry` inside `ModLoaderLog` With that the ModLoaderLog Class is fully independed and can be loaded in the setup script. * fix: ✏️ fixed search and replace errors accidentally removed the `log_` from the deprecation message and `log_debug_json_print`. * refactor: ♻️ created *setup_log.gd* and setup_utils.gd* There tradeoffs for using the existing ModLoader Classes in the setup script are to big. So the required functions where moved into the *setup/* dir. * refactor: 🔥 clean up logged signal * refactor: ♻️ Add `existing_entry` var * feat: ✨ added time comparison Added `time_stamp` to `ModLoaderLogEntry` and instead of saving the `time` string in `time_stamps` the same log entries are now stored in `stack`. Added `ModLoaderLogCompare` inner class, allowing to call the custom sort function. * feat: ✨ Added `get_all_entries()` to `ModLoaderLogEntry` * feat: ✨ added `get_all_as_resource_array()` * feat: ✨ Added `get_all_as_string_array()` * refactor: 🔥 removed `time_stamps` in *setup_log.gd* not needed in the setup logs * fix: 🐛 not using `.keys()` * feat: ✨ Added `get_by_mod_as_resource_array()` * feat: ✨ Added `get_by_mod_as_string_array()` * feat: ✨ Added `get_by_type_as_resource_array()` * feat: ✨ Added `get_by_type_as_string_array()` * style: ✏️ remove `_array` from func names * refactor: ♻️ Added inner class `ModLoaderLogStoreUtils` To prevent some of the duplications * style: 🎨 direct return in `get_all_as_string()` to match the other funcs * refactor: ♻️ Use `ModLoaderLogStoreUtils` for all get funcs * refactor: ♻️ Removed inner class `ModLoaderLogStoreUtils` * fix: ✏️ fixed accidentally remove func header * refactor: ♻️ Updated *mod.gd* to use `ModLoaderLog` * chore: ⏪ moving self setup changes to separate PR * fix: 🦺 check if `.by_mod` has `mod_name` * style: ✏️ fix comments Added description for `ignored_mod_names_in_log` in `ModLoaderStore` and removed the `;` in the `_rotate_log_file()` comment. * style: 🎨 `get_entry()` using `str()` now
Should we move these functions, currently in mod_loader.gd, as follows:
|
|
Let's keep this issue open until we are satisfied with the location of each file and until the comment from above regarding the functions in mod_loader.gd has been addressed. |
closed by *see #153 (comment) |
api
api
ModLoader
->ModLoaderMod
api
api
internal
internal
internal
internal
internal
internal
check_autoload_position()
- done in #172internal/third_party
Breaking Changes & Deprecation
Ofc, if we moved the logger funcs then every currently published Brotato mod would break. But we could handle this with a deprecation notice, which can be handled with a new func and that triggers a fatal error in the editor. I've explained how this could work in more detail in #154:
The text was updated successfully, but these errors were encountered: