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

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

Issue 2926013002: Support explicit pools in actions (Closed)
Patch Set: Remove console altogether Created 3 years, 5 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
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/ninja_action_target_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 5 #include <algorithm>
6 #include <limits> 6 #include <limits>
7 #include <utility> 7 #include <utility>
8 8
9 #include "tools/gn/err.h" 9 #include "tools/gn/err.h"
10 #include "tools/gn/functions.h" 10 #include "tools/gn/functions.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 "asm": Assembler 524 "asm": Assembler
525 525
526 Linker tools: 526 Linker tools:
527 "alink": Linker for static libraries (archives) 527 "alink": Linker for static libraries (archives)
528 "solink": Linker for shared libraries 528 "solink": Linker for shared libraries
529 "link": Linker for executables 529 "link": Linker for executables
530 530
531 Other tools: 531 Other tools:
532 "stamp": Tool for creating stamp files 532 "stamp": Tool for creating stamp files
533 "copy": Tool to copy files. 533 "copy": Tool to copy files.
534 "action": Defaults for actions
534 535
535 Platform specific tools: 536 Platform specific tools:
536 "copy_bundle_data": [iOS, OS X] Tool to copy files in a bundle. 537 "copy_bundle_data": [iOS, OS X] Tool to copy files in a bundle.
537 "compile_xcassets": [iOS, OS X] Tool to compile asset catalogs. 538 "compile_xcassets": [iOS, OS X] Tool to compile asset catalogs.
538 539
539 Tool variables 540 Tool variables
540 541
541 command [string with substitutions] 542 command [string with substitutions]
542 Valid for: all tools (required) 543 Valid for: all tools except "action" (required)
543 544
544 The command to run. 545 The command to run.
545 546
546 default_output_dir [string with substitutions] 547 default_output_dir [string with substitutions]
547 Valid for: linker tools 548 Valid for: linker tools
548 549
549 Default directory name for the output file relative to the 550 Default directory name for the output file relative to the
550 root_build_dir. It can contain other substitution patterns. This will 551 root_build_dir. It can contain other substitution patterns. This will
551 be the default value for the {{output_dir}} expansion (discussed below) 552 be the default value for the {{output_dir}} expansion (discussed below)
552 but will be overridden by the "output_dir" variable in a target, if one 553 but will be overridden by the "output_dir" variable in a target, if one
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 Example for a linker tool that produces a .dll and a .lib. The use of 633 Example for a linker tool that produces a .dll and a .lib. The use of
633 {{target_output_name}}, {{output_extension}} and {{output_dir}} allows 634 {{target_output_name}}, {{output_extension}} and {{output_dir}} allows
634 the target to override these values. 635 the target to override these values.
635 outputs = [ 636 outputs = [
636 "{{output_dir}}/{{target_output_name}}" 637 "{{output_dir}}/{{target_output_name}}"
637 "{{output_extension}}", 638 "{{output_extension}}",
638 "{{output_dir}}/{{target_output_name}}.lib", 639 "{{output_dir}}/{{target_output_name}}.lib",
639 ] 640 ]
640 641
641 pool [label, optional] 642 pool [label, optional]
643 Valid for: all tools (optional)
642 644
643 Label of the pool to use for the tool. Pools are used to limit the 645 Label of the pool to use for the tool. Pools are used to limit the
644 number of tasks that can execute concurrently during the build. 646 number of tasks that can execute concurrently during the build.
645 647
646 See also "gn help pool". 648 See also "gn help pool".
647 649
648 link_output [string with substitutions] 650 link_output [string with substitutions]
649 depend_output [string with substitutions] 651 depend_output [string with substitutions]
650 Valid for: "solink" only (optional) 652 Valid for: "solink" only (optional)
651 653
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 704
703 Normally, Ninja will assume that when a tool runs the output be new and 705 Normally, Ninja will assume that when a tool runs the output be new and
704 downstream dependents must be rebuild. When this is set to trye, Ninja 706 downstream dependents must be rebuild. When this is set to trye, Ninja
705 can skip rebuilding downstream dependents for input changes that don't 707 can skip rebuilding downstream dependents for input changes that don't
706 actually affect the output. 708 actually affect the output.
707 709
708 Example: 710 Example:
709 restat = true 711 restat = true
710 712
711 rspfile [string with substitutions] 713 rspfile [string with substitutions]
712 Valid for: all tools (optional) 714 Valid for: all tools except "action" (optional)
713 715
714 Name of the response file. If empty, no response file will be 716 Name of the response file. If empty, no response file will be
715 used. See "rspfile_content". 717 used. See "rspfile_content".
716 718
717 rspfile_content [string with substitutions] 719 rspfile_content [string with substitutions]
718 Valid for: all tools (required when "rspfile" is specified) 720 Valid for: all tools except "action" (required when "rspfile" is used)
719 721
720 The contents to be written to the response file. This may include all 722 The contents to be written to the response file. This may include all
721 or part of the command to send to the tool which allows you to get 723 or part of the command to send to the tool which allows you to get
722 around OS command-line length limits. 724 around OS command-line length limits.
723 725
724 This example adds the inputs and libraries to a response file, but 726 This example adds the inputs and libraries to a response file, but
725 passes the linker flags directly on the command line: 727 passes the linker flags directly on the command line:
726 tool("link") { 728 tool("link") {
727 command = "link -o {{output}} {{ldflags}} @{{output}}.rsp" 729 command = "link -o {{output}} {{ldflags}} @{{output}}.rsp"
728 rspfile = "{{output}}.rsp" 730 rspfile = "{{output}}.rsp"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 !ReadBool(&block_scope, "restat", tool.get(), &Tool::set_restat, err) || 1046 !ReadBool(&block_scope, "restat", tool.get(), &Tool::set_restat, err) ||
1045 !ReadPattern(&block_scope, "rspfile", subst_validator, tool.get(), 1047 !ReadPattern(&block_scope, "rspfile", subst_validator, tool.get(),
1046 &Tool::set_rspfile, err) || 1048 &Tool::set_rspfile, err) ||
1047 !ReadPattern(&block_scope, "rspfile_content", subst_validator, tool.get(), 1049 !ReadPattern(&block_scope, "rspfile_content", subst_validator, tool.get(),
1048 &Tool::set_rspfile_content, err) || 1050 &Tool::set_rspfile_content, err) ||
1049 !ReadLabel(&block_scope, "pool", tool.get(), toolchain->label(), 1051 !ReadLabel(&block_scope, "pool", tool.get(), toolchain->label(),
1050 &Tool::set_pool, err)) { 1052 &Tool::set_pool, err)) {
1051 return Value(); 1053 return Value();
1052 } 1054 }
1053 1055
1054 if (tool_type != Toolchain::TYPE_COPY && 1056 if (tool_type != Toolchain::TYPE_COPY && tool_type != Toolchain::TYPE_STAMP &&
1055 tool_type != Toolchain::TYPE_STAMP &&
1056 tool_type != Toolchain::TYPE_COPY_BUNDLE_DATA && 1057 tool_type != Toolchain::TYPE_COPY_BUNDLE_DATA &&
1057 tool_type != Toolchain::TYPE_COMPILE_XCASSETS) { 1058 tool_type != Toolchain::TYPE_COMPILE_XCASSETS &&
1059 tool_type != Toolchain::TYPE_ACTION) {
1058 // All tools should have outputs, except the copy, stamp, copy_bundle_data 1060 // All tools should have outputs, except the copy, stamp, copy_bundle_data
1059 // and compile_xcassets tools that generate their outputs internally. 1061 // compile_xcassets and action tools that generate their outputs internally.
1060 if (!ReadPatternList(&block_scope, "outputs", subst_output_validator, 1062 if (!ReadPatternList(&block_scope, "outputs", subst_output_validator,
1061 tool.get(), &Tool::set_outputs, err) || 1063 tool.get(), &Tool::set_outputs, err) ||
1062 !ValidateOutputs(tool.get(), err)) 1064 !ValidateOutputs(tool.get(), err))
1063 return Value(); 1065 return Value();
1064 } 1066 }
1065 if (!ValidateRuntimeOutputs(tool.get(), tool_type, err)) 1067 if (!ValidateRuntimeOutputs(tool.get(), tool_type, err))
1066 return Value(); 1068 return Value();
1067 1069
1068 // Validate link_output and depend_output. 1070 // Validate link_output and depend_output.
1069 if (!ValidateLinkAndDependOutput(tool.get(), tool_type, tool->link_output(), 1071 if (!ValidateLinkAndDependOutput(tool.get(), tool_type, tool->link_output(),
(...skipping 11 matching lines...) Expand all
1081 1083
1082 // Make sure there weren't any vars set in this tool that were unused. 1084 // Make sure there weren't any vars set in this tool that were unused.
1083 if (!block_scope.CheckForUnusedVars(err)) 1085 if (!block_scope.CheckForUnusedVars(err))
1084 return Value(); 1086 return Value();
1085 1087
1086 toolchain->SetTool(tool_type, std::move(tool)); 1088 toolchain->SetTool(tool_type, std::move(tool));
1087 return Value(); 1089 return Value();
1088 } 1090 }
1089 1091
1090 } // namespace functions 1092 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/ninja_action_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698