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

Script to automatically fix most deprecated API usage (where applicable) #12

Open
rollerozxa opened this issue Dec 21, 2024 · 2 comments
Labels
Concept approved PRs welcomed! Feature request Issues that request the addition or enhancement of a feature

Comments

@rollerozxa
Copy link
Member

Looking through some of the contents that were imported from the old developer wiki made me find this old script by SmallJoker that would rename some deprecated names to their new counterparts. Such a script, but more expanded should be available here such that developers can easier update their mods and games to not use deprecated functions.

For more inspiration see SDL's tooling for helping with the migration to SDL3 - they have both python scripts that runs regular regex replacements for renames as well as more advanced semantical replacements using Coccinelle, which both allows automatically changing simple things without developer intervention as well as putting FIXME code comments for things that should be checked by a developer.

@rollerozxa rollerozxa changed the title Script to automatically rename deprecated API names Script to automatically fix most deprecated API usage (where applicable) Dec 21, 2024
@appgurueu appgurueu added Feature request Issues that request the addition or enhancement of a feature Concept approved PRs welcomed! labels Dec 21, 2024
@SmallJoker
Copy link
Member

I'd too recommend to use a Python script for this task. Shell scripts perform awfully when executing hundreds of commands, and implementing custom logic causes pain twice: once when you write it, and the 2nd time when you'd like to extend it.

@appgurueu
Copy link
Contributor

Niemand hat die Absicht, ein Shellskript zu schreiben.

Personally I'd prefer a Lua script probably, but Python is also okay. I suppose whoever whips up this thing will get to choose.

I wonder whether simple text replacements are the way to go though. Maybe we should rather bring a full blown Lua parser. For simple things like renames there isn't much of a difference, but consider for example what happens if we rename a node def field - with a Lua parser it's easy to see, oh this is a call to core.register_node and the table constructor contains the old field name as a key. With a true regex it's impossible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Concept approved PRs welcomed! Feature request Issues that request the addition or enhancement of a feature
Projects
None yet
Development

No branches or pull requests

3 participants