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

Unified Diff: tools/gn/path_output.cc

Issue 630223002: gn: Support build directories outside the source tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch that compiles and passes unit tests on both Windows and Linux Created 6 years, 1 month 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/path_output.h ('k') | tools/gn/path_output_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/path_output.cc
diff --git a/tools/gn/path_output.cc b/tools/gn/path_output.cc
index de398ec20f74b9894d3062813cff36dcda73454d..5b333d8a16f4284803f70a81d0bba8f06cb708a3 100644
--- a/tools/gn/path_output.cc
+++ b/tools/gn/path_output.cc
@@ -4,19 +4,19 @@
#include "tools/gn/path_output.h"
+#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "tools/gn/filesystem_utils.h"
#include "tools/gn/output_file.h"
#include "tools/gn/string_utils.h"
-PathOutput::PathOutput(const SourceDir& current_dir, EscapingMode escaping)
+PathOutput::PathOutput(const SourceDir& current_dir,
+ const base::StringPiece& source_root,
+ EscapingMode escaping)
: current_dir_(current_dir) {
- CHECK(current_dir.is_source_absolute())
- << "Currently this only supports writing to output directories inside "
- "the source root. There needs to be some tweaks to PathOutput to make "
- "doing this work correctly.";
- inverse_current_dir_ = InvertDir(current_dir_);
-
+ inverse_current_dir_ = RebasePath("//", current_dir, source_root);
+ if (!EndsWithSlash(inverse_current_dir_))
+ inverse_current_dir_.push_back('/');
options_.mode = escaping;
}
« no previous file with comments | « tools/gn/path_output.h ('k') | tools/gn/path_output_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698