-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Separate headers from source files #12764
Conversation
25a1909
to
923e0e8
Compare
1e0108a
to
b6cb4be
Compare
2cda96e
to
f930f15
Compare
Glad that the symlinks aren't committed. my earlier misreadI don't think the symlinks are a good idea, because it opens up more opportunities for various tools and editors, as well as users to get confused. Furthermore I believe in practice this isn't as useful as it seems.
Also I've seen instances of symlink contents appearing as "distinct" files while they are not, e.g. allowing both the canonical and non-canonical paths to have an editor buffer simultaneously, leading to conflicts if the user isn't paying attention to that. Obviously that's an editor bug, but this is the kind of problem we're opening ourselves up to by inviting in more symlinks. And that's assuming the bug is in the tooling. Humans also have to make sense of it. |
f930f15
to
31b2417
Compare
Looks like an interaction with #12773.
|
31b2417
to
385be10
Compare
Note: we really shouldn't have backport labels on a PR that changes 666 files. Code restructurings like this are inappropriate for the maintenance branches. |
What's the impact of this on IDEs, i.e. can editors still follow a line like
to the corresponding file in the Git repo? Also, shouldn't the subdirectory of the component be included, e.g.
? |
385be10
to
fd716fa
Compare
I don't know, but see the symlink script that is included. With that, your workflow should be exactly the same as before, |
I was starting more minimally, but if you prefer that, I'm happy to jump all the way to that. Just one thing, I would do #include "nix/store/machines.hh" I don't think the |
Actually, because the per-project dirs is a less mechanical change, I would rather do it in a follow-up please. Happy to make it right-away, however. |
@Ericson2314 btw. I refactored the python script a bit but you seemed to have pushed over this change again: b6cb4be |
b6cb4be
to
fd716fa
Compare
fd716fa
to
c8eed31
Compare
- Since it's now private, give it a rename. Note that I want to switch the word order on the public ones too. - Since it is only needed by two files, just include there rather than the nasty blanket-forced thing.
The short answer for why we need to do this is so we can consistently do `#include "nix/..."`. Without this change, there are ways to still make that work, but they are hacky, and they have downsides such as making it harder to make sure headers from the wrong Nix library (e..g. `libnixexpr` headers in `libnixutil`) aren't being used. The C API alraedy used `nix_api_*`, so its headers are *not* put in subdirectories accordingly. Progress on #7876 We resisted doing this for a while because it would be annoying to not have the header source file pairs close by / easy to change file path/name from one to the other. But I am ameliorating that with symlinks in the next commit.
c8eed31
to
f3e1c47
Compare
OK this no longer includes the symlink script --- the plan is that @Mic92 will make that in a separate PR (he is working on it right now). |
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 5a8dedc |
As to #include "nix/store/machines.hh" I think we should do that, but that should also be in a separate PR, since it is a bit less mechanical than this, as I said above. |
…2764 Separate headers from source files (backport #12764)
Motivation
The short answer for why we need to do this is so we can consistently do
#include "nix/..."
. Without this change, there are ways to still make that work, but they are hacky, and they have downsides such as making it harder to make sure headers from the wrong Nix library (e..g.libnixexpr
headers inlibnixutil
) aren't being used.The C API alraedy used
nix_api_*
, so its headers are not put in subdirectories accordingly.See comments on the script; this is supposed to avoid breaking muscle memory without complicating the build system (which proved harder than I thought too) or not doing the header hygiene change at all.
Context
Progress on #7876
We resisted doing this for a while because it would be annoying to not have the header source file pairs close by / easy to change file path/name from one to the other. But I am ameliorating that with symlinks in the final commit.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.