hidl-gen: allow specifying root
Also, default root to $ANDROID_BUILD_TOP or pwd if that isn't defined.
Now hidl-gen can be run from anywhere, not just croot.
Test: manual
Change-Id: I8a8ef57612ff4235772fb0a24e543ffd8c7a78c1
Bugs: me
diff --git a/Coordinator.h b/Coordinator.h
index 9f75d46..703ef6f 100644
--- a/Coordinator.h
+++ b/Coordinator.h
@@ -35,10 +35,15 @@
struct Coordinator {
Coordinator(
const std::vector<std::string> &packageRootPaths,
- const std::vector<std::string> &packageRoots);
+ const std::vector<std::string> &packageRoots,
+ const std::string &rootPath);
~Coordinator();
+ const std::string &getRootPath() {
+ return mRootPath;
+ }
+
// Attempts to parse the interface/types referred to by fqName.
// Parsing an interface also parses the associated package's types.hal
// file if it exists.
@@ -107,6 +112,8 @@
std::vector<std::string> mPackageRootPaths;
std::vector<std::string> mPackageRoots;
+ std::string mRootPath;
+
// cache to parse().
std::map<FQName, AST *> mCache;