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

Unified Diff: tools/gn/label.cc

Issue 630223002: gn: Support build directories outside the source tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
Index: tools/gn/label.cc
diff --git a/tools/gn/label.cc b/tools/gn/label.cc
index f672a3a23c2f5265f7b50ee63f44b6a3bc04d8b9..957ffddabe72aae4c9cc7697c4e3867898060afb 100644
--- a/tools/gn/label.cc
+++ b/tools/gn/label.cc
@@ -28,6 +28,7 @@ bool ComputeBuildLocationFromDep(const Value& input_value,
const SourceDir& current_dir,
const base::StringPiece& input,
SourceDir* result,
+ const base::FilePath& source_root,
Err* err) {
// No rule, use the current locaton.
if (input.empty()) {
@@ -44,7 +45,7 @@ bool ComputeBuildLocationFromDep(const Value& input_value,
return false;
}
- *result = current_dir.ResolveRelativeDir(input);
+ *result = current_dir.ResolveRelativeDir(input, source_root);
return true;
}
@@ -99,6 +100,7 @@ bool Resolve(const SourceDir& current_dir,
std::string* out_name,
SourceDir* out_toolchain_dir,
std::string* out_toolchain_name,
+ const base::FilePath& source_root,
Err* err) {
// To workaround the problem that StringPiece operator[] doesn't return a ref.
const char* input_str = input.data();
@@ -160,7 +162,7 @@ bool Resolve(const SourceDir& current_dir,
}
if (!ComputeBuildLocationFromDep(original_value, current_dir, location_piece,
- out_dir, err))
+ out_dir, source_root, err))
return false;
if (!ComputeTargetNameFromDep(original_value, *out_dir, name_piece,
@@ -179,7 +181,8 @@ bool Resolve(const SourceDir& current_dir,
} else {
return Resolve(current_dir, current_toolchain,
original_value, toolchain_piece,
- out_toolchain_dir, out_toolchain_name, NULL, NULL, err);
+ out_toolchain_dir, out_toolchain_name, NULL, NULL,
+ source_root, err);
}
}
return true;
@@ -212,6 +215,7 @@ Label::~Label() {
Label Label::Resolve(const SourceDir& current_dir,
const Label& current_toolchain,
const Value& input,
+ const base::FilePath& source_root,
Err* err) {
Label ret;
if (input.type() != Value::STRING) {
@@ -227,7 +231,7 @@ Label Label::Resolve(const SourceDir& current_dir,
if (!::Resolve(current_dir, current_toolchain, input, input_string,
&ret.dir_, &ret.name_,
&ret.toolchain_dir_, &ret.toolchain_name_,
- err))
+ source_root, err))
return Label();
return ret;
}
« tools/gn/filesystem_utils.cc ('K') | « tools/gn/label.h ('k') | tools/gn/label_pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698