Am I missing something, or (a) wouldn't these inputs be fairly incorrect unless you actually ran `gn check` as part of the generation, and (b) even then, still be kinda incorrect, since GN doesn't implement a full C preprocessor (and can't handle conditionals, etc. correctly)? It seems like it would be easy to both specify dependencies that weren't there (more commonly) and miss dependencies that were (especially for system headers, or dependencies where gn check was disabled)?
On Mon, Dec 1, 2025 at 8:00 PM Dirk Pranke <dpr...@chromium.org> wrote:Am I missing something, or (a) wouldn't these inputs be fairly incorrect unless you actually ran `gn check` as part of the generation, and (b) even then, still be kinda incorrect, since GN doesn't implement a full C preprocessor (and can't handle conditionals, etc. correctly)? It seems like it would be easy to both specify dependencies that weren't there (more commonly) and miss dependencies that were (especially for system headers, or dependencies where gn check was disabled)?
I am not sure to understand what you mean by "fairly incorrect" and "kinda incorrect". Maybe you could provide examples?
The main issue is that with a definition that contains a typo like:
source_set("foo") {
sources = [ "foo.cc", "fooo.h" ],
}
Where foo.cc includes "foo.h", and not "fooo.h", the following happens:
- GN include checks see the #include "foo.h" and then ignores that because this file path is not listed in any target definition. The check passes.
- GN ignores "fooo.h" entirely, it does not check that the file exists (where Bazel would immediately error), and does not write it to the Ninja build plan, so the typo is silently ignored.
If the new feature flag is enabled, then fooo.h is written as an implicit input in the Ninja build plan, and Ninja will error immediately telling you that ihis file does not exist.
This only changes GN's behavior for declared headers (from "public" and "sources").
To unsubscribe from this group and stop receiving emails from it, send an email to gn-dev+un...@chromium.org.
IIRC, remote execution itself does not require "correct" inputs to the build in my sense of the word. While you have to be able to determine every file that is actually needed, it's actually okay (if undesirable) to send files that aren't needed; they will just be ignored.
The actual decision whether to build a target (i.e., whether any of the inputs are out of date) is still done client side by siso, and the list of files sent to the remote endpoint does not directly affect that decision.
Put differently, if a file that siso thinks needs to be sent remotely is out of date but is not actually needed to build the target (as determined by the ninja files and the deps files), that won't cause a rebuild. Is that right?
From what i remember, Siso's preprocessor is used at "ninja" time (to actually help figure out which files to send to the remote endpoint), but it is not used at "gn" time, because GN would have to call out to Siso to do the preprocessing, and that would be so expensive that it wouldn't be worth it (and, of course, GN currently doesn't have the code to anything like that anyway).
I do agree that something like what David is proposing would probably help siso figure out which files don't need to be actually sent over, but that is a different thing from proposing that we actually change the build graph itself. You could achieve something like what you're looking for without requiring that you change the build graph to do so, i.e., what you want is not necessarily David's proposed feature, it could probably be something different but fairly similar.
IIRC, remote execution itself does not require "correct" inputs to the build in my sense of the word. While you have to be able to determine every file that is actually needed, it's actually okay (if undesirable) to send files that aren't needed; they will just be ignored.Ah, so what you meant by "correct" is what II would describe as "minimal" then? It appears I misunderstood what you meant by correct. Remote execution requires inputs to be complete, but not minimal.
The actual decision whether to build a target (i.e., whether any of the inputs are out of date) is still done client side by siso, and the list of files sent to the remote endpoint does not directly affect that decision.The decision is made by siso (sort of). I'm not 100% familiar with siso's implementation, but I suspect the list of files sent to the remote endpoint does affect that decision, as I suspect that's what calculates the input hash, which is used for caching.Put differently, if a file that siso thinks needs to be sent remotely is out of date but is not actually needed to build the target (as determined by the ninja files and the deps files), that won't cause a rebuild. Is that right?I suspect so, @Fumitoshi Ukai can correct me if I'm wrong. Inputs not sent to the remote executor probably don't contribute to the action digest (read: cache key).From what i remember, Siso's preprocessor is used at "ninja" time (to actually help figure out which files to send to the remote endpoint), but it is not used at "gn" time, because GN would have to call out to Siso to do the preprocessing, and that would be so expensive that it wouldn't be worth it (and, of course, GN currently doesn't have the code to anything like that anyway).That's correct, yes (and we have no intent to change this)I do agree that something like what David is proposing would probably help siso figure out which files don't need to be actually sent over, but that is a different thing from proposing that we actually change the build graph itself. You could achieve something like what you're looking for without requiring that you change the build graph to do so, i.e., what you want is not necessarily David's proposed feature, it could probably be something different but fairly similar.Ah, I think I may understand what you're concerned about now. Is your concern that with large targets containing many .cc files, every cc file would have a dependency on every header file any of them depend on, thus triggering a rebuild of every one when only one of them actually depends on it? If that's your concern, I hadn't previously considered that, but it's a valid concern and I can brainstorm some solutions with my team.