OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/scope_per_file_provider.h" | 5 #include "tools/gn/scope_per_file_provider.h" |
6 | 6 |
7 #include "tools/gn/filesystem_utils.h" | 7 #include "tools/gn/filesystem_utils.h" |
8 #include "tools/gn/settings.h" | 8 #include "tools/gn/settings.h" |
9 #include "tools/gn/source_file.h" | 9 #include "tools/gn/source_file.h" |
10 #include "tools/gn/toolchain_manager.h" | 10 #include "tools/gn/toolchain_manager.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 if (ident == variables::kTargetGenDir) | 36 if (ident == variables::kTargetGenDir) |
37 return GetTargetGenDir(); | 37 return GetTargetGenDir(); |
38 if (ident == variables::kTargetOutDir) | 38 if (ident == variables::kTargetOutDir) |
39 return GetTargetOutDir(); | 39 return GetTargetOutDir(); |
40 return NULL; | 40 return NULL; |
41 } | 41 } |
42 | 42 |
43 const Value* ScopePerFileProvider::GetCurrentToolchain() { | 43 const Value* ScopePerFileProvider::GetCurrentToolchain() { |
44 if (!current_toolchain_) { | 44 if (!current_toolchain_) { |
45 current_toolchain_.reset(new Value(NULL, | 45 current_toolchain_.reset(new Value(NULL, |
46 scope_->settings()->toolchain()->label().GetUserVisibleName(false))); | 46 scope_->settings()->toolchain_label().GetUserVisibleName(false))); |
47 } | 47 } |
48 return current_toolchain_.get(); | 48 return current_toolchain_.get(); |
49 } | 49 } |
50 | 50 |
51 const Value* ScopePerFileProvider::GetDefaultToolchain() { | 51 const Value* ScopePerFileProvider::GetDefaultToolchain() { |
52 if (!default_toolchain_) { | 52 if (!default_toolchain_) { |
53 const ToolchainManager& toolchain_manager = | 53 const ToolchainManager& toolchain_manager = |
54 scope_->settings()->build_settings()->toolchain_manager(); | 54 scope_->settings()->build_settings()->toolchain_manager(); |
55 default_toolchain_.reset(new Value(NULL, | 55 default_toolchain_.reset(new Value(NULL, |
56 toolchain_manager.GetDefaultToolchainUnlocked().GetUserVisibleName( | 56 toolchain_manager.GetDefaultToolchainUnlocked().GetUserVisibleName( |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 const std::string& dir_value = scope_->GetSourceDir().value(); | 155 const std::string& dir_value = scope_->GetSourceDir().value(); |
156 | 156 |
157 if (dir_value == "//") | 157 if (dir_value == "//") |
158 return "//."; | 158 return "//."; |
159 | 159 |
160 // Trim off a leading and trailing slash. So "//foo/bar/" -> /foo/bar". | 160 // Trim off a leading and trailing slash. So "//foo/bar/" -> /foo/bar". |
161 DCHECK(dir_value.size() > 2 && dir_value[0] == '/' && | 161 DCHECK(dir_value.size() > 2 && dir_value[0] == '/' && |
162 dir_value[dir_value.size() - 1] == '/'); | 162 dir_value[dir_value.size() - 1] == '/'); |
163 return dir_value.substr(1, dir_value.size() - 2); | 163 return dir_value.substr(1, dir_value.size() - 2); |
164 } | 164 } |
OLD | NEW |