Lines Matching refs:Tool
14 #include "tools/gn/tool.h"
29 Tool* tool,
30 void (Tool::*set)(bool),
38 (tool->*set)(v->boolean_value());
46 Tool* tool,
47 void (Tool::*set)(const std::string&),
55 (tool->*set)(v->string_value());
80 Tool* tool,
81 void (Tool::*set)(const SubstitutionPattern&),
95 (tool->*set)(pattern);
99 bool ReadOutputExtension(Scope* scope, Tool* tool, Err* err) {
114 tool->set_default_output_extension(value->string_value());
118 bool ReadDepsFormat(Scope* scope, Tool* tool, Err* err) {
126 tool->set_depsformat(Tool::DEPS_GCC);
128 tool->set_depsformat(Tool::DEPS_MSVC);
139 Tool* tool,
143 *err = Err(tool_function, "\"outputs\" must be specified for this tool.");
161 tool->set_outputs(list);
208 " tool()\n"
209 " The tool() function call specifies the commands commands to run for\n"
210 " a given step. See \"gn help tool\".\n"
270 " tool(\"cc\") {\n"
351 // tool ------------------------------------------------------------------------
353 const char kTool[] = "tool";
355 "tool: Specify arguments to a toolchain tool.";
357 "tool: Specify arguments to a toolchain tool.\n"
361 " tool(<tool type>) {\n"
362 " <tool variables...>\n"
365 "Tool types\n"
381 " \"stamp\": Tool for creating stamp files\n"
382 " \"copy\": Tool to copy files.\n"
384 "Tool variables\n"
394 " Extension for the main output of a linkable tool. It includes\n"
410 " If the tool can write \".d\" files, this specifies the name of\n"
447 " An array of names for the output files the tool produces. These\n"
453 " This array just declares to GN what files the tool will\n"
454 " produce. It is your responsibility to specify the tool command\n"
462 " Example for a compiler tool that produces .obj files:\n"
467 " Example for a linker tool that produces a .dll and a .lib. The\n"
483 " tool should be used for linking and dependency tracking. These\n"
511 " Requests that Ninja check the file timestamp after this tool has\n"
512 " run to determine if anything changed. Set this if your tool has\n"
516 " Normally, Ninja will assume that when a tool runs the output\n"
534 " include all or part of the command to send to the tool which\n"
539 " tool(\"link\") {\n"
545 "Expansions for tool variables"
575 " output prefix for the linker tool of \"lib\".\n"
651 " tool if the target does not specify an output extension.\n"
657 " shared libraries (if the solink tool specifies a \"link_output\"\n"
660 " These should generally be treated the same as libs by your tool.\n"
663 " The copy tool allows the common compiler/linker substitutions, plus\n"
664 " {{source}} which is the source of the copy. The stamp tool allows\n"
665 " only the common tool substitutions.\n"
681 " in the linker tool to make this work, so Ninja will detect if the\n"
685 " tool(\"solink\") {\n"
707 " tool(\"cc\") {\n"
712 " tool(\"cxx\") {\n"
729 *err = Err(function->function(), "tool() called outside of toolchain().",
730 "The tool() function can only be used inside a toolchain() "
740 *err = Err(args[0], "Unknown tool type");
744 // Run the tool block.
751 // tool type. There are different validators for the "outputs" than for the
769 scoped_ptr<Tool> tool(new Tool);
771 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(),
772 &Tool::set_command, err) ||
773 !ReadOutputExtension(&block_scope, tool.get(), err) ||
774 !ReadPattern(&block_scope, "depfile", subst_validator, tool.get(),
775 &Tool::set_depfile, err) ||
776 !ReadDepsFormat(&block_scope, tool.get(), err) ||
777 !ReadPattern(&block_scope, "description", subst_validator, tool.get(),
778 &Tool::set_description, err) ||
779 !ReadString(&block_scope, "lib_switch", tool.get(),
780 &Tool::set_lib_switch, err) ||
781 !ReadString(&block_scope, "lib_dir_switch", tool.get(),
782 &Tool::set_lib_dir_switch, err) ||
783 !ReadPattern(&block_scope, "link_output", subst_validator, tool.get(),
784 &Tool::set_link_output, err) ||
785 !ReadPattern(&block_scope, "depend_output", subst_validator, tool.get(),
786 &Tool::set_depend_output, err) ||
787 !ReadString(&block_scope, "output_prefix", tool.get(),
788 &Tool::set_output_prefix, err) ||
789 !ReadBool(&block_scope, "restat", tool.get(), &Tool::set_restat, err) ||
790 !ReadPattern(&block_scope, "rspfile", subst_validator, tool.get(),
791 &Tool::set_rspfile, err) ||
792 !ReadPattern(&block_scope, "rspfile_content", subst_validator, tool.get(),
793 &Tool::set_rspfile_content, err)) {
799 // and stamp tool's outputs are generated internally.
801 tool.get(), err))
806 // outputs and aren't defined for irrelevant tool types.
807 if (!tool->link_output().empty()) {
809 *err = Err(function, "This tool specifies a link_output.",
813 if (!IsPatternInOutputList(tool->outputs(), tool->link_output())) {
814 *err = Err(function, "This tool's link_output is bad.",
819 if (!tool->depend_output().empty()) {
821 *err = Err(function, "This tool specifies a depend_output.",
825 if (!IsPatternInOutputList(tool->outputs(), tool->depend_output())) {
826 *err = Err(function, "This tool's depend_output is bad.",
831 if ((!tool->link_output().empty() && tool->depend_output().empty()) ||
832 (tool->link_output().empty() && !tool->depend_output().empty())) {
838 // Make sure there weren't any vars set in this tool that were unused.
842 toolchain->SetTool(tool_type, tool.Pass());