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

Unified Diff: tools/gn/output_file.cc

Issue 440333002: Support more configurability in GN toolchains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unsigned check Created 6 years, 4 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
« no previous file with comments | « tools/gn/output_file.h ('k') | tools/gn/path_output.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/output_file.cc
diff --git a/tools/gn/output_file.cc b/tools/gn/output_file.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d1fb88e8ee692951c9927856d8574c131743da1e
--- /dev/null
+++ b/tools/gn/output_file.cc
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tools/gn/output_file.h"
+
+#include "tools/gn/filesystem_utils.h"
+#include "tools/gn/source_file.h"
+
+OutputFile::OutputFile() : value_() {
+}
+
+OutputFile::OutputFile(const base::StringPiece& str)
+ : value_(str.data(), str.size()) {
+}
+
+OutputFile::OutputFile(const BuildSettings* build_settings,
+ const SourceFile& source_file)
+ : value_(RebaseSourceAbsolutePath(source_file.value(),
+ build_settings->build_dir())) {
+}
+
+OutputFile::~OutputFile() {
+}
+
+SourceFile OutputFile::AsSourceFile(const BuildSettings* build_settings) const {
+ DCHECK(!value_.empty());
+ DCHECK(value_[value_.size() - 1] != '/');
+ return SourceFile(build_settings->build_dir().value() + value_);
+}
+
+SourceDir OutputFile::AsSourceDir(const BuildSettings* build_settings) const {
+ if (!value_.empty()) {
+ // Empty means the root build dir. Otherwise, we expect it to end in a
+ // slash.
+ DCHECK(value_[value_.size() - 1] == '/');
+ }
+ return SourceDir(build_settings->build_dir().value() + value_);
+}
« no previous file with comments | « tools/gn/output_file.h ('k') | tools/gn/path_output.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698