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

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

Issue 1606553002: Add support for Mac/iOS application bundles to GN tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit tests & support for bundle_data_filter Created 4 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 unified diff | Download patch
« no previous file with comments | « tools/gn/function_forward_variables_from.cc ('k') | tools/gn/functions.h » ('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 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/02/02 23:28:38 Please also add your new tool here and check if th
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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 // tool type. There are different validators for the "outputs" than for the 802 // tool type. There are different validators for the "outputs" than for the
803 // rest of the strings. 803 // rest of the strings.
804 bool (*subst_validator)(SubstitutionType) = nullptr; 804 bool (*subst_validator)(SubstitutionType) = nullptr;
805 bool (*subst_output_validator)(SubstitutionType) = nullptr; 805 bool (*subst_output_validator)(SubstitutionType) = nullptr;
806 if (IsCompilerTool(tool_type)) { 806 if (IsCompilerTool(tool_type)) {
807 subst_validator = &IsValidCompilerSubstitution; 807 subst_validator = &IsValidCompilerSubstitution;
808 subst_output_validator = &IsValidCompilerOutputsSubstitution; 808 subst_output_validator = &IsValidCompilerOutputsSubstitution;
809 } else if (IsLinkerTool(tool_type)) { 809 } else if (IsLinkerTool(tool_type)) {
810 subst_validator = &IsValidLinkerSubstitution; 810 subst_validator = &IsValidLinkerSubstitution;
811 subst_output_validator = &IsValidLinkerOutputsSubstitution; 811 subst_output_validator = &IsValidLinkerOutputsSubstitution;
812 } else if (tool_type == Toolchain::TYPE_COPY) { 812 } else if (tool_type == Toolchain::TYPE_COPY ||
813 tool_type == Toolchain::TYPE_COPY_BUNDLE_DATA) {
813 subst_validator = &IsValidCopySubstitution; 814 subst_validator = &IsValidCopySubstitution;
814 subst_output_validator = &IsValidCopySubstitution; 815 subst_output_validator = &IsValidCopySubstitution;
815 } else { 816 } else {
816 subst_validator = &IsValidToolSubstutition; 817 subst_validator = &IsValidToolSubstutition;
817 subst_output_validator = &IsValidToolSubstutition; 818 subst_output_validator = &IsValidToolSubstutition;
818 } 819 }
819 820
820 scoped_ptr<Tool> tool(new Tool); 821 scoped_ptr<Tool> tool(new Tool);
821 822
822 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(), 823 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(),
(...skipping 16 matching lines...) Expand all
839 &Tool::set_output_prefix, err) || 840 &Tool::set_output_prefix, err) ||
840 !ReadPrecompiledHeaderType(&block_scope, tool.get(), err) || 841 !ReadPrecompiledHeaderType(&block_scope, tool.get(), err) ||
841 !ReadBool(&block_scope, "restat", tool.get(), &Tool::set_restat, err) || 842 !ReadBool(&block_scope, "restat", tool.get(), &Tool::set_restat, err) ||
842 !ReadPattern(&block_scope, "rspfile", subst_validator, tool.get(), 843 !ReadPattern(&block_scope, "rspfile", subst_validator, tool.get(),
843 &Tool::set_rspfile, err) || 844 &Tool::set_rspfile, err) ||
844 !ReadPattern(&block_scope, "rspfile_content", subst_validator, tool.get(), 845 !ReadPattern(&block_scope, "rspfile_content", subst_validator, tool.get(),
845 &Tool::set_rspfile_content, err)) { 846 &Tool::set_rspfile_content, err)) {
846 return Value(); 847 return Value();
847 } 848 }
848 849
849 if (tool_type != Toolchain::TYPE_COPY && tool_type != Toolchain::TYPE_STAMP) { 850 if (tool_type != Toolchain::TYPE_COPY &&
850 // All tools except the copy and stamp tools should have outputs. The copy 851 tool_type != Toolchain::TYPE_COPY_BUNDLE_DATA &&
851 // and stamp tool's outputs are generated internally. 852 tool_type != Toolchain::TYPE_STAMP) {
853 // All tools except the copy, copy bundle data and stamp tools should have
854 // outputs. The copy and stamp tool's outputs are generated internally.
852 if (!ReadOutputs(&block_scope, function, subst_output_validator, 855 if (!ReadOutputs(&block_scope, function, subst_output_validator,
853 tool.get(), err)) 856 tool.get(), err))
854 return Value(); 857 return Value();
855 } 858 }
856 859
857 // Validate that the link_output and depend_output refer to items in the 860 // Validate that the link_output and depend_output refer to items in the
858 // outputs and aren't defined for irrelevant tool types. 861 // outputs and aren't defined for irrelevant tool types.
859 if (!tool->link_output().empty()) { 862 if (!tool->link_output().empty()) {
860 if (tool_type != Toolchain::TYPE_SOLINK && 863 if (tool_type != Toolchain::TYPE_SOLINK &&
861 tool_type != Toolchain::TYPE_SOLINK_MODULE) { 864 tool_type != Toolchain::TYPE_SOLINK_MODULE) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 return Value(); 970 return Value();
968 971
969 Scope::KeyValueMap values; 972 Scope::KeyValueMap values;
970 block_scope.GetCurrentScopeValues(&values); 973 block_scope.GetCurrentScopeValues(&values);
971 toolchain->args() = values; 974 toolchain->args() = values;
972 975
973 return Value(); 976 return Value();
974 } 977 }
975 978
976 } // namespace functions 979 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/function_forward_variables_from.cc ('k') | tools/gn/functions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698