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

Side by Side Diff: tools/gn/output_file.cc

Issue 937003002: Enhance GN introspection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« tools/gn/commands.cc ('K') | « tools/gn/label_pattern.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/output_file.h" 5 #include "tools/gn/output_file.h"
6 6
7 #include "tools/gn/filesystem_utils.h" 7 #include "tools/gn/filesystem_utils.h"
8 #include "tools/gn/source_file.h" 8 #include "tools/gn/source_file.h"
9 9
10 OutputFile::OutputFile() : value_() { 10 OutputFile::OutputFile() : value_() {
11 } 11 }
12 12
13 OutputFile::OutputFile(const base::StringPiece& str) 13 OutputFile::OutputFile(const base::StringPiece& str)
14 : value_(str.data(), str.size()) { 14 : value_(str.data(), str.size()) {
15 } 15 }
16 16
17 OutputFile::OutputFile(const BuildSettings* build_settings, 17 OutputFile::OutputFile(const BuildSettings* build_settings,
18 const SourceFile& source_file) 18 const SourceFile& source_file)
19 : value_(RebasePath(source_file.value(), 19 : value_(RebasePath(source_file.value(),
20 build_settings->build_dir(), 20 build_settings->build_dir(),
21 build_settings->root_path_utf8())) { 21 build_settings->root_path_utf8())) {
22 } 22 }
23 23
24 OutputFile::~OutputFile() { 24 OutputFile::~OutputFile() {
25 } 25 }
26 26
27 SourceFile OutputFile::AsSourceFile(const BuildSettings* build_settings) const { 27 SourceFile OutputFile::AsSourceFile(const BuildSettings* build_settings) const {
28 DCHECK(!value_.empty()); 28 DCHECK(!value_.empty());
29 DCHECK(value_[value_.size() - 1] != '/'); 29 DCHECK(value_[value_.size() - 1] != '/');
30 return SourceFile(build_settings->build_dir().value() + value_); 30
31 std::string path = build_settings->build_dir().value();
32 path.append(value_);
33 NormalizePath(&path);
34 return SourceFile(path);
31 } 35 }
32 36
33 SourceDir OutputFile::AsSourceDir(const BuildSettings* build_settings) const { 37 SourceDir OutputFile::AsSourceDir(const BuildSettings* build_settings) const {
34 if (!value_.empty()) { 38 if (!value_.empty()) {
35 // Empty means the root build dir. Otherwise, we expect it to end in a 39 // Empty means the root build dir. Otherwise, we expect it to end in a
36 // slash. 40 // slash.
37 DCHECK(value_[value_.size() - 1] == '/'); 41 DCHECK(value_[value_.size() - 1] == '/');
38 } 42 }
39 return SourceDir(build_settings->build_dir().value() + value_); 43 std::string path = build_settings->build_dir().value();
44 path.append(value_);
45 NormalizePath(&path);
46 return SourceDir(path);
40 } 47 }
OLDNEW
« tools/gn/commands.cc ('K') | « tools/gn/label_pattern.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698