Incremental Builds in GYP?

Skip to first unread message

Kelvin Jin

Apr 12, 2019, 8:15:59 PM4/12/19
to gyp-developer
Hi all,

I was wondering what the general criteria is for having incremental builds in GYP? I've looked through GYP and Ninja docs and can't find much information on it.

For context, I have an auto-generated GYP file which is created from a GN file (the file will probably change significantly over the next few days; I'm doing some experiments). Whenever I re-build w/o source changes there seems to be a lot of re-compilation (or linking?) that takes up a lot of time. Compare with the rest of Node.js which is also built with GYP, and re-builds almost instantaneously when sources haven't changed.



Dirk Pranke

Apr 12, 2019, 8:27:57 PM4/12/19
to Kelvin Jin, gyp-developer
Generally speaking, incremental builds should work fine, and if you're seeing too much stuff rebuilding, you probably have incorrect dependencies somewhere. `ninja -d explain` can tell you why it thinks things need to be rebuilt, so I would look at that output and see if it's getting confused somewhere.

I didn't look specifically at your example, though, so I can't help you with that.

-- Dirk


You received this message because you are subscribed to the Google Groups "gyp-developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Refael Ackermann

Apr 12, 2019, 8:31:24 PM4/12/19
to Dirk Pranke, Kelvin Jin, gyp-developer
All the "incremental" work is done by the build tool (i.e. `make` or `ninja`).
There are two known pitfalls for failing minimal rebuilds:
2. using make to run actions with multiple outputs.

I'll try to give your sample a look during the weekend, see if I can spot any low hanging fruit.

Also feel free to post bug or feature request at

Kelvin Jin

Apr 15, 2019, 2:55:12 PM4/15/19
to Refael Ackermann, Dirk Pranke, gyp-developer
Hi Refael -- thanks for the pointers and combing through the build file. I was under the impression that somewhere along the build, something would take care of not running actions if outputs were modified more recently than inputs (or something along those lines), but that doesn't seem to be the case. That assumption was based on V8's Torque, but I found out just now that Torque only overwrites generated files if they don't exactly match the existing file, leaving existing files alone -- which would explain how V8 can be re-built quickly even though it has a significant number of generated output sources. I'll see what I can do to have something similar for the Perfetto generated outputs.

Thanks all for the help,

Reply all
Reply to author
0 new messages