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

Side by Side Diff: pylib/gyp/generator/ninja.py

Issue 11362051: ninja/mac: Let copies sections that copy stuff inside a bundle mark the bundle as dirty. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mac/gyptest-postbuild-copy-bundle.py » ('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) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 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 copy 5 import copy
6 import hashlib 6 import hashlib
7 import multiprocessing 7 import multiprocessing
8 import os.path 8 import os.path
9 import re 9 import re
10 import signal 10 import signal
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 outputs = [] 502 outputs = []
503 extra_mac_bundle_resources = [] 503 extra_mac_bundle_resources = []
504 504
505 if 'actions' in spec: 505 if 'actions' in spec:
506 outputs += self.WriteActions(spec['actions'], extra_sources, prebuild, 506 outputs += self.WriteActions(spec['actions'], extra_sources, prebuild,
507 extra_mac_bundle_resources) 507 extra_mac_bundle_resources)
508 if 'rules' in spec: 508 if 'rules' in spec:
509 outputs += self.WriteRules(spec['rules'], extra_sources, prebuild, 509 outputs += self.WriteRules(spec['rules'], extra_sources, prebuild,
510 extra_mac_bundle_resources) 510 extra_mac_bundle_resources)
511 if 'copies' in spec: 511 if 'copies' in spec:
512 outputs += self.WriteCopies(spec['copies'], prebuild) 512 outputs += self.WriteCopies(spec['copies'], prebuild, mac_bundle_depends)
513 513
514 if 'sources' in spec and self.flavor == 'win': 514 if 'sources' in spec and self.flavor == 'win':
515 outputs += self.WriteWinIdlFiles(spec, prebuild) 515 outputs += self.WriteWinIdlFiles(spec, prebuild)
516 516
517 stamp = self.WriteCollapsedDependencies('actions_rules_copies', outputs) 517 stamp = self.WriteCollapsedDependencies('actions_rules_copies', outputs)
518 518
519 if self.is_mac_bundle: 519 if self.is_mac_bundle:
520 mac_bundle_resources = spec.get('mac_bundle_resources', []) + \ 520 mac_bundle_resources = spec.get('mac_bundle_resources', []) + \
521 extra_mac_bundle_resources 521 extra_mac_bundle_resources
522 self.WriteMacBundleResources(mac_bundle_resources, mac_bundle_depends) 522 self.WriteMacBundleResources(mac_bundle_resources, mac_bundle_depends)
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 hashlib.md5(outputs[0]).hexdigest())) 657 hashlib.md5(outputs[0]).hexdigest()))
658 self.ninja.build(outputs, rule_name, self.GypPathToNinja(source), 658 self.ninja.build(outputs, rule_name, self.GypPathToNinja(source),
659 implicit=inputs, 659 implicit=inputs,
660 order_only=prebuild, 660 order_only=prebuild,
661 variables=extra_bindings) 661 variables=extra_bindings)
662 662
663 all_outputs.extend(outputs) 663 all_outputs.extend(outputs)
664 664
665 return all_outputs 665 return all_outputs
666 666
667 def WriteCopies(self, copies, prebuild): 667 def WriteCopies(self, copies, prebuild, mac_bundle_depends):
668 outputs = [] 668 outputs = []
669 env = self.GetSortedXcodeEnv() 669 env = self.GetSortedXcodeEnv()
670 for copy in copies: 670 for copy in copies:
671 for path in copy['files']: 671 for path in copy['files']:
672 # Normalize the path so trailing slashes don't confuse us. 672 # Normalize the path so trailing slashes don't confuse us.
673 path = os.path.normpath(path) 673 path = os.path.normpath(path)
674 basename = os.path.split(path)[1] 674 basename = os.path.split(path)[1]
675 src = self.GypPathToNinja(path, env) 675 src = self.GypPathToNinja(path, env)
676 dst = self.GypPathToNinja(os.path.join(copy['destination'], basename), 676 dst = self.GypPathToNinja(os.path.join(copy['destination'], basename),
677 env) 677 env)
678 outputs += self.ninja.build(dst, 'copy', src, order_only=prebuild) 678 outputs += self.ninja.build(dst, 'copy', src, order_only=prebuild)
679 if self.is_mac_bundle:
680 # gyp has mac_bundle_resources to copy things into a bundle's
681 # Resources folder, but there's no built-in way to copy files to other
682 # places in the bundle. Hence, some targets use copies for this. Check
683 # if this file is copied into the current bundle, and if so add it to
684 # the bundle depends so that dependent targets get rebuilt if the copy
685 # input changes.
686 if dst.startswith(self.xcode_settings.GetBundleContentsFolderPath()):
687 mac_bundle_depends.append(dst)
679 688
680 return outputs 689 return outputs
681 690
682 def WriteMacBundleResources(self, resources, bundle_depends): 691 def WriteMacBundleResources(self, resources, bundle_depends):
683 """Writes ninja edges for 'mac_bundle_resources'.""" 692 """Writes ninja edges for 'mac_bundle_resources'."""
684 for output, res in gyp.xcode_emulation.GetMacBundleResources( 693 for output, res in gyp.xcode_emulation.GetMacBundleResources(
685 self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']), 694 self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']),
686 self.xcode_settings, map(self.GypPathToNinja, resources)): 695 self.xcode_settings, map(self.GypPathToNinja, resources)):
687 self.ninja.build(output, 'mac_tool', res, 696 self.ninja.build(output, 'mac_tool', res,
688 variables=[('mactool_cmd', 'copy-bundle-resource')]) 697 variables=[('mactool_cmd', 'copy-bundle-resource')])
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 arglists.append( 1789 arglists.append(
1781 (target_list, target_dicts, data, params, config_name)) 1790 (target_list, target_dicts, data, params, config_name))
1782 pool.map(CallGenerateOutputForConfig, arglists) 1791 pool.map(CallGenerateOutputForConfig, arglists)
1783 except KeyboardInterrupt, e: 1792 except KeyboardInterrupt, e:
1784 pool.terminate() 1793 pool.terminate()
1785 raise e 1794 raise e
1786 else: 1795 else:
1787 for config_name in config_names: 1796 for config_name in config_names:
1788 GenerateOutputForConfig(target_list, target_dicts, data, params, 1797 GenerateOutputForConfig(target_list, target_dicts, data, params,
1789 config_name) 1798 config_name)
OLDNEW
« no previous file with comments | « no previous file | test/mac/gyptest-postbuild-copy-bundle.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698