Open Bug 1337008 Opened 8 years ago Updated 2 years ago

Add something like `OPTIONAL_DIRS` which get processed but not built by default

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(Not tracked)

People

(Reporter: ted, Unassigned)

References

(Blocks 1 open bug)

Details

toolkit/library/gtest/Makefile.in jumps through some hoops to avoid actually building anything by default: https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/toolkit/library/gtest/Makefile.in#12 This is because we need to have the backend.mk generated so we can build the gtest libxul on-demand when a developer runs `mach gtest`, but not during a normal build. While reviewing the patch for bug 1200311 I thought up an idea: something like `OPTIONAL_DIRS` (that's a terrible name) where we read and process the moz.build file, don't add the targets to the list of things to build during the compile tier, but allow building them explicitly. Ideally we'd have a finer-grained way to express this on the targets themselves within a moz.build file, but making it work at a directory level would fix this case.
Revisiting this, I note that this logic is also in toolkit/library/gtest/rust: https://hg.mozilla.org/mozilla-central/file/515407ebfa1433c31144374313bbfd8b942af41c/toolkit/library/gtest/rust/Makefile.in It might make more sense to have this be part of the moz.build itself, so we could do something like: if not CONFIG['LINK_GTEST_DURING_COMPILE']: BUILD_DEFAULT = False in the gtest moz.build files. Then we'd propogate that through the backends, so that those targets wouldn't wind up in the compile dependency graph, but `./mach build toolkit/library/gtest` could still build all the necessary bits. The only case that wouldn't cover that we currently handle is not linking the gtest libxul during the first pass of a PGO build on non-Windows: https://hg.mozilla.org/mozilla-central/file/371e44e0034771ec8a5ac3c5a6518ef608227b99/toolkit/library/gtest/Makefile.in#l11 (We don't build the gtest libxul at all on Windows PGO builds because it takes too long.) We could probably figure out something smarter there if we refactor how the PGO build works. We have some other workarounds hidden in {config,rules}.mk to skip linking some other things like SIMPLE_PROGRAMS anyway. If we fix the PGO build to be better we could codify that stuff in moz.build instead.
Product: Core → Firefox Build System
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.