Bug 1578254 - Trick Make into running rust targets earlier again. r=nalexander a=RyanVM
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 06 Sep 2019 22:58:03 +0000
changeset 555131 9e76d7234a07d91e4ed19b53e9c7f1281bb29dbf
parent 555130 89f6acce40bf2f2fffc3d49f21e219e9e8003123
child 555132 23fb7ac85e3bc7fd327032bfe6c5777273fd49a5
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander, RyanVM
bugs1578254, 1567616
Bug 1578254 - Trick Make into running rust targets earlier again. r=nalexander a=RyanVM One of the things bug 1567616 did was to change how .cargo/config is preprocessed, from it happening during configure to it happening during the build. And to make things happen properly, dependencies were added on the rust targets to ensure the .cargo/config file is created before they run. Unfortunately, that changed the order in which Make would run all the targets while recursing for the compile tier, when the file doesn't exist first. So instead of starting the compile tier with rust targets, it would start with most C++, then do rust... which we know to make builds slower overall because of the need to wait for those rust builds to finish which C++ has all been dealt with already, and lacking parallelism during the rust build. So we force .cargo/config to be generated during export (which it is not already because OBJDIR_PP_FILES are currently dealt with during misc). That makes Make still run the rust targets early during the compile tier. And while here, we extend the if block in recurse.mk that excludes all the top-level recursion dependencies when running from subdirectories. Differential Revision: https://phabricator.services.mozilla.com/D44992
--- a/config/recurse.mk
+++ b/config/recurse.mk
@@ -186,23 +186,31 @@ ifdef ENABLE_CLANG_PLUGIN
 build/clang-plugin/tests/target-objects: build/clang-plugin/host
 # Interdependencies that moz.build world don't know about yet for compilation.
 # Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk)
 toolkit/library/target: widget/gtk/mozgtk/gtk3/target
 # Most things are built during compile (target/host), but some things happen during export
 # Those need to depend on config/export for system wrappers.
 $(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/host: config/export
+# Rust targets need $topobjdir/.cargo/config to be preprocessed first. Ideally,
+# we'd only set it as a dependency of the rust targets, but unfortunately, that
+# pushes Make to execute them much later than we'd like them to be when the file
+# doesn't exist prior to Make running. So we also set it as a dependency of
+# export, which ensures it exists before recursing the rust targets, tricking
+# Make into keeping them early.
 $(rust_targets): $(DEPTH)/.cargo/config
+export:: $(DEPTH)/.cargo/config
 # When building gtest as part of the build (LINK_GTEST_DURING_COMPILE),
 # force the build system to get to it first, so that it can be linked
 # quickly without LTO, allowing the build system to go ahead with
 # plain gkrust and libxul while libxul-gtest is being linked and
 # dump-sym'ed.
 ifneq (,$(filter toolkit/library/gtest/rust/target,$(compile_targets)))
 toolkit/library/rust/target: toolkit/library/gtest/rust/target