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

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

Issue 2363193002: Use WithoutPathExpansion on DictionaryValue in GN. (Closed)
Patch Set: Created 4 years, 2 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 (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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 if (args.size() == 3) 455 if (args.size() == 3)
456 what_to_print = args[2]; 456 what_to_print = args[2];
457 457
458 bool json = cmdline->GetSwitchValueASCII("format") == "json"; 458 bool json = cmdline->GetSwitchValueASCII("format") == "json";
459 459
460 if (json) { 460 if (json) {
461 // Convert all targets/configs to JSON, serialize and print them 461 // Convert all targets/configs to JSON, serialize and print them
462 auto res = base::MakeUnique<base::DictionaryValue>(); 462 auto res = base::MakeUnique<base::DictionaryValue>();
463 if (!target_matches.empty()) { 463 if (!target_matches.empty()) {
464 for (const auto* target : target_matches) { 464 for (const auto* target : target_matches) {
465 res->Set(target->label().GetUserVisibleName( 465 res->SetWithoutPathExpansion(
466 target->settings()->default_toolchain_label()), 466 target->label().GetUserVisibleName(
467 DescBuilder::DescriptionForTarget( 467 target->settings()->default_toolchain_label()),
468 target, what_to_print, cmdline->HasSwitch(kAll), 468 DescBuilder::DescriptionForTarget(
469 cmdline->HasSwitch(kTree), cmdline->HasSwitch(kBlame))); 469 target, what_to_print, cmdline->HasSwitch(kAll),
470 cmdline->HasSwitch(kTree), cmdline->HasSwitch(kBlame)));
470 } 471 }
471 } else if (!config_matches.empty()) { 472 } else if (!config_matches.empty()) {
472 for (const auto* config : config_matches) { 473 for (const auto* config : config_matches) {
473 res->Set(config->label().GetUserVisibleName(false), 474 res->SetWithoutPathExpansion(
474 DescBuilder::DescriptionForConfig(config, what_to_print)); 475 config->label().GetUserVisibleName(false),
476 DescBuilder::DescriptionForConfig(config, what_to_print));
475 } 477 }
476 } 478 }
477 std::string s; 479 std::string s;
478 base::JSONWriter::WriteWithOptions( 480 base::JSONWriter::WriteWithOptions(
479 *res.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &s); 481 *res.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &s);
480 OutputString(s); 482 OutputString(s);
481 } else { 483 } else {
482 // Regular (non-json) formatted output 484 // Regular (non-json) formatted output
483 bool multiple_outputs = (target_matches.size() + config_matches.size()) > 1; 485 bool multiple_outputs = (target_matches.size() + config_matches.size()) > 1;
484 486
(...skipping 15 matching lines...) Expand all
500 502
501 if (!PrintConfig(config, what_to_print, !multiple_outputs)) 503 if (!PrintConfig(config, what_to_print, !multiple_outputs))
502 return 1; 504 return 1;
503 } 505 }
504 } 506 }
505 507
506 return 0; 508 return 0;
507 } 509 }
508 510
509 } // namespace commands 511 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/analyzer.cc ('k') | tools/gn/desc_builder.cc » ('j') | tools/gn/json_project_writer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698