summaryrefslogtreecommitdiff
path: root/tools/bit/make.h
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/make.h
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/make.h')
-rw-r--r--tools/bit/make.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/tools/bit/make.h b/tools/bit/make.h
index 1c9504d62d46..db0b69f88a0e 100644
--- a/tools/bit/make.h
+++ b/tools/bit/make.h
@@ -31,16 +31,26 @@ struct Module
vector<string> installed;
};
-string get_build_var(const string& name, bool quiet);
-
/**
- * Poke around in the out directory and try to find a device name that matches
- * our product. This is faster than running get_build_var and good enough for
- * tab completion.
- *
- * Returns the empty string if we can't find one.
+ * Class to encapsulate getting build variables. Caches the
+ * results if possible.
*/
-string sniff_device_name(const string& buildOut, const string& product);
+class BuildVars
+{
+public:
+ BuildVars(const string& outDir, const string& buildProduct,
+ const string& buildVariant, const string& buildType);
+ ~BuildVars();
+
+ string GetBuildVar(const string& name, bool quiet);
+
+private:
+ void save();
+
+ string m_filename;
+
+ map<string,string> m_cache;
+};
void read_modules(const string& buildOut, const string& buildDevice,
map<string,Module>* modules, bool quiet);