OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 <set> | 5 #include <set> |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "tools/gn/commands.h" | 9 #include "tools/gn/commands.h" |
10 #include "tools/gn/config.h" | 10 #include "tools/gn/config.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 out->AppendString(name); | 152 out->AppendString(name); |
153 if (tree_) | 153 if (tree_) |
154 FillInConfigVector(out, config.ptr->configs(), indent + 1); | 154 FillInConfigVector(out, config.ptr->configs(), indent + 1); |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 void FillInPrecompiledHeader(base::DictionaryValue* out, | 158 void FillInPrecompiledHeader(base::DictionaryValue* out, |
159 const ConfigValues& values) { | 159 const ConfigValues& values) { |
160 if (what(variables::kPrecompiledHeader) && | 160 if (what(variables::kPrecompiledHeader) && |
161 !values.precompiled_header().empty()) { | 161 !values.precompiled_header().empty()) { |
162 out->Set(variables::kPrecompiledHeader, | 162 out->SetWithoutPathExpansion( |
163 RenderValue(values.precompiled_header(), true)); | 163 variables::kPrecompiledHeader, |
| 164 RenderValue(values.precompiled_header(), true)); |
164 } | 165 } |
165 if (what(variables::kPrecompiledSource) && | 166 if (what(variables::kPrecompiledSource) && |
166 !values.precompiled_source().is_null()) { | 167 !values.precompiled_source().is_null()) { |
167 out->Set(variables::kPrecompiledSource, | 168 out->SetWithoutPathExpansion(variables::kPrecompiledSource, |
168 RenderValue(values.precompiled_source())); | 169 RenderValue(values.precompiled_source())); |
169 } | 170 } |
170 } | 171 } |
171 | 172 |
172 std::set<std::string> what_; | 173 std::set<std::string> what_; |
173 bool all_; | 174 bool all_; |
174 bool tree_; | 175 bool tree_; |
175 bool blame_; | 176 bool blame_; |
176 }; | 177 }; |
177 | 178 |
178 class ConfigDescBuilder : public BaseDescBuilder { | 179 class ConfigDescBuilder : public BaseDescBuilder { |
179 public: | 180 public: |
180 ConfigDescBuilder(const Config* config, const std::set<std::string>& what) | 181 ConfigDescBuilder(const Config* config, const std::set<std::string>& what) |
181 : BaseDescBuilder(what, false, false, false), config_(config) {} | 182 : BaseDescBuilder(what, false, false, false), config_(config) {} |
182 | 183 |
183 std::unique_ptr<base::DictionaryValue> BuildDescription() { | 184 std::unique_ptr<base::DictionaryValue> BuildDescription() { |
184 auto res = base::MakeUnique<base::DictionaryValue>(); | 185 auto res = base::MakeUnique<base::DictionaryValue>(); |
185 const ConfigValues& values = config_->resolved_values(); | 186 const ConfigValues& values = config_->resolved_values(); |
186 | 187 |
187 if (what_.empty()) | 188 if (what_.empty()) |
188 res->SetString( | 189 res->SetStringWithoutPathExpansion( |
189 "toolchain", | 190 "toolchain", |
190 config_->label().GetToolchainLabel().GetUserVisibleName(false)); | 191 config_->label().GetToolchainLabel().GetUserVisibleName(false)); |
191 | 192 |
192 if (what(variables::kConfigs) && !config_->configs().empty()) { | 193 if (what(variables::kConfigs) && !config_->configs().empty()) { |
193 auto configs = base::MakeUnique<base::ListValue>(); | 194 auto configs = base::MakeUnique<base::ListValue>(); |
194 FillInConfigVector(configs.get(), config_->configs().vector()); | 195 FillInConfigVector(configs.get(), config_->configs().vector()); |
195 res->Set(variables::kConfigs, std::move(configs)); | 196 res->SetWithoutPathExpansion(variables::kConfigs, std::move(configs)); |
196 } | 197 } |
197 | 198 |
198 #define CONFIG_VALUE_ARRAY_HANDLER(name, type) \ | 199 #define CONFIG_VALUE_ARRAY_HANDLER(name, type) \ |
199 if (what(#name)) { \ | 200 if (what(#name)) { \ |
200 ValuePtr ptr = \ | 201 ValuePtr ptr = \ |
201 render_config_value_array<type>(values, &ConfigValues::name); \ | 202 render_config_value_array<type>(values, &ConfigValues::name); \ |
202 if (ptr) { \ | 203 if (ptr) { \ |
203 res->Set(#name, std::move(ptr)); \ | 204 res->SetWithoutPathExpansion(#name, std::move(ptr)); \ |
204 } \ | 205 } \ |
205 } | 206 } |
206 CONFIG_VALUE_ARRAY_HANDLER(arflags, std::string) | 207 CONFIG_VALUE_ARRAY_HANDLER(arflags, std::string) |
207 CONFIG_VALUE_ARRAY_HANDLER(asmflags, std::string) | 208 CONFIG_VALUE_ARRAY_HANDLER(asmflags, std::string) |
208 CONFIG_VALUE_ARRAY_HANDLER(cflags, std::string) | 209 CONFIG_VALUE_ARRAY_HANDLER(cflags, std::string) |
209 CONFIG_VALUE_ARRAY_HANDLER(cflags_c, std::string) | 210 CONFIG_VALUE_ARRAY_HANDLER(cflags_c, std::string) |
210 CONFIG_VALUE_ARRAY_HANDLER(cflags_cc, std::string) | 211 CONFIG_VALUE_ARRAY_HANDLER(cflags_cc, std::string) |
211 CONFIG_VALUE_ARRAY_HANDLER(cflags_objc, std::string) | 212 CONFIG_VALUE_ARRAY_HANDLER(cflags_objc, std::string) |
212 CONFIG_VALUE_ARRAY_HANDLER(cflags_objcc, std::string) | 213 CONFIG_VALUE_ARRAY_HANDLER(cflags_objcc, std::string) |
213 CONFIG_VALUE_ARRAY_HANDLER(defines, std::string) | 214 CONFIG_VALUE_ARRAY_HANDLER(defines, std::string) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 bool all, | 252 bool all, |
252 bool tree, | 253 bool tree, |
253 bool blame) | 254 bool blame) |
254 : BaseDescBuilder(what, all, tree, blame), target_(target) {} | 255 : BaseDescBuilder(what, all, tree, blame), target_(target) {} |
255 | 256 |
256 std::unique_ptr<base::DictionaryValue> BuildDescription() { | 257 std::unique_ptr<base::DictionaryValue> BuildDescription() { |
257 auto res = base::MakeUnique<base::DictionaryValue>(); | 258 auto res = base::MakeUnique<base::DictionaryValue>(); |
258 bool is_binary_output = target_->IsBinary(); | 259 bool is_binary_output = target_->IsBinary(); |
259 | 260 |
260 if (what_.empty()) { | 261 if (what_.empty()) { |
261 res->SetString("type", | 262 res->SetStringWithoutPathExpansion( |
262 Target::GetStringForOutputType(target_->output_type())); | 263 "type", |
263 res->SetString( | 264 Target::GetStringForOutputType(target_->output_type())); |
| 265 res->SetStringWithoutPathExpansion( |
264 "toolchain", | 266 "toolchain", |
265 target_->label().GetToolchainLabel().GetUserVisibleName(false)); | 267 target_->label().GetToolchainLabel().GetUserVisibleName(false)); |
266 } | 268 } |
267 | 269 |
268 // General target meta variables. | 270 // General target meta variables. |
269 if (what(variables::kVisibility)) | 271 if (what(variables::kVisibility)) |
270 res->Set(variables::kVisibility, target_->visibility().AsValue()); | 272 res->SetWithoutPathExpansion(variables::kVisibility, |
| 273 target_->visibility().AsValue()); |
271 | 274 |
272 if (what(variables::kTestonly)) | 275 if (what(variables::kTestonly)) |
273 res->SetBoolean(variables::kTestonly, target_->testonly()); | 276 res->SetBooleanWithoutPathExpansion(variables::kTestonly, |
| 277 target_->testonly()); |
274 | 278 |
275 if (is_binary_output) { | 279 if (is_binary_output) { |
276 if (what(variables::kCheckIncludes)) | 280 if (what(variables::kCheckIncludes)) |
277 res->SetBoolean(variables::kCheckIncludes, target_->check_includes()); | 281 res->SetBooleanWithoutPathExpansion(variables::kCheckIncludes, |
| 282 target_->check_includes()); |
278 | 283 |
279 if (what(variables::kAllowCircularIncludesFrom)) { | 284 if (what(variables::kAllowCircularIncludesFrom)) { |
280 auto labels = base::MakeUnique<base::ListValue>(); | 285 auto labels = base::MakeUnique<base::ListValue>(); |
281 for (const auto& cur : target_->allow_circular_includes_from()) | 286 for (const auto& cur : target_->allow_circular_includes_from()) |
282 labels->AppendString(cur.GetUserVisibleName(GetToolchainLabel())); | 287 labels->AppendString(cur.GetUserVisibleName(GetToolchainLabel())); |
283 | 288 |
284 res->Set(variables::kAllowCircularIncludesFrom, std::move(labels)); | 289 res->SetWithoutPathExpansion(variables::kAllowCircularIncludesFrom, |
| 290 std::move(labels)); |
285 } | 291 } |
286 } | 292 } |
287 | 293 |
288 if (what(variables::kSources) && !target_->sources().empty()) | 294 if (what(variables::kSources) && !target_->sources().empty()) |
289 res->Set(variables::kSources, RenderValue(target_->sources())); | 295 res->SetWithoutPathExpansion(variables::kSources, |
| 296 RenderValue(target_->sources())); |
290 | 297 |
291 if (what(variables::kOutputName) && !target_->output_name().empty()) | 298 if (what(variables::kOutputName) && !target_->output_name().empty()) |
292 res->SetString(variables::kOutputName, target_->output_name()); | 299 res->SetStringWithoutPathExpansion(variables::kOutputName, |
| 300 target_->output_name()); |
293 | 301 |
294 if (what(variables::kOutputDir) && !target_->output_dir().is_null()) | 302 if (what(variables::kOutputDir) && !target_->output_dir().is_null()) |
295 res->Set(variables::kOutputDir, RenderValue(target_->output_dir())); | 303 res->SetWithoutPathExpansion(variables::kOutputDir, |
| 304 RenderValue(target_->output_dir())); |
296 | 305 |
297 if (what(variables::kOutputExtension) && target_->output_extension_set()) | 306 if (what(variables::kOutputExtension) && target_->output_extension_set()) |
298 res->SetString(variables::kOutputExtension, target_->output_extension()); | 307 res->SetStringWithoutPathExpansion(variables::kOutputExtension, |
| 308 target_->output_extension()); |
299 | 309 |
300 if (what(variables::kPublic)) { | 310 if (what(variables::kPublic)) { |
301 if (target_->all_headers_public()) | 311 if (target_->all_headers_public()) |
302 res->SetString(variables::kPublic, "*"); | 312 res->SetStringWithoutPathExpansion(variables::kPublic, "*"); |
303 else | 313 else |
304 res->Set(variables::kPublic, RenderValue(target_->public_headers())); | 314 res->SetWithoutPathExpansion(variables::kPublic, |
| 315 RenderValue(target_->public_headers())); |
305 } | 316 } |
306 | 317 |
307 if (what(variables::kInputs) && !target_->inputs().empty()) | 318 if (what(variables::kInputs) && !target_->inputs().empty()) |
308 res->Set(variables::kInputs, RenderValue(target_->inputs())); | 319 res->SetWithoutPathExpansion(variables::kInputs, |
| 320 RenderValue(target_->inputs())); |
309 | 321 |
310 if (is_binary_output && what(variables::kConfigs) && | 322 if (is_binary_output && what(variables::kConfigs) && |
311 !target_->configs().empty()) { | 323 !target_->configs().empty()) { |
312 auto configs = base::MakeUnique<base::ListValue>(); | 324 auto configs = base::MakeUnique<base::ListValue>(); |
313 FillInConfigVector(configs.get(), target_->configs().vector()); | 325 FillInConfigVector(configs.get(), target_->configs().vector()); |
314 res->Set(variables::kConfigs, std::move(configs)); | 326 res->SetWithoutPathExpansion(variables::kConfigs, std::move(configs)); |
315 } | 327 } |
316 | 328 |
317 if (what(variables::kPublicConfigs) && !target_->public_configs().empty()) { | 329 if (what(variables::kPublicConfigs) && !target_->public_configs().empty()) { |
318 auto configs = base::MakeUnique<base::ListValue>(); | 330 auto configs = base::MakeUnique<base::ListValue>(); |
319 FillInConfigVector(configs.get(), target_->public_configs()); | 331 FillInConfigVector(configs.get(), target_->public_configs()); |
320 res->Set(variables::kPublicConfigs, std::move(configs)); | 332 res->SetWithoutPathExpansion(variables::kPublicConfigs, |
| 333 std::move(configs)); |
321 } | 334 } |
322 | 335 |
323 if (what(variables::kAllDependentConfigs) && | 336 if (what(variables::kAllDependentConfigs) && |
324 !target_->all_dependent_configs().empty()) { | 337 !target_->all_dependent_configs().empty()) { |
325 auto configs = base::MakeUnique<base::ListValue>(); | 338 auto configs = base::MakeUnique<base::ListValue>(); |
326 FillInConfigVector(configs.get(), target_->all_dependent_configs()); | 339 FillInConfigVector(configs.get(), target_->all_dependent_configs()); |
327 res->Set(variables::kAllDependentConfigs, std::move(configs)); | 340 res->SetWithoutPathExpansion(variables::kAllDependentConfigs, |
| 341 std::move(configs)); |
328 } | 342 } |
329 | 343 |
330 // Action | 344 // Action |
331 if (target_->output_type() == Target::ACTION || | 345 if (target_->output_type() == Target::ACTION || |
332 target_->output_type() == Target::ACTION_FOREACH) { | 346 target_->output_type() == Target::ACTION_FOREACH) { |
333 if (what(variables::kScript)) | 347 if (what(variables::kScript)) |
334 res->SetString(variables::kScript, | 348 res->SetStringWithoutPathExpansion( |
335 target_->action_values().script().value()); | 349 variables::kScript, |
| 350 target_->action_values().script().value()); |
336 | 351 |
337 if (what(variables::kArgs)) { | 352 if (what(variables::kArgs)) { |
338 auto args = base::MakeUnique<base::ListValue>(); | 353 auto args = base::MakeUnique<base::ListValue>(); |
339 for (const auto& elem : target_->action_values().args().list()) | 354 for (const auto& elem : target_->action_values().args().list()) |
340 args->AppendString(elem.AsString()); | 355 args->AppendString(elem.AsString()); |
341 | 356 |
342 res->Set(variables::kArgs, std::move(args)); | 357 res->SetWithoutPathExpansion(variables::kArgs, std::move(args)); |
343 } | 358 } |
344 if (what(variables::kDepfile) && | 359 if (what(variables::kDepfile) && |
345 !target_->action_values().depfile().empty()) { | 360 !target_->action_values().depfile().empty()) { |
346 res->SetString(variables::kDepfile, | 361 res->SetStringWithoutPathExpansion( |
347 target_->action_values().depfile().AsString()); | 362 variables::kDepfile, |
| 363 target_->action_values().depfile().AsString()); |
348 } | 364 } |
349 } | 365 } |
350 | 366 |
351 if (target_->output_type() != Target::SOURCE_SET && | 367 if (target_->output_type() != Target::SOURCE_SET && |
352 target_->output_type() != Target::GROUP && | 368 target_->output_type() != Target::GROUP && |
353 target_->output_type() != Target::BUNDLE_DATA) { | 369 target_->output_type() != Target::BUNDLE_DATA) { |
354 if (what(variables::kOutputs)) | 370 if (what(variables::kOutputs)) |
355 FillInOutputs(res.get()); | 371 FillInOutputs(res.get()); |
356 } | 372 } |
357 | 373 |
358 // Source outputs are only included when specifically asked for it | 374 // Source outputs are only included when specifically asked for it |
359 if (what_.find("source_outputs") != what_.end()) | 375 if (what_.find("source_outputs") != what_.end()) |
360 FillInSourceOutputs(res.get()); | 376 FillInSourceOutputs(res.get()); |
361 | 377 |
362 if (target_->output_type() == Target::CREATE_BUNDLE && what("bundle_data")) | 378 if (target_->output_type() == Target::CREATE_BUNDLE && what("bundle_data")) |
363 FillInBundle(res.get()); | 379 FillInBundle(res.get()); |
364 | 380 |
365 if (is_binary_output) { | 381 if (is_binary_output) { |
366 #define CONFIG_VALUE_ARRAY_HANDLER(name, type) \ | 382 #define CONFIG_VALUE_ARRAY_HANDLER(name, type) \ |
367 if (what(#name)) { \ | 383 if (what(#name)) { \ |
368 ValuePtr ptr = RenderConfigValues<type>(&ConfigValues::name); \ | 384 ValuePtr ptr = RenderConfigValues<type>(&ConfigValues::name); \ |
369 if (ptr) { \ | 385 if (ptr) { \ |
370 res->Set(#name, std::move(ptr)); \ | 386 res->SetWithoutPathExpansion(#name, std::move(ptr)); \ |
371 } \ | 387 } \ |
372 } | 388 } |
373 CONFIG_VALUE_ARRAY_HANDLER(arflags, std::string) | 389 CONFIG_VALUE_ARRAY_HANDLER(arflags, std::string) |
374 CONFIG_VALUE_ARRAY_HANDLER(asmflags, std::string) | 390 CONFIG_VALUE_ARRAY_HANDLER(asmflags, std::string) |
375 CONFIG_VALUE_ARRAY_HANDLER(cflags, std::string) | 391 CONFIG_VALUE_ARRAY_HANDLER(cflags, std::string) |
376 CONFIG_VALUE_ARRAY_HANDLER(cflags_c, std::string) | 392 CONFIG_VALUE_ARRAY_HANDLER(cflags_c, std::string) |
377 CONFIG_VALUE_ARRAY_HANDLER(cflags_cc, std::string) | 393 CONFIG_VALUE_ARRAY_HANDLER(cflags_cc, std::string) |
378 CONFIG_VALUE_ARRAY_HANDLER(cflags_objc, std::string) | 394 CONFIG_VALUE_ARRAY_HANDLER(cflags_objc, std::string) |
379 CONFIG_VALUE_ARRAY_HANDLER(cflags_objcc, std::string) | 395 CONFIG_VALUE_ARRAY_HANDLER(cflags_objcc, std::string) |
380 CONFIG_VALUE_ARRAY_HANDLER(defines, std::string) | 396 CONFIG_VALUE_ARRAY_HANDLER(defines, std::string) |
381 CONFIG_VALUE_ARRAY_HANDLER(include_dirs, SourceDir) | 397 CONFIG_VALUE_ARRAY_HANDLER(include_dirs, SourceDir) |
382 CONFIG_VALUE_ARRAY_HANDLER(ldflags, std::string) | 398 CONFIG_VALUE_ARRAY_HANDLER(ldflags, std::string) |
383 #undef CONFIG_VALUE_ARRAY_HANDLER | 399 #undef CONFIG_VALUE_ARRAY_HANDLER |
384 | 400 |
385 // Libs and lib_dirs are handled specially below. | 401 // Libs and lib_dirs are handled specially below. |
386 | 402 |
387 FillInPrecompiledHeader(res.get(), target_->config_values()); | 403 FillInPrecompiledHeader(res.get(), target_->config_values()); |
388 } | 404 } |
389 | 405 |
390 if (what(variables::kDeps)) | 406 if (what(variables::kDeps)) |
391 res->Set(variables::kDeps, RenderDeps()); | 407 res->SetWithoutPathExpansion(variables::kDeps, RenderDeps()); |
392 | 408 |
393 // Runtime deps are special, print only when explicitly asked for and not in | 409 // Runtime deps are special, print only when explicitly asked for and not in |
394 // overview mode. | 410 // overview mode. |
395 if (what_.find("runtime_deps") != what_.end()) | 411 if (what_.find("runtime_deps") != what_.end()) |
396 res->Set("runtime_deps", RenderRuntimeDeps()); | 412 res->SetWithoutPathExpansion("runtime_deps", RenderRuntimeDeps()); |
397 | 413 |
398 // libs and lib_dirs are special in that they're inherited. We don't | 414 // libs and lib_dirs are special in that they're inherited. We don't |
399 // currently | 415 // currently |
400 // implement a blame feature for this since the bottom-up inheritance makes | 416 // implement a blame feature for this since the bottom-up inheritance makes |
401 // this difficult. | 417 // this difficult. |
402 | 418 |
403 // Libs can be part of any target and get recursively pushed up the chain, | 419 // Libs can be part of any target and get recursively pushed up the chain, |
404 // so display them regardless of target type. | 420 // so display them regardless of target type. |
405 if (what(variables::kLibs)) { | 421 if (what(variables::kLibs)) { |
406 const OrderedSet<LibFile>& all_libs = target_->all_libs(); | 422 const OrderedSet<LibFile>& all_libs = target_->all_libs(); |
407 if (!all_libs.empty()) { | 423 if (!all_libs.empty()) { |
408 auto libs = base::MakeUnique<base::ListValue>(); | 424 auto libs = base::MakeUnique<base::ListValue>(); |
409 for (size_t i = 0; i < all_libs.size(); i++) | 425 for (size_t i = 0; i < all_libs.size(); i++) |
410 libs->AppendString(all_libs[i].value()); | 426 libs->AppendString(all_libs[i].value()); |
411 res->Set(variables::kLibs, std::move(libs)); | 427 res->SetWithoutPathExpansion(variables::kLibs, std::move(libs)); |
412 } | 428 } |
413 } | 429 } |
414 | 430 |
415 if (what(variables::kLibDirs)) { | 431 if (what(variables::kLibDirs)) { |
416 const OrderedSet<SourceDir>& all_lib_dirs = target_->all_lib_dirs(); | 432 const OrderedSet<SourceDir>& all_lib_dirs = target_->all_lib_dirs(); |
417 if (!all_lib_dirs.empty()) { | 433 if (!all_lib_dirs.empty()) { |
418 auto lib_dirs = base::MakeUnique<base::ListValue>(); | 434 auto lib_dirs = base::MakeUnique<base::ListValue>(); |
419 for (size_t i = 0; i < all_lib_dirs.size(); i++) | 435 for (size_t i = 0; i < all_lib_dirs.size(); i++) |
420 lib_dirs->AppendString(FormatSourceDir(all_lib_dirs[i])); | 436 lib_dirs->AppendString(FormatSourceDir(all_lib_dirs[i])); |
421 res->Set(variables::kLibDirs, std::move(lib_dirs)); | 437 res->SetWithoutPathExpansion(variables::kLibDirs, std::move(lib_dirs)); |
422 } | 438 } |
423 } | 439 } |
424 | 440 |
425 return res; | 441 return res; |
426 } | 442 } |
427 | 443 |
428 private: | 444 private: |
429 // Prints dependencies of the given target (not the target itself). If the | 445 // Prints dependencies of the given target (not the target itself). If the |
430 // set is non-null, new targets encountered will be added to the set, and if | 446 // set is non-null, new targets encountered will be added to the set, and if |
431 // a dependency is in the set already, it will not be recused into. When the | 447 // a dependency is in the set already, it will not be recused into. When the |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 std::vector<OutputFile> outputs; | 553 std::vector<OutputFile> outputs; |
538 Toolchain::ToolType tool_type = Toolchain::TYPE_NONE; | 554 Toolchain::ToolType tool_type = Toolchain::TYPE_NONE; |
539 if (target_->GetOutputFilesForSource(source, &tool_type, &outputs)) { | 555 if (target_->GetOutputFilesForSource(source, &tool_type, &outputs)) { |
540 auto list = base::MakeUnique<base::ListValue>(); | 556 auto list = base::MakeUnique<base::ListValue>(); |
541 for (const auto& output : outputs) | 557 for (const auto& output : outputs) |
542 list->AppendString(output.value()); | 558 list->AppendString(output.value()); |
543 | 559 |
544 dict->SetWithoutPathExpansion(source.value(), std::move(list)); | 560 dict->SetWithoutPathExpansion(source.value(), std::move(list)); |
545 } | 561 } |
546 } | 562 } |
547 res->Set("source_outputs", std::move(dict)); | 563 res->SetWithoutPathExpansion("source_outputs", std::move(dict)); |
548 } | 564 } |
549 | 565 |
550 void FillInBundle(base::DictionaryValue* res) { | 566 void FillInBundle(base::DictionaryValue* res) { |
551 auto data = base::MakeUnique<base::DictionaryValue>(); | 567 auto data = base::MakeUnique<base::DictionaryValue>(); |
552 const BundleData& bundle_data = target_->bundle_data(); | 568 const BundleData& bundle_data = target_->bundle_data(); |
553 const Settings* settings = target_->settings(); | 569 const Settings* settings = target_->settings(); |
554 BundleData::SourceFiles sources; | 570 BundleData::SourceFiles sources; |
555 bundle_data.GetSourceFiles(&sources); | 571 bundle_data.GetSourceFiles(&sources); |
556 data->Set("source_files", RenderValue(sources)); | 572 data->SetWithoutPathExpansion("source_files", RenderValue(sources)); |
557 data->SetString("root_dir_output", | 573 data->SetStringWithoutPathExpansion( |
558 bundle_data.GetBundleRootDirOutput(settings).value()); | 574 "root_dir_output", |
559 data->Set("root_dir", RenderValue(bundle_data.root_dir())); | 575 bundle_data.GetBundleRootDirOutput(settings).value()); |
560 data->Set("resources_dir", RenderValue(bundle_data.resources_dir())); | 576 data->SetWithoutPathExpansion("root_dir", |
561 data->Set("executable_dir", RenderValue(bundle_data.executable_dir())); | 577 RenderValue(bundle_data.root_dir())); |
562 data->Set("plugins_dir", RenderValue(bundle_data.plugins_dir())); | 578 data->SetWithoutPathExpansion("resources_dir", |
563 data->SetString("product_type", bundle_data.product_type()); | 579 RenderValue(bundle_data.resources_dir())); |
| 580 data->SetWithoutPathExpansion("executable_dir", |
| 581 RenderValue(bundle_data.executable_dir())); |
| 582 data->SetWithoutPathExpansion("plugins_dir", |
| 583 RenderValue(bundle_data.plugins_dir())); |
| 584 data->SetStringWithoutPathExpansion("product_type", |
| 585 bundle_data.product_type()); |
564 | 586 |
565 auto deps = base::MakeUnique<base::ListValue>(); | 587 auto deps = base::MakeUnique<base::ListValue>(); |
566 for (const auto* dep : bundle_data.bundle_deps()) | 588 for (const auto* dep : bundle_data.bundle_deps()) |
567 deps->AppendString(dep->label().GetUserVisibleName(GetToolchainLabel())); | 589 deps->AppendString(dep->label().GetUserVisibleName(GetToolchainLabel())); |
568 | 590 |
569 data->Set("deps", std::move(deps)); | 591 data->SetWithoutPathExpansion("deps", std::move(deps)); |
570 res->Set("bundle_data", std::move(data)); | 592 res->SetWithoutPathExpansion("bundle_data", std::move(data)); |
571 } | 593 } |
572 | 594 |
573 void FillInOutputs(base::DictionaryValue* res) { | 595 void FillInOutputs(base::DictionaryValue* res) { |
574 if (target_->output_type() == Target::ACTION) { | 596 if (target_->output_type() == Target::ACTION) { |
575 auto list = base::MakeUnique<base::ListValue>(); | 597 auto list = base::MakeUnique<base::ListValue>(); |
576 for (const auto& elem : target_->action_values().outputs().list()) | 598 for (const auto& elem : target_->action_values().outputs().list()) |
577 list->AppendString(elem.AsString()); | 599 list->AppendString(elem.AsString()); |
578 | 600 |
579 res->Set(variables::kOutputs, std::move(list)); | 601 res->SetWithoutPathExpansion(variables::kOutputs, std::move(list)); |
580 } else if (target_->output_type() == Target::CREATE_BUNDLE) { | 602 } else if (target_->output_type() == Target::CREATE_BUNDLE) { |
581 std::vector<SourceFile> output_files; | 603 std::vector<SourceFile> output_files; |
582 target_->bundle_data().GetOutputsAsSourceFiles(target_->settings(), | 604 target_->bundle_data().GetOutputsAsSourceFiles(target_->settings(), |
583 &output_files); | 605 &output_files); |
584 res->Set(variables::kOutputs, RenderValue(output_files)); | 606 res->SetWithoutPathExpansion(variables::kOutputs, |
| 607 RenderValue(output_files)); |
585 } else if (target_->output_type() == Target::ACTION_FOREACH || | 608 } else if (target_->output_type() == Target::ACTION_FOREACH || |
586 target_->output_type() == Target::COPY_FILES) { | 609 target_->output_type() == Target::COPY_FILES) { |
587 const SubstitutionList& outputs = target_->action_values().outputs(); | 610 const SubstitutionList& outputs = target_->action_values().outputs(); |
588 if (!outputs.required_types().empty()) { | 611 if (!outputs.required_types().empty()) { |
589 auto patterns = base::MakeUnique<base::ListValue>(); | 612 auto patterns = base::MakeUnique<base::ListValue>(); |
590 for (const auto& elem : outputs.list()) | 613 for (const auto& elem : outputs.list()) |
591 patterns->AppendString(elem.AsString()); | 614 patterns->AppendString(elem.AsString()); |
592 | 615 |
593 res->Set("output_patterns", std::move(patterns)); | 616 res->SetWithoutPathExpansion("output_patterns", std::move(patterns)); |
594 } | 617 } |
595 std::vector<SourceFile> output_files; | 618 std::vector<SourceFile> output_files; |
596 SubstitutionWriter::ApplyListToSources(target_->settings(), outputs, | 619 SubstitutionWriter::ApplyListToSources(target_->settings(), outputs, |
597 target_->sources(), &output_files); | 620 target_->sources(), &output_files); |
598 res->Set(variables::kOutputs, RenderValue(output_files)); | 621 res->SetWithoutPathExpansion(variables::kOutputs, |
| 622 RenderValue(output_files)); |
599 } else { | 623 } else { |
600 DCHECK(target_->IsBinary()); | 624 DCHECK(target_->IsBinary()); |
601 const Tool* tool = | 625 const Tool* tool = |
602 target_->toolchain()->GetToolForTargetFinalOutput(target_); | 626 target_->toolchain()->GetToolForTargetFinalOutput(target_); |
603 | 627 |
604 std::vector<OutputFile> output_files; | 628 std::vector<OutputFile> output_files; |
605 SubstitutionWriter::ApplyListToLinkerAsOutputFile( | 629 SubstitutionWriter::ApplyListToLinkerAsOutputFile( |
606 target_, tool, tool->outputs(), &output_files); | 630 target_, tool, tool->outputs(), &output_files); |
607 std::vector<SourceFile> output_files_as_source_file; | 631 std::vector<SourceFile> output_files_as_source_file; |
608 for (const OutputFile& output_file : output_files) | 632 for (const OutputFile& output_file : output_files) |
609 output_files_as_source_file.push_back( | 633 output_files_as_source_file.push_back( |
610 output_file.AsSourceFile(target_->settings()->build_settings())); | 634 output_file.AsSourceFile(target_->settings()->build_settings())); |
611 | 635 |
612 res->Set(variables::kOutputs, RenderValue(output_files_as_source_file)); | 636 res->SetWithoutPathExpansion(variables::kOutputs, |
| 637 RenderValue(output_files_as_source_file)); |
613 } | 638 } |
614 } | 639 } |
615 | 640 |
616 // Writes a given config value type to the string, optionally with | 641 // Writes a given config value type to the string, optionally with |
617 // attribution. | 642 // attribution. |
618 // This should match RecursiveTargetConfigToStream in the order it traverses. | 643 // This should match RecursiveTargetConfigToStream in the order it traverses. |
619 template <class T> | 644 template <class T> |
620 ValuePtr RenderConfigValues(const std::vector<T>& (ConfigValues::*getter)() | 645 ValuePtr RenderConfigValues(const std::vector<T>& (ConfigValues::*getter)() |
621 const) { | 646 const) { |
622 auto res = base::MakeUnique<base::ListValue>(); | 647 auto res = base::MakeUnique<base::ListValue>(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 | 710 |
686 std::unique_ptr<base::DictionaryValue> DescBuilder::DescriptionForConfig( | 711 std::unique_ptr<base::DictionaryValue> DescBuilder::DescriptionForConfig( |
687 const Config* config, | 712 const Config* config, |
688 const std::string& what) { | 713 const std::string& what) { |
689 std::set<std::string> w; | 714 std::set<std::string> w; |
690 if (!what.empty()) | 715 if (!what.empty()) |
691 w.insert(what); | 716 w.insert(what); |
692 ConfigDescBuilder b(config, w); | 717 ConfigDescBuilder b(config, w); |
693 return b.BuildDescription(); | 718 return b.BuildDescription(); |
694 } | 719 } |
OLD | NEW |