summaryrefslogtreecommitdiff
path: root/tools/bit/main.cpp
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2019-01-14 15:30:05 -0800
committerJoe Onorato <joeo@google.com>2019-01-26 09:48:25 -0800
commitce0bd06d174460b69594518e5cf35a85e13b73f8 (patch)
tree41bbda1fbcb89427e7c6313f8b056694fc5ee3b0 /tools/bit/main.cpp
parent08f1ef2d156eed9e3a4f8cd85ef0123f049c16b9 (diff)
[bit] Cache the build variables so we don't have to run make to figure them out unless the environment has changed.
Test: bit GooglePermissionControllerTest:* Change-Id: Ie79226026477df22115ed1146875b82c2255bdef
Diffstat (limited to 'tools/bit/main.cpp')
-rw-r--r--tools/bit/main.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/bit/main.cpp b/tools/bit/main.cpp
index a71cea1c44f9..678af7f1c72b 100644
--- a/tools/bit/main.cpp
+++ b/tools/bit/main.cpp
@@ -623,12 +623,13 @@ run_phases(vector<Target*> targets, const Options& options)
const string buildProduct = get_required_env("TARGET_PRODUCT", false);
const string buildVariant = get_required_env("TARGET_BUILD_VARIANT", false);
const string buildType = get_required_env("TARGET_BUILD_TYPE", false);
-
+ const string buildOut = get_out_dir();
chdir_or_exit(buildTop.c_str());
- const string buildDevice = get_build_var("TARGET_DEVICE", false);
- const string buildId = get_build_var("BUILD_ID", false);
- const string buildOut = get_out_dir();
+ BuildVars buildVars(buildOut, buildProduct, buildVariant, buildType);
+
+ const string buildDevice = buildVars.GetBuildVar("TARGET_DEVICE", false);
+ const string buildId = buildVars.GetBuildVar("BUILD_ID", false);
// Get the modules for the targets
map<string,Module> modules;
@@ -1004,13 +1005,16 @@ run_phases(vector<Target*> targets, const Options& options)
void
run_tab_completion(const string& word)
{
- const string buildTop = get_required_env("ANDROID_BUILD_TOP", true);
+ const string buildTop = get_required_env("ANDROID_BUILD_TOP", false);
const string buildProduct = get_required_env("TARGET_PRODUCT", false);
+ const string buildVariant = get_required_env("TARGET_BUILD_VARIANT", false);
+ const string buildType = get_required_env("TARGET_BUILD_TYPE", false);
const string buildOut = get_out_dir();
-
chdir_or_exit(buildTop.c_str());
- string buildDevice = sniff_device_name(buildOut, buildProduct);
+ BuildVars buildVars(buildOut, buildProduct, buildVariant, buildType);
+
+ string buildDevice = buildVars.GetBuildVar("TARGET_DEVICE", false);
map<string,Module> modules;
read_modules(buildOut, buildDevice, &modules, true);