// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef TOOLS_GN_COMMANDS_H_ #define TOOLS_GN_COMMANDS_H_ #include #include #include #include #include #include "base/values.h" #include "gn/target.h" #include "gn/unique_vector.h" class BuildSettings; class Config; class LabelPattern; class Setup; class SourceFile; class Target; class Toolchain; namespace base { class CommandLine; } // namespace base // Each "Run" command returns the value we should return from main(). namespace commands { using CommandRunner = int (*)(const std::vector&); extern const char kAnalyze[]; extern const char kAnalyze_HelpShort[]; extern const char kAnalyze_Help[]; int RunAnalyze(const std::vector& args); extern const char kArgs[]; extern const char kArgs_HelpShort[]; extern const char kArgs_Help[]; int RunArgs(const std::vector& args); extern const char kCheck[]; extern const char kCheck_HelpShort[]; extern const char kCheck_Help[]; int RunCheck(const std::vector& args); extern const char kClean[]; extern const char kClean_HelpShort[]; extern const char kClean_Help[]; int RunClean(const std::vector& args); extern const char kDesc[]; extern const char kDesc_HelpShort[]; extern const char kDesc_Help[]; int RunDesc(const std::vector& args); extern const char kGen[]; extern const char kGen_HelpShort[]; extern const char kGen_Help[]; int RunGen(const std::vector& args); extern const char kFormat[]; extern const char kFormat_HelpShort[]; extern const char kFormat_Help[]; int RunFormat(const std::vector& args); extern const char kHelp[]; extern const char kHelp_HelpShort[]; extern const char kHelp_Help[]; int RunHelp(const std::vector& args); extern const char kMeta[]; extern const char kMeta_HelpShort[]; extern const char kMeta_Help[]; int RunMeta(const std::vector& args); extern const char kLs[]; extern const char kLs_HelpShort[]; extern const char kLs_Help[]; int RunLs(const std::vector& args); extern const char kOutputs[]; extern const char kOutputs_HelpShort[]; extern const char kOutputs_Help[]; int RunOutputs(const std::vector& args); extern const char kPath[]; extern const char kPath_HelpShort[]; extern const char kPath_Help[]; int RunPath(const std::vector& args); extern const char kRefs[]; extern const char kRefs_HelpShort[]; extern const char kRefs_Help[]; int RunRefs(const std::vector& args); extern const char kCleanStale[]; extern const char kCleanStale_HelpShort[]; extern const char kCleanStale_Help[]; int RunCleanStale(const std::vector& args); // ----------------------------------------------------------------------------- struct CommandInfo { CommandInfo(); CommandInfo(const char* in_help_short, const char* in_help, CommandRunner in_runner); const char* help_short; const char* help; CommandRunner runner; }; using CommandInfoMap = std::map; const CommandInfoMap& GetCommands(); // Command switches as flags and enums ----------------------------------------- // A class that models a set of command-line flags and values that // can affect the output of various GN commands. For example --tree // can be used with `gn desc