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

.csproj shouldn't be at the top level of the repository #23

Closed
AdamNorberg opened this issue May 2, 2021 · 2 comments · Fixed by #26
Closed

.csproj shouldn't be at the top level of the repository #23

AdamNorberg opened this issue May 2, 2021 · 2 comments · Fixed by #26
Assignees
Labels
bug Something isn't working

Comments

@AdamNorberg
Copy link
Collaborator

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:

  1. get rid of AnatomyProject.csproj
  2. Create gui.csproj and engine.csproj
  3. Update AnatomyProject.sln to match

...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.

@AdamNorberg AdamNorberg added the bug Something isn't working label May 2, 2021
@AdamNorberg AdamNorberg self-assigned this May 2, 2021
@AdamNorberg AdamNorberg mentioned this issue May 2, 2021
@Lathreas
Copy link
Collaborator

Lathreas commented May 3, 2021

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.

@Lathreas Lathreas added this to the Demo 1 (proof of concept) milestone May 3, 2021
@AdamNorberg
Copy link
Collaborator Author

Turns out Godot requires this: godotengine/godot-proposals#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.

@AdamNorberg AdamNorberg linked a pull request May 22, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants