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

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: Updated patch set 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
Index: tools/gn/path_output.cc
diff --git a/tools/gn/path_output.cc b/tools/gn/path_output.cc
index de398ec20f74b9894d3062813cff36dcda73454d..2c9c2f3beae556298053bdf002f9052dfe4993c2 100644
--- a/tools/gn/path_output.cc
+++ b/tools/gn/path_output.cc
@@ -4,19 +4,20 @@
#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_ =
+ RebaseSourceAbsolutePath("//", current_dir, source_root);
+ if (!EndsWithSlash(inverse_current_dir_))
brettw 2014/11/05 19:59:49 I would hope that the above operation is always th
zeuthen 2014/11/07 19:24:12 I tried adding a DHCECK() and it fails is in the P
+ inverse_current_dir_.push_back('/');
options_.mode = escaping;
}

Powered by Google App Engine
This is Rietveld 408576698