Add Builder for VintfObject
Clean up the dependencies of VintfObject and use
Builder pattern.
Test: builds
Test: libvintf_test
Test: vintf_object_test
Bug: 118634720
Change-Id: Ia785e150e65ecb403e1b1973f3ac51588244bfbf
diff --git a/check_vintf.cpp b/check_vintf.cpp
index ef54e21..c605053 100644
--- a/check_vintf.cpp
+++ b/check_vintf.cpp
@@ -222,9 +222,11 @@
int checkAllFiles(const std::string& rootdir, const Properties& props, std::string* error) {
auto hostPropertyFetcher = std::make_unique<PresetPropertyFetcher>();
hostPropertyFetcher->setProperties(props);
- VintfObject vintfObject(std::make_unique<HostFileSystem>(rootdir),
- nullptr /* runtime info factory */, std::move(hostPropertyFetcher));
- return vintfObject.checkCompatibility(error, CheckFlags::DISABLE_RUNTIME_INFO);
+ auto vintfObject = VintfObject::Builder()
+ .setFileSystem(std::make_unique<HostFileSystem>(rootdir))
+ .setPropertyFetcher(std::move(hostPropertyFetcher))
+ .build();
+ return vintfObject->checkCompatibility(error, CheckFlags::DISABLE_RUNTIME_INFO);
}
} // namespace details