Refactor build system (with SCons, probably… unless?) #11613
Replies: 4 comments 27 replies
-
CMake
Plus
|
Beta Was this translation helpful? Give feedback.
-
I don't have much to say with regards to build systems, but i will say this: The proposal to refactor our use of scons may mean a lot of work, but it is a lot of work that can be approached incrementally. To the proposal itself: Fully agreed; there is a lot of unnecessary complexity, some of which could definitely be reduced through more idiomatic SCons use! |
Beta Was this translation helpful? Give feedback.
-
My first recommendation would be to start separating the Python code that is responsible for code generation from the code responsible for building. The goal would be that we could call all the Python manually and directly from the shell without any dependency on The Python for code generation will require inputs from the build system, but those can then be provided when invoked from alternative system or the shell. |
Beta Was this translation helpful? Give feedback.
-
I think that regardless of what we do it's going to be a major undertaking, with a lot of issues possibly popping up, however SCons serves us well IMO spending the same amount of work on cleaning up and improving our use of SCons would be a much better use of our time, as suggested here, and I'd argue we'd spend less time and work on doing that than entirely swapping systems, even ignoring fixing bugs popping up down the line due to migrating Not to mention the demand migrating systems places on people working with the buildsystem having to re-learn a different one Having worked with CMake in the past I find SCons beautifully simple to use, even setting up relatively complicated options is pretty smooth, in the past I've had to constantly fight CMake to make it do what I want But to me one of the greatest strengths of SCons is how self contained it is, sure it might not always offer as good solutions as other tools do, but it generally guarantees that it is available where ever you can run it, no pain because you can't find a version of a particular tool or library on some niche distro (or Windows, at all, CMake has been even more of a pain there IMO) tl;dr; Sticking with SCons, and spending work on cleaning it up and improving things, is a safer and more realistic option IMO, it works from a known starting point we know works, meaning we're not stuck a few months after migrating with a breaking issue |
Beta Was this translation helpful? Give feedback.
-
Our current integration of SCons, the build system used by the repo, is built atop a foundation of hacks. The most recent example being godotengine/godot#101726, which applies a fix for a hack (godotengine/godot#98105) which was a fix for a hack (godotengine/godot#91847) which expanded on a workaround (godotengine/godot#79871) for a hack that existed before the repo became open source. This sort of domino-effect integration makes me sympathize with those that are frustrated with this build system, because anyone would be rightfully confused and overwhelmed with this system.
The more I look into SCons' documentation and dig into their codebase, the more I realize that we were never using this tool to its full potential. We have custom platform & module systems and setup that requires manual integration, when SCons has builtin equivalents of both. We bind functions to the main environment, when SCons supports creating a custom class entirely. We parse options for our builds after the environment is already built, when all of that could be pre-processed with either a dummy environment or no environment whatsoever. We have validators and converters for countless variables, but have never once integrated them as native parts of the SCons variables themselves. We haven't just reinvented the wheel, we've Ship-of-Theseus'd the entire build system!
So when people suggest that our current system should be completely redone to something more modern and accessible, I find myself wholeheartedly agreeing with them — SCons should absolutely be uprooted and replaced!
…With SCons! wait what?
Hot take: SCons is a damn good build system & sticking with it is entirely reasonable. But sticking with it as it's currently implemented isn't sustainable long-term. As such, I propose a full refactor of our SCons integration.
Yes, that includes all 170+ SCons-specific scripts.
Yes, that includes all 100+ Python helper scripts.
If that scope sounds absurd… Well, yeah, it is. But this is a bandage that needs to be ripped off eventually, so I'd prefer to be proactive with it. Still, that's a tall order. What kind of benefits could even come from that which wouldn't be feasible with the system as it currently exists? Well:
godot-cpp
has a bit of a head-start on this one, but we can seriously streamline a lot of the logistics of isolating our different platforms and modules by making them be parsed as the SCons-nativeTool
. It'd mean less hacky imports inSConstruct
, as all the environment calls would be with the integrated methods and callbacks. This would perfectly play into the above change, as these systems would not play nice with a baseline environment that is constantly changing its options/arguments mid-construction.BoolVariable
andEnumVariable
, but those are generic cases; we'd be able to make our own generic types or even specialized, per-option types to really consolidate the logic. While technically feasible with the current systems, it'd be extremely painful to try and retrofit onto the existing options, as we'd have to ensure that we aren't breaking backwards compatibility.This is a non-exhaustive list, but I think you get the idea. I'm all aboard with breaking a few hundred eggs for this omlette, but I still wanna hear what other people think. Even if this is pipedream-territory, might as well list out all the nice-to-haves that everyone's sitting on.
For posterity — because talk of build system refactors often cause suggestions for alternatives — let's make it as unambiguous as possible what would be necessary to replace SCons as the build system. From where I sit, it would necessitate:
Beta Was this translation helpful? Give feedback.
All reactions