Update BCP computation to use derive_classpath
We now dynamically compute the classpath during startup so we need to
invoke the 'derive_classpath' program that does this during OTA to
compile everything correctly.
Test: manual OTA on blueline
Bug: 186432034
Change-Id: Iaac6718d8347c671241fbdf08ff79b0a608ad000
diff --git a/cmds/installd/file_parsing.h b/cmds/installd/file_parsing.h
index 3e2f815..88801ca 100644
--- a/cmds/installd/file_parsing.h
+++ b/cmds/installd/file_parsing.h
@@ -19,18 +19,14 @@
#include <fstream>
#include <functional>
-#include <string>
+#include <string_view>
+#include "android-base/unique_fd.h"
namespace android {
namespace installd {
-bool ParseFile(const std::string& strFile, std::function<bool (const std::string&)> parse) {
- std::ifstream input_stream(strFile);
-
- if (!input_stream.is_open()) {
- return false;
- }
-
+template<typename Func>
+bool ParseFile(std::istream& input_stream, Func parse) {
while (!input_stream.eof()) {
// Read the next line.
std::string line;
@@ -54,6 +50,15 @@
return true;
}
+template<typename Func>
+bool ParseFile(std::string_view str_file, Func parse) {
+ std::ifstream ifs(str_file);
+ if (!ifs.is_open()) {
+ return false;
+ }
+ return ParseFile(ifs, parse);
+}
+
} // namespace installd
} // namespace android