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

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

Issue 2198433004: Make get_label_info take into account the toolchain for target_gen_dir (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
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/err.h" 5 #include "tools/gn/err.h"
6 #include "tools/gn/filesystem_utils.h" 6 #include "tools/gn/filesystem_utils.h"
7 #include "tools/gn/functions.h" 7 #include "tools/gn/functions.h"
8 #include "tools/gn/label.h" 8 #include "tools/gn/label.h"
9 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/value.h" 10 #include "tools/gn/value.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 const std::string& what = args[1].string_value(); 110 const std::string& what = args[1].string_value();
111 111
112 Value result(function, Value::STRING); 112 Value result(function, Value::STRING);
113 if (what == "name") { 113 if (what == "name") {
114 result.string_value() = label.name(); 114 result.string_value() = label.name();
115 115
116 } else if (what == "dir") { 116 } else if (what == "dir") {
117 result.string_value() = DirectoryWithNoLastSlash(label.dir()); 117 result.string_value() = DirectoryWithNoLastSlash(label.dir());
118 118
119 } else if (what == "target_gen_dir") { 119 } else if (what == "target_gen_dir") {
120 result.string_value() = DirectoryWithNoLastSlash( 120 result.string_value() = DirectoryWithNoLastSlash(GetSubBuildDirAsSourceDir(
121 GetGenDirForSourceDir(scope->settings(), label.dir())); 121 BuildDirContext(scope, label.GetToolchainLabel()),
brettw 2016/08/01 21:53:54 This is the actual bugfix.
122 label.dir(),
123 BuildDirType::GEN));
122 124
123 } else if (what == "root_gen_dir") { 125 } else if (what == "root_gen_dir") {
124 Label toolchain_label = label.GetToolchainLabel(); 126 result.string_value() = DirectoryWithNoLastSlash(GetBuildDirAsSourceDir(
125 result.string_value() = DirectoryWithNoLastSlash( 127 BuildDirContext(scope, label.GetToolchainLabel()), BuildDirType::GEN));
126 GetToolchainGenDir(scope->settings()->build_settings(),
127 toolchain_label,
128 ToolchainIsDefault(scope, toolchain_label)));
129 128
130 } else if (what == "target_out_dir") { 129 } else if (what == "target_out_dir") {
131 Label toolchain_label = label.GetToolchainLabel(); 130 result.string_value() = DirectoryWithNoLastSlash(GetSubBuildDirAsSourceDir(
132 result.string_value() = DirectoryWithNoLastSlash( 131 BuildDirContext(scope, label.GetToolchainLabel()),
133 GetOutputDirForSourceDir(scope->settings()->build_settings(), 132 label.dir(),
134 label.dir(), toolchain_label, 133 BuildDirType::OBJ));
135 ToolchainIsDefault(scope, toolchain_label)));
136 134
137 } else if (what == "root_out_dir") { 135 } else if (what == "root_out_dir") {
138 Label toolchain_label = label.GetToolchainLabel(); 136 result.string_value() = DirectoryWithNoLastSlash(GetBuildDirAsSourceDir(
139 result.string_value() = DirectoryWithNoLastSlash( 137 BuildDirContext(scope, label.GetToolchainLabel()),
140 GetToolchainOutputDir(scope->settings()->build_settings(), 138 BuildDirType::TOOLCHAIN_ROOT));
141 toolchain_label,
142 ToolchainIsDefault(scope, toolchain_label)));
143 139
144 } else if (what == "toolchain") { 140 } else if (what == "toolchain") {
145 result.string_value() = label.GetToolchainLabel().GetUserVisibleName(false); 141 result.string_value() = label.GetToolchainLabel().GetUserVisibleName(false);
146 142
147 } else if (what == "label_no_toolchain") { 143 } else if (what == "label_no_toolchain") {
148 result.string_value() = 144 result.string_value() =
149 label.GetWithNoToolchain().GetUserVisibleName(false); 145 label.GetWithNoToolchain().GetUserVisibleName(false);
150 146
151 } else if (what == "label_with_toolchain") { 147 } else if (what == "label_with_toolchain") {
152 result.string_value() = label.GetUserVisibleName(true); 148 result.string_value() = label.GetUserVisibleName(true);
153 149
154 } else { 150 } else {
155 *err = Err(args[1], "Unknown value for \"what\" parameter."); 151 *err = Err(args[1], "Unknown value for \"what\" parameter.");
156 return Value(); 152 return Value();
157 } 153 }
158 154
159 return result; 155 return result;
160 } 156 }
161 157
162 } // namespace functions 158 } // namespace functions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698