raulsntos / godot-dotnet

MIT License
86 stars 13 forks source link

Add CL option to generate bindings #6

Open Repiteo opened 7 months ago

Repiteo commented 7 months ago

Implements a new CL argument to streamline the build process: --generate/-g. Using this option is equivalent to the more verbose /p:GenerateGodotBindings=true, and the relevant uses of such in actions were replaced. Addditionally, out of convenience to new users, the associated bool is activated during an initial build attempt (more specifically, if no Generated folder exists).

raulsntos commented 6 months ago

I'd prefer to avoid adding custom arguments to the build scripts, they're meant to match Arcade SDK as close as possible. Also, using MSBuild properties seems better anyway because we don't have to duplicate the logic in so many places (build.sh, build.ps1, build.py, etc.)

Specifically for the GenerateGodotBindings properties, what I had in mind was to default to true so the user would not have to explicitly specify it. I imagine most users would not need to use the property, it would only be useful for contributors to disable the generating when they don't want it to override some manual changes they might've made to the generated source code during development for debugging or something.

https://github.com/raulsntos/godot-dotnet/blob/15b9b53641e38bc894e34f4138d6c93f1906be4e/src/Godot.Bindings/Godot.Bindings.csproj#L20-L23

The problem with setting GenerateGodotBindings to true by default right now is that the MSBuild task currently doesn't support incremental builds (that is, it will always generate bindings even when nothing has changed) and in my testing that makes IDEs like VSCode run out of memory.