Speed up m command autocompletion
Generate a all_modules.txt file on every build that
can be used for autocompleting.
Because this adds time to every non-incremental build,
I profiled it by using `$(shell date +"%s.%3N")` before
and after, and disovered it only adds about 0.01 seconds
to the build. And of course it won't be rerun if there
weren't build changes.
Bug: 255867758
Test: Manually
Change-Id: I1d3f1008611fd542884322b27b19ea2fa1d341fe
diff --git a/core/tasks/module-info.mk b/core/tasks/module-info.mk
index dbd1e84..e83d408 100644
--- a/core/tasks/module-info.mk
+++ b/core/tasks/module-info.mk
@@ -41,3 +41,9 @@
$(call dist-for-goals, general-tests, $(MODULE_INFO_JSON))
$(call dist-for-goals, droidcore-unbundled, $(MODULE_INFO_JSON))
+
+# On every build, generate an all_modules.txt file to be used for autocompleting
+# the m command. After timing this using $(shell date +"%s.%3N"), it only adds
+# 0.01 seconds to the internal master build, and will only rerun on builds that
+# rerun kati.
+$(file >$(PRODUCT_OUT)/all_modules.txt,$(subst $(space),$(newline),$(ALL_MODULES)))