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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/output_file.h ('k') | tools/gn/path_output.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "tools/gn/output_file.h"
6
7 #include "tools/gn/filesystem_utils.h"
8 #include "tools/gn/source_file.h"
9
10 OutputFile::OutputFile() : value_() {
11 }
12
13 OutputFile::OutputFile(const base::StringPiece& str)
14 : value_(str.data(), str.size()) {
15 }
16
17 OutputFile::OutputFile(const BuildSettings* build_settings,
18 const SourceFile& source_file)
19 : value_(RebaseSourceAbsolutePath(source_file.value(),
20 build_settings->build_dir())) {
21 }
22
23 OutputFile::~OutputFile() {
24 }
25
26 SourceFile OutputFile::AsSourceFile(const BuildSettings* build_settings) const {
27 DCHECK(!value_.empty());
28 DCHECK(value_[value_.size() - 1] != '/');
29 return SourceFile(build_settings->build_dir().value() + value_);
30 }
31
32 SourceDir OutputFile::AsSourceDir(const BuildSettings* build_settings) const {
33 if (!value_.empty()) {
34 // Empty means the root build dir. Otherwise, we expect it to end in a
35 // slash.
36 DCHECK(value_[value_.size() - 1] == '/');
37 }
38 return SourceDir(build_settings->build_dir().value() + value_);
39 }
OLDNEW
« 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