aboutsummaryrefslogtreecommitdiff
path: root/envsetup.sh
diff options
context:
space:
mode:
authorCole Faust <colefaust@google.com>2022-10-26 18:16:44 -0700
committerCole Faust <colefaust@google.com>2022-10-28 10:44:02 -0700
commit5d825b7a6891609dea4fc3a839c3437951d59541 (patch)
treec6bacae196e5dd2e34092c830b94540863da6737 /envsetup.sh
parent65540981950216ad097910fed57738fa463bb751 (diff)
downloadbuild-5d825b7a6891609dea4fc3a839c3437951d59541.tar.gz
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
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/envsetup.sh b/envsetup.sh
index 3674a4a99e..4c1aeaac60 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1551,12 +1551,10 @@ function verifymodinfo() {
fi
}
-# List all modules for the current device, as cached in module-info.json. If any build change is
-# made and it should be reflected in the output, you should run 'refreshmod' first.
+# List all modules for the current device, as cached in all_modules.txt. If any build change is
+# made and it should be reflected in the output, you should run `m nothing` first.
function allmod() {
- verifymodinfo || return 1
-
- python3 -c "import json; print('\n'.join(sorted(json.load(open('$ANDROID_PRODUCT_OUT/module-info.json')).keys())))"
+ cat $ANDROID_PRODUCT_OUT/all_modules.txt 2>/dev/null
}
# Return the Bazel label of a Soong module if it is converted with bp2build.
@@ -1735,7 +1733,7 @@ function installmod() {
function _complete_android_module_names() {
local word=${COMP_WORDS[COMP_CWORD]}
- COMPREPLY=( $(QUIET_VERIFYMODINFO=true allmod | grep -E "^$word") )
+ COMPREPLY=( $(allmod | grep -E "^$word") )
}
# Print colored exit condition