Revert "Revert "Add a coverage suffix to avoid Ninja file regene..."
Revert submission 3235973-revert-3207217-emma-flip-time-saver-BYWASVIMTD
Reason for revert: Rolling forward with a fix.
Also add coverage suffix for module-info.mk.
https://android-build.corp.google.com/builds/abtd/run/L52600030005977043 shows the failure: FAILED: ninja: 'out/soong/module-info-sdv_ivi_cf.json', needed by 'out/target/product/sdv_ivi_cf/module-info.json', missing and no known rule to make it
Reverted changes: /q/submissionid:3235973-revert-3207217-emma-flip-time-saver-BYWASVIMTD
Change-Id: I0088fa18bf4d24a1c1d55389bd4a4b952ca2002b
TESTED: https://android-build.corp.google.com/builds/abtd/run/L00600030005992749
Bug: 331444846
diff --git a/core/config.mk b/core/config.mk
index 2f18add..0ecee8a 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -1266,8 +1266,15 @@
# consistency with those defined in BoardConfig.mk files.
include $(BUILD_SYSTEM)/android_soong_config_vars.mk
-SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.$(TARGET_PRODUCT).variables
-SOONG_EXTRA_VARIABLES := $(SOONG_OUT_DIR)/soong.$(TARGET_PRODUCT).extra.variables
+# EMMA_INSTRUMENT is set to true when coverage is enabled. Creates a suffix to
+# differeciate the coverage version of ninja files. This will save 5 minutes of
+# build time used to regenerate ninja.
+ifeq (true,$(EMMA_INSTRUMENT))
+COVERAGE_SUFFIX := .coverage
+endif
+
+SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.$(TARGET_PRODUCT)$(COVERAGE_SUFFIX).variables
+SOONG_EXTRA_VARIABLES := $(SOONG_OUT_DIR)/soong.$(TARGET_PRODUCT)$(COVERAGE_SUFFIX).extra.variables
ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ninja_config.mk