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

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

Issue 1752033002: Add "create_bundle" target in order to support bundle with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-bundle-data
Patch Set: Rebase Created 4 years, 9 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 <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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 " \"rc\": Resource compiler (Windows .rc files)\n" 398 " \"rc\": Resource compiler (Windows .rc files)\n"
399 " \"asm\": Assembler\n" 399 " \"asm\": Assembler\n"
400 "\n" 400 "\n"
401 " Linker tools:\n" 401 " Linker tools:\n"
402 " \"alink\": Linker for static libraries (archives)\n" 402 " \"alink\": Linker for static libraries (archives)\n"
403 " \"solink\": Linker for shared libraries\n" 403 " \"solink\": Linker for shared libraries\n"
404 " \"link\": Linker for executables\n" 404 " \"link\": Linker for executables\n"
405 "\n" 405 "\n"
406 " Other tools:\n" 406 " Other tools:\n"
407 " \"stamp\": Tool for creating stamp files\n" 407 " \"stamp\": Tool for creating stamp files\n"
408 " \"copy\": Tool to copy files.\n" 408 " \"copy\": Tool to copy files.\n"
brettw 2016/03/02 21:12:42 The new tools you added, as well as how they work
sdefresne 2016/03/07 20:47:35 Done.
409 "\n" 409 "\n"
410 "Tool variables\n" 410 "Tool variables\n"
411 "\n" 411 "\n"
412 " command [string with substitutions]\n" 412 " command [string with substitutions]\n"
413 " Valid for: all tools (required)\n" 413 " Valid for: all tools (required)\n"
414 "\n" 414 "\n"
415 " The command to run.\n" 415 " The command to run.\n"
416 "\n" 416 "\n"
417 " default_output_extension [string]\n" 417 " default_output_extension [string]\n"
418 " Valid for: linker tools\n" 418 " Valid for: linker tools\n"
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 // tool type. There are different validators for the "outputs" than for the 805 // tool type. There are different validators for the "outputs" than for the
806 // rest of the strings. 806 // rest of the strings.
807 bool (*subst_validator)(SubstitutionType) = nullptr; 807 bool (*subst_validator)(SubstitutionType) = nullptr;
808 bool (*subst_output_validator)(SubstitutionType) = nullptr; 808 bool (*subst_output_validator)(SubstitutionType) = nullptr;
809 if (IsCompilerTool(tool_type)) { 809 if (IsCompilerTool(tool_type)) {
810 subst_validator = &IsValidCompilerSubstitution; 810 subst_validator = &IsValidCompilerSubstitution;
811 subst_output_validator = &IsValidCompilerOutputsSubstitution; 811 subst_output_validator = &IsValidCompilerOutputsSubstitution;
812 } else if (IsLinkerTool(tool_type)) { 812 } else if (IsLinkerTool(tool_type)) {
813 subst_validator = &IsValidLinkerSubstitution; 813 subst_validator = &IsValidLinkerSubstitution;
814 subst_output_validator = &IsValidLinkerOutputsSubstitution; 814 subst_output_validator = &IsValidLinkerOutputsSubstitution;
815 } else if (tool_type == Toolchain::TYPE_COPY) { 815 } else if (tool_type == Toolchain::TYPE_COPY ||
816 tool_type == Toolchain::TYPE_COPY_BUNDLE_DATA) {
816 subst_validator = &IsValidCopySubstitution; 817 subst_validator = &IsValidCopySubstitution;
817 subst_output_validator = &IsValidCopySubstitution; 818 subst_output_validator = &IsValidCopySubstitution;
819 } else if (tool_type == Toolchain::TYPE_COMPILE_XCASSETS) {
820 subst_validator = &IsValidCompileXCassetsSubstitution;
821 subst_output_validator = &IsValidCompileXCassetsSubstitution;
818 } else { 822 } else {
819 subst_validator = &IsValidToolSubstitution; 823 subst_validator = &IsValidToolSubstitution;
820 subst_output_validator = &IsValidToolSubstitution; 824 subst_output_validator = &IsValidToolSubstitution;
821 } 825 }
822 826
823 scoped_ptr<Tool> tool(new Tool); 827 scoped_ptr<Tool> tool(new Tool);
824 828
825 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(), 829 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(),
826 &Tool::set_command, err) || 830 &Tool::set_command, err) ||
827 !ReadOutputExtension(&block_scope, tool.get(), err) || 831 !ReadOutputExtension(&block_scope, tool.get(), err) ||
(...skipping 16 matching lines...) Expand all
844 &Tool::set_output_prefix, err) || 848 &Tool::set_output_prefix, err) ||
845 !ReadPrecompiledHeaderType(&block_scope, tool.get(), err) || 849 !ReadPrecompiledHeaderType(&block_scope, tool.get(), err) ||
846 !ReadBool(&block_scope, "restat", tool.get(), &Tool::set_restat, err) || 850 !ReadBool(&block_scope, "restat", tool.get(), &Tool::set_restat, err) ||
847 !ReadPattern(&block_scope, "rspfile", subst_validator, tool.get(), 851 !ReadPattern(&block_scope, "rspfile", subst_validator, tool.get(),
848 &Tool::set_rspfile, err) || 852 &Tool::set_rspfile, err) ||
849 !ReadPattern(&block_scope, "rspfile_content", subst_validator, tool.get(), 853 !ReadPattern(&block_scope, "rspfile_content", subst_validator, tool.get(),
850 &Tool::set_rspfile_content, err)) { 854 &Tool::set_rspfile_content, err)) {
851 return Value(); 855 return Value();
852 } 856 }
853 857
854 if (tool_type != Toolchain::TYPE_COPY && tool_type != Toolchain::TYPE_STAMP) { 858 if (tool_type != Toolchain::TYPE_COPY &&
859 tool_type != Toolchain::TYPE_STAMP &&
860 tool_type != Toolchain::TYPE_COPY_BUNDLE_DATA &&
861 tool_type != Toolchain::TYPE_COMPILE_XCASSETS) {
855 // All tools except the copy and stamp tools should have outputs. The copy 862 // All tools except the copy and stamp tools should have outputs. The copy
856 // and stamp tool's outputs are generated internally. 863 // and stamp tool's outputs are generated internally.
857 if (!ReadOutputs(&block_scope, function, subst_output_validator, 864 if (!ReadOutputs(&block_scope, function, subst_output_validator,
858 tool.get(), err)) 865 tool.get(), err))
859 return Value(); 866 return Value();
860 } 867 }
861 868
862 // Validate that the link_output, depend_output, and runtime_link_output 869 // Validate that the link_output, depend_output, and runtime_link_output
863 // refer to items in the outputs and aren't defined for irrelevant tool 870 // refer to items in the outputs and aren't defined for irrelevant tool
864 // types. 871 // types.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 return Value(); 993 return Value();
987 994
988 Scope::KeyValueMap values; 995 Scope::KeyValueMap values;
989 block_scope.GetCurrentScopeValues(&values); 996 block_scope.GetCurrentScopeValues(&values);
990 toolchain->args() = values; 997 toolchain->args() = values;
991 998
992 return Value(); 999 return Value();
993 } 1000 }
994 1001
995 } // namespace functions 1002 } // namespace functions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698