@anthony-nicholls thank you so much for your thoughtful comments, And I’m happy to see you’re working on this and that we’re generally in agreement!
I just wanted to comment on a couple of things:
I totally agree that splitting juce_gui_basics is a good idea for a variety of reasons, and I specifically have an FR for that:
I will say that I’d make this a separate task. First split the module, then do the include stuff. I think even though the two have some correlation they’re not really related.
CLion is not a good candidate for checking this, as even though it’s my personal favorite IDE, it’s also a very smart IDE that knows how to parse the build system until it completes the code model.
The problem scope would be much better tested/defined in VSCode and Visual Studio.
I really don’t see how that’s different from the situation today. You need to make juce_gui_basics.cpp compile and includes for juce_gui_basics.h work.
People including internal headers can happen today too. I’m not sure why adding includes would change that, it doesn’t present any API change.
I also want to stress out that having headers or cpp files including other headers is how every codebase in the world works. I don’t see why JUCE has more refactoring burden because they add includes to files.
I kinda feel like this an argument just for argument’s sake and not a real issue that ever presented itself. In real life, if following a refactor juce_Component.h now needs to include juce_String.h in order to be correct this is a part of the refactoring task anyway, doesn’t matter which file you had to add the include to.
Removing a file/function from a public header or just changing the file structure of public API files would indeed lead to breakage but that again has nothing to do with adding includes…
I’m having a real hard time imagining a scenario where #include your code dependencies has ever caused problem in refactoring.
I agree, that one is indeed the ‘annoying’ part of the work that’s required. I just meant that high level refactoring like splitting juce_gui_basics into smaller modules or creating a new JUCE build system is not required.
By no means, I’m not saying it’s something urgent that you have to stop what you’re doing for. But I’m also using CLion where things generally works. If you’ll talk to people using VS Code you’ll get different answers on this topic.
Have you ever found a popular codebase that tests for this? My guess is not.
Most codebases I’ve seen just add includes, test that the code compiles and works using the presented build system, and run unit tests on all the different supported APIs.
Once you will remove the global module include, your ‘unit test’ for this would be that the code will not compile if you have a a severe include problem. A minor include problem may still occur, but it would be rare.
I also think that the challenge of unit testing this, as well as maintaining the unit test with JUCE changes is EXTREMELY complicated and non-trivial.
This is something you’re suggesting that will make it very hard for you to refactor, since every change will need to be tested in two different build systems, and not just one, and for very little gain since the compiler will catch all the big problems anyway.
