diff options
author | Steven Moreland <smoreland@google.com> | 2018-02-08 11:49:34 -0800 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2018-02-08 12:00:36 -0800 |
commit | 6d3d3c8b60b56edd309b0366ebd1139ce7f5ae94 (patch) | |
tree | df67e9e4cac7ae377bc495054253c4c35e387f33 /Coordinator.cpp | |
parent | a838ceb6ca908066c6a1d948dda62595c3825802 (diff) | |
download | hidl-6d3d3c8b60b56edd309b0366ebd1139ce7f5ae94.tar.gz |
Coordinator keeps track of output directory.
Previously it was passed around everywhere just to pass it to the
coordinator which was also being passed around everywhere.
This is one stone, here are the birds:
- closer/easier to generate dep files
- code doesn't have to care about passing this around
- we don't worry some code accidentally opens an output file
without being tracked by the coordinator
Bug: 73001417
Test: run_all_host_tests.sh
Change-Id: Idb72e71730a500feecad4a86715115a6f0e2182e
Diffstat (limited to 'Coordinator.cpp')
-rw-r--r-- | Coordinator.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Coordinator.cpp b/Coordinator.cpp index 707e998a..090d80ea 100644 --- a/Coordinator.cpp +++ b/Coordinator.cpp @@ -55,6 +55,10 @@ void Coordinator::setRootPath(const std::string &rootPath) { } } +void Coordinator::setOutputPath(const std::string& outputPath) { + mOutputPath = outputPath; +} + void Coordinator::setVerbose(bool verbose) { mVerbose = verbose; } @@ -92,9 +96,9 @@ void Coordinator::addDefaultPackagePath(const std::string& root, const std::stri addPackagePath(root, path, nullptr /* error */); } -Formatter Coordinator::getFormatter(const std::string& outputPath, const FQName& fqName, - Location location, const std::string& fileName) const { - std::string filepath = getFilepath(outputPath, fqName, location, fileName); +Formatter Coordinator::getFormatter(const FQName& fqName, Location location, + const std::string& fileName) const { + std::string filepath = getFilepath(fqName, location, fileName); onFileAccess(filepath, "w"); @@ -113,9 +117,9 @@ Formatter Coordinator::getFormatter(const std::string& outputPath, const FQName& return Formatter(file); } -std::string Coordinator::getFilepath(const std::string& outputPath, const FQName& fqName, - Location location, const std::string& fileName) const { - std::string path = outputPath; +std::string Coordinator::getFilepath(const FQName& fqName, Location location, + const std::string& fileName) const { + std::string path = mOutputPath; switch (location) { case Location::DIRECT: { /* nothing */ |