-
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
Rebuild only unique dependencies #2318
Comments
Why not simply delete x.o and call |
This isn't convenient in the general case, in a big project with lots of object files, I have no convenient way of determining that I should only delete |
Okay so you have a big project where you "don't know things". But apparently you know that "the tool that generates x.o in a way that doesn't affect anything else". Isn't that information also something you would want to automatically inferred? For example rebuild everything which uses a build rule (e.g. in your example everything that the doc tool touches)? |
If you are suggesting that ninja could detect when build tools change, in effect inferring the undeclared part of the full real actual dependency graph of build inputs (including build tools as well as source code), that would be pretty cool. I don't believe it does this currently, and I thought it would be quite hard to achieve, e.g. if the build tool links to other system libraries that could change but the actual build tool executable doesn't change. What I suggested in this issue seems much easier to implement, since it's entirely in terms of the declared dependency graph. |
Doing this manually, would be an alternative idea that achieves something similar to what this issue describes. But I also think this would be hard, since there could be many different ways to refer to the same build tool in a build rule. A very complex build rule could even dynamically choose the build tool, so that it's not obvious that it's running doxygen but it is. |
A very complex build rule meaning what? The first thing that springs to mind here is Makefile metaprogramming (where the build tool can be selected differently depending on environment variables, the result of running a command on each Ninja doesn't support that sort of thing -- the command line that gets executed by ninja should be the same command line as statically defined when build.ninja is created. |
Ninja supports arbitrary shell commands. Arbitrary shell commands can do things like But this is getting sidetracked and has nothing to do with the actual issue description. |
This is not getting sidetracked at all, it's a direct follow-up for:
However I don't think that the "eval to choose the build tool without telling ninja" case is a reasonable thing for ninja to be concerned enough about that it implements new features. The fact that it's technically possible doesn't mean it's supported. |
If you don't think that is a reasonable thing, then you don't think arbitrary shell commands is a reasonable thing. But ninja already supports arbitrary shell commands, as it should, and as any other general multi-language build system does and should.
I'm not sure what you mean by "technically possible", and arbitrary shell commands are certainly already fully supported. What is the difference between |
That we design ninja's features around the former. |
Note that a command like
The touch will invalidate timestamps on the filesystem, which may be slightly undesirable though for future build queries. The alternative would be to modify Ninja, but the changes are non-trivial, since which commands to run depend on internal state of the build graph that is touched from multiple classes and locations in the source code. Doable, but I don't know if this is worth it (or maybe an opportunity for some light refactor / cleanup?) |
This will break the latter in unforeseeable ways and downgrade it from "technically possible" to "impossible", upon which I and others will no longer have a use for ninja.
As I explained in the OP, the changes are equivalent to calculating set subtraction |
This doesn't work for the reasons explained in the OP and #317. What the feature requires is an easy way to calculate the expression |
Continuing on from #317, sometimes when people do a "rebuild" what they mean is not precisely
make -B
which rebuilds all dependencies, but a narrower form that only rebuilds dependencies that are not reverse-dependencies of other targets. This keeps the effect of the rebuild localised.Example:
I'd like "rebuild
x
" to only cleanx.o
andx
, and noty.o
- nory
later. For example, if I updated the tool that generatesx.o
in a way that I know doesn't affect anything else. It would also be useful for these other scenarios that people hinted upon in #317Slightly more complex example, to demonstrate how the concept generalises into code:
"rebuild
x
y
" would look at the ancestors ofx
ory
and exclude ancestors of other (top-level) targets i.e.z
, the result being to cleany.c
,y.o
,x.c
,x.o
. In general terms you'd only clean/rebuild:where \ means set subtraction. (There is a corner case to figure out what should happen if a non-top-level target is requested.)
Then there is a separate question of how this functionality should be exposed, unresolved from #317, where the functionality can be conceptually decomposed into a clean and build steps. However high-level human usage probably more commonly wants to do the composed functionality, rather than its decompositions separately. (citation = myself)
The text was updated successfully, but these errors were encountered: