Index: tools/gn/value_extractors.cc |
diff --git a/tools/gn/value_extractors.cc b/tools/gn/value_extractors.cc |
index 365c5342779c841b79e34337ff6cc4a93c7a1add..ec42e66453a2892f9820cef02ed93ddf8a900379 100644 |
--- a/tools/gn/value_extractors.cc |
+++ b/tools/gn/value_extractors.cc |
@@ -73,6 +73,27 @@ struct RelativeFileConverter { |
const SourceDir& current_dir; |
}; |
+struct LibFileConverter { |
+ LibFileConverter(const BuildSettings* build_settings_in, |
+ const SourceDir& current_dir_in) |
+ : build_settings(build_settings_in), |
+ current_dir(current_dir_in) { |
+ } |
+ bool operator()(const Value& v, LibFile* out, Err* err) const { |
+ if (!v.VerifyTypeIs(Value::STRING, err)) |
+ return false; |
+ if (v.string_value().find('/') == std::string::npos) { |
+ *out = LibFile(v.string_value()); |
+ } else { |
+ *out = LibFile(current_dir.ResolveRelativeFile( |
+ v, err, build_settings->root_path_utf8())); |
+ } |
+ return !err->has_error(); |
+ } |
+ const BuildSettings* build_settings; |
+ const SourceDir& current_dir; |
+}; |
+ |
struct RelativeDirConverter { |
RelativeDirConverter(const BuildSettings* build_settings_in, |
const SourceDir& current_dir_in) |
@@ -147,6 +168,15 @@ bool ExtractListOfRelativeFiles(const BuildSettings* build_settings, |
RelativeFileConverter(build_settings, current_dir)); |
} |
+bool ExtractListOfLibs(const BuildSettings* build_settings, |
+ const Value& value, |
+ const SourceDir& current_dir, |
+ std::vector<LibFile>* libs, |
+ Err* err) { |
+ return ListValueExtractor(value, libs, err, |
+ LibFileConverter(build_settings, current_dir)); |
+} |
+ |
bool ExtractListOfRelativeDirs(const BuildSettings* build_settings, |
const Value& value, |
const SourceDir& current_dir, |