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

Unified Diff: tools/gn/command_check.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gn/command_desc.cc » ('j') | tools/gn/command_ls.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_check.cc
diff --git a/tools/gn/command_check.cc b/tools/gn/command_check.cc
index 5d30a09168727b73b444d5fb5d167b3bd55d1e38..73660c9ec7be88e43f62ed63a6637854fcca9ab7 100644
--- a/tools/gn/command_check.cc
+++ b/tools/gn/command_check.cc
@@ -70,15 +70,24 @@ int RunCheck(const std::vector<std::string>& args) {
bool filtered_by_build_config = false;
std::vector<const Target*> targets_to_check;
- if (args.size() == 2) {
- // Compute the target to check.
- if (!ResolveTargetsFromCommandLinePattern(setup, args[1], false,
- &targets_to_check))
+ if (args.size() > 1) {
+ // Compute the targets to check.
+ std::vector<std::string> inputs(args.begin() + 1, args.end());
+ UniqueVector<const Target*> target_matches;
+ UniqueVector<const Config*> config_matches;
+ UniqueVector<const Toolchain*> toolchain_matches;
+ UniqueVector<SourceFile> file_matches;
+ if (!ResolveFromCommandLineInput(setup, inputs, false,
+ &target_matches, &config_matches,
+ &toolchain_matches, &file_matches))
return 1;
- if (targets_to_check.size() == 0) {
+
+ if (target_matches.size() == 0) {
OutputString("No matching targets.\n");
return 1;
}
+ targets_to_check.insert(targets_to_check.begin(),
+ target_matches.begin(), target_matches.end());
} else {
// No argument means to check everything allowed by the filter in
// the build config file.
@@ -132,17 +141,4 @@ bool CheckPublicHeaders(const BuildSettings* build_settings,
return header_errors.empty();
}
-void FilterTargetsByPatterns(const std::vector<const Target*>& input,
- const std::vector<LabelPattern>& filter,
- std::vector<const Target*>* output) {
- for (const auto& target : input) {
- for (const auto& pattern : filter) {
- if (pattern.Matches(target->label())) {
- output->push_back(target);
- break;
- }
- }
- }
-}
-
} // namespace commands
« no previous file with comments | « no previous file | tools/gn/command_desc.cc » ('j') | tools/gn/command_ls.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698