Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: tools/gn/value_extractors.cc

Issue 1530183005: Special-case paths that appear in libs by not prefixing them with -l. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in previous patch Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/value_extractors.h ('k') | tools/gn/variables.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « tools/gn/value_extractors.h ('k') | tools/gn/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698