Bug 2058179 - Add a .watchmanconfig to exclude in-tree objdirs from watchman r=firefox-build-system-reviewers,ahochheiden

Without a .watchmanconfig, watchman watches the whole source tree including the
in-tree objdir. Watchman's default ignore_vcs covers .git, but build output is
not covered. On a Linux checkout this accounted for ~9600 extra inotify watches,
and a build's event burst can overflow fs.inotify.max_queued_events (16384 by
default), which forces a watchman recrawl.

A recrawl makes git's core.fsmonitor hook report a fresh instance, which
invalidates git's untracked cache. The next `git status` then calls opendir() on
41713 directories instead of 0, costing roughly 1.2s extra on a 472k-file
checkout.

Both obj*/ and artifacts/ are already gitignored, so suppressing watchman events
for them cannot cause git to miss a change.

ignore_dirs does not support globs, so the entries have to be exact paths: the
default obj-@CONFIG_GUESS@ names produced by mach plus a few common mozconfig
conventions. Developers using another objdir name can add their own, and an
objdir outside the source tree needs no entry at all. The file has to stay
strict JSON, because watchman silently discards the entire config if it contains
comments.

DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D314383
This commit is contained in:
Sylvestre Ledru
2026-07-30 06:33:29 +00:00
committed by sledru@mozilla.com
parent 65fd6cd3dc
commit aefee1489a
2 changed files with 18 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
{
"ignore_dirs": [
"artifacts",
"obj-aarch64-apple-darwin",
"obj-aarch64-unknown-linux-gnu",
"obj-x86_64-apple-darwin",
"obj-x86_64-pc-linux-gnu",
"obj-x86_64-pc-mingw32",
"obj-debug",
"obj-ff-dbg",
"obj-ff-opt",
"obj-opt",
"objdir"
]
}
+3
View File
@@ -41,6 +41,9 @@ with Files(".hgignore"):
with Files(".hgtags"):
BUG_COMPONENT = ("Firefox Build System", "General")
with Files(".watchmanconfig"):
BUG_COMPONENT = ("Firefox Build System", "General")
with Files("docs/**"):
BUG_COMPONENT = ("Developer Infrastructure", "Source Documentation")
SCHEDULES.exclusive = ["docs"]