Closed AdamNorberg closed 3 years ago
I am all in favor of this idea! I think even though we have some unpushed branches still, this is a good refactor to make regardless, as it ensures keeping the engine and gui strictly separate.
The .csproj files were auto-generated by Godot as we set up the project, and not much thought has been put into them until now. I think now that the project has attained this size it's a good idea to go forth and properly separate the engine and gui also at the .csproj level.
We might even divide up the project into even smaller bits as it grows larger.
Turns out Godot requires this: https://github.com/godotengine/godot-proposals/issues/1575
That's a problem. We can't add a unit test project, or separate our engine from Godot's engine, without being able to do multiple projects. The right answer is probably to go further and divide this into multiple solutions, but that makes the build more complex. That's not avoidable as long as Godot requires there be a project at the top level.
In modern C#, every file adjacent to or under a .csproj file is assumed to be part of that project. The upshot to this is that a "one-project solution" layout like the current one doesn't allow other projects to be easily added. On the branch where I'm trying to get unit tests working, for example, to make the unit test examples not be part of the core binary, I've had to explicitly exclude the "examples" directory: https://github.com/AdamNorberg/anatomy3d/blob/wait_maybe_it_is_easier_than_i_thought/AnatomyProject.csproj
This will only get worse as the project gets more complicated.
Currently, "engine" is library-flavored while "gui" is intended to be a Godot frontend. I think the correct thing to do is:
...and I have no idea how badly that will interfere with Godot's configuration, or how to fix it if it breaks it.
The first thing that occurred to me was to just add another AnatomyProject folder and move everything except the .sln file into it, and update the .sln file to check for the extra layer of directory, but I don't think that's the best layout and such a move would be extremely disruptive. Creating "engine" and "gui" projects, and refining from there, is probably the best approach with the current layout.
Microsoft's full, heavy-duty layout is https://gist.github.com/davidfowl/ed7564297c61fe9ab814 . I prefer to put tests much closer to the code they test, rather than splitting the hierarchy at the very top level, but that's a matter of personal opinion.