| OLD | NEW |
| 1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 Google Inc. 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 import collections | 5 import collections |
| 6 import copy | 6 import copy |
| 7 import hashlib | 7 import hashlib |
| 8 import json | 8 import json |
| 9 import multiprocessing | 9 import multiprocessing |
| 10 import os.path | 10 import os.path |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 | 762 |
| 763 def WriteMacBundleResources(self, resources, bundle_depends): | 763 def WriteMacBundleResources(self, resources, bundle_depends): |
| 764 """Writes ninja edges for 'mac_bundle_resources'.""" | 764 """Writes ninja edges for 'mac_bundle_resources'.""" |
| 765 xcassets = [] | 765 xcassets = [] |
| 766 for output, res in gyp.xcode_emulation.GetMacBundleResources( | 766 for output, res in gyp.xcode_emulation.GetMacBundleResources( |
| 767 generator_default_variables['PRODUCT_DIR'], | 767 generator_default_variables['PRODUCT_DIR'], |
| 768 self.xcode_settings, map(self.GypPathToNinja, resources)): | 768 self.xcode_settings, map(self.GypPathToNinja, resources)): |
| 769 output = self.ExpandSpecial(output) | 769 output = self.ExpandSpecial(output) |
| 770 if os.path.splitext(output)[-1] != '.xcassets': | 770 if os.path.splitext(output)[-1] != '.xcassets': |
| 771 self.ninja.build(output, 'mac_tool', res, | 771 self.ninja.build(output, 'mac_tool', res, |
| 772 variables=[('mactool_cmd', 'copy-bundle-resource')]) | 772 variables=[('mactool_cmd', 'copy-bundle-resource'), \ |
| 773 ('binary', self.xcode_settings.isIOS)]) |
| 773 bundle_depends.append(output) | 774 bundle_depends.append(output) |
| 774 else: | 775 else: |
| 775 xcassets.append(res) | 776 xcassets.append(res) |
| 776 return xcassets | 777 return xcassets |
| 777 | 778 |
| 778 def WriteMacXCassets(self, xcassets, bundle_depends): | 779 def WriteMacXCassets(self, xcassets, bundle_depends): |
| 779 """Writes ninja edges for 'mac_bundle_resources' .xcassets files. | 780 """Writes ninja edges for 'mac_bundle_resources' .xcassets files. |
| 780 | 781 |
| 781 This add an invocation of 'actool' via the 'mac_tool.py' helper script. | 782 This add an invocation of 'actool' via the 'mac_tool.py' helper script. |
| 782 It assumes that the assets catalogs define at least one imageset and | 783 It assumes that the assets catalogs define at least one imageset and |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 | 844 |
| 844 if partial_info_plist: | 845 if partial_info_plist: |
| 845 intermediate_plist = self.GypPathToUniqueOutput('merged_info.plist') | 846 intermediate_plist = self.GypPathToUniqueOutput('merged_info.plist') |
| 846 info_plist = self.ninja.build( | 847 info_plist = self.ninja.build( |
| 847 intermediate_plist, 'merge_infoplist', | 848 intermediate_plist, 'merge_infoplist', |
| 848 [partial_info_plist, info_plist]) | 849 [partial_info_plist, info_plist]) |
| 849 | 850 |
| 850 keys = self.xcode_settings.GetExtraPlistItems(self.config_name) | 851 keys = self.xcode_settings.GetExtraPlistItems(self.config_name) |
| 851 keys = QuoteShellArgument(json.dumps(keys), self.flavor) | 852 keys = QuoteShellArgument(json.dumps(keys), self.flavor) |
| 852 self.ninja.build(out, 'copy_infoplist', info_plist, | 853 self.ninja.build(out, 'copy_infoplist', info_plist, |
| 853 variables=[('env', env), ('keys', keys)]) | 854 variables=[('env', env), ('keys', keys), |
| 855 ('binary', self.xcode_settings.isIOS)]) |
| 854 bundle_depends.append(out) | 856 bundle_depends.append(out) |
| 855 | 857 |
| 856 def WriteSources(self, ninja_file, config_name, config, sources, predepends, | 858 def WriteSources(self, ninja_file, config_name, config, sources, predepends, |
| 857 precompiled_header, spec): | 859 precompiled_header, spec): |
| 858 """Write build rules to compile all of |sources|.""" | 860 """Write build rules to compile all of |sources|.""" |
| 859 if self.toolset == 'host': | 861 if self.toolset == 'host': |
| 860 self.ninja.variable('ar', '$ar_host') | 862 self.ninja.variable('ar', '$ar_host') |
| 861 self.ninja.variable('cc', '$cc_host') | 863 self.ninja.variable('cc', '$cc_host') |
| 862 self.ninja.variable('cxx', '$cxx_host') | 864 self.ninja.variable('cxx', '$cxx_host') |
| 863 self.ninja.variable('ld', '$ld_host') | 865 self.ninja.variable('ld', '$ld_host') |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 '$in $solibs $libs$postbuilds'), | 2187 '$in $solibs $libs$postbuilds'), |
| 2186 pool='link_pool') | 2188 pool='link_pool') |
| 2187 master_ninja.rule( | 2189 master_ninja.rule( |
| 2188 'preprocess_infoplist', | 2190 'preprocess_infoplist', |
| 2189 description='PREPROCESS INFOPLIST $out', | 2191 description='PREPROCESS INFOPLIST $out', |
| 2190 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' | 2192 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' |
| 2191 'plutil -convert xml1 $out $out')) | 2193 'plutil -convert xml1 $out $out')) |
| 2192 master_ninja.rule( | 2194 master_ninja.rule( |
| 2193 'copy_infoplist', | 2195 'copy_infoplist', |
| 2194 description='COPY INFOPLIST $in', | 2196 description='COPY INFOPLIST $in', |
| 2195 command='$env ./gyp-mac-tool copy-info-plist $in $out $keys') | 2197 command='$env ./gyp-mac-tool copy-info-plist $in $out $binary $keys') |
| 2196 master_ninja.rule( | 2198 master_ninja.rule( |
| 2197 'merge_infoplist', | 2199 'merge_infoplist', |
| 2198 description='MERGE INFOPLISTS $in', | 2200 description='MERGE INFOPLISTS $in', |
| 2199 command='$env ./gyp-mac-tool merge-info-plist $out $in') | 2201 command='$env ./gyp-mac-tool merge-info-plist $out $in') |
| 2200 master_ninja.rule( | 2202 master_ninja.rule( |
| 2201 'compile_xcassets', | 2203 'compile_xcassets', |
| 2202 description='COMPILE XCASSETS $in', | 2204 description='COMPILE XCASSETS $in', |
| 2203 command='$env ./gyp-mac-tool compile-xcassets $keys $in') | 2205 command='$env ./gyp-mac-tool compile-xcassets $keys $in') |
| 2204 master_ninja.rule( | 2206 master_ninja.rule( |
| 2205 'mac_tool', | 2207 'mac_tool', |
| 2206 description='MACTOOL $mactool_cmd $in', | 2208 description='MACTOOL $mactool_cmd $in', |
| 2207 command='$env ./gyp-mac-tool $mactool_cmd $in $out') | 2209 command='$env ./gyp-mac-tool $mactool_cmd $in $out $binary') |
| 2208 master_ninja.rule( | 2210 master_ninja.rule( |
| 2209 'package_framework', | 2211 'package_framework', |
| 2210 description='PACKAGE FRAMEWORK $out, POSTBUILDS', | 2212 description='PACKAGE FRAMEWORK $out, POSTBUILDS', |
| 2211 command='./gyp-mac-tool package-framework $out $version$postbuilds ' | 2213 command='./gyp-mac-tool package-framework $out $version$postbuilds ' |
| 2212 '&& touch $out') | 2214 '&& touch $out') |
| 2213 if flavor == 'win': | 2215 if flavor == 'win': |
| 2214 master_ninja.rule( | 2216 master_ninja.rule( |
| 2215 'stamp', | 2217 'stamp', |
| 2216 description='STAMP $out', | 2218 description='STAMP $out', |
| 2217 command='%s gyp-win-tool stamp $out' % sys.executable) | 2219 command='%s gyp-win-tool stamp $out' % sys.executable) |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2374 arglists.append( | 2376 arglists.append( |
| 2375 (target_list, target_dicts, data, params, config_name)) | 2377 (target_list, target_dicts, data, params, config_name)) |
| 2376 pool.map(CallGenerateOutputForConfig, arglists) | 2378 pool.map(CallGenerateOutputForConfig, arglists) |
| 2377 except KeyboardInterrupt, e: | 2379 except KeyboardInterrupt, e: |
| 2378 pool.terminate() | 2380 pool.terminate() |
| 2379 raise e | 2381 raise e |
| 2380 else: | 2382 else: |
| 2381 for config_name in config_names: | 2383 for config_name in config_names: |
| 2382 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2384 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 2383 config_name) | 2385 config_name) |
| OLD | NEW |