OLD | NEW |
---|---|
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 """ | 5 """ |
6 This module contains classes that help to emulate xcodebuild behavior on top of | 6 This module contains classes that help to emulate xcodebuild behavior on top of |
7 other build systems, such as make and ninja. | 7 other build systems, such as make and ninja. |
8 """ | 8 """ |
9 | 9 |
10 import gyp.common | 10 import gyp.common |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
725 return '-include %s' % self.header | 725 return '-include %s' % self.header |
726 else: | 726 else: |
727 return '' | 727 return '' |
728 | 728 |
729 def _Gch(self, lang): | 729 def _Gch(self, lang): |
730 """Returns the actual file name of the prefix header for language |lang|.""" | 730 """Returns the actual file name of the prefix header for language |lang|.""" |
731 assert self.compile_headers | 731 assert self.compile_headers |
732 return self.compiled_headers[lang] + '.gch' | 732 return self.compiled_headers[lang] + '.gch' |
733 | 733 |
734 def GetObjDependencies(self, sources, objs): | 734 def GetObjDependencies(self, sources, objs): |
735 """Given a list of source files and the corresponding object files, returns | 735 """Given a list of source files and the corresponding object files, |
736 a list of (source, object, gch) tuples, where |gch| is the build-directory | 736 returns a list of gch files, where |gch| is the build-directory relative |
Nico
2012/05/23 20:53:29
My guess is that this interface change will break
scottmg
2012/05/24 20:34:39
Thanks, those "unused" returns make a lot more sen
| |
737 relative path to the gch file each object file depends on. |compilable[i]| | 737 path to the gch file each object file depends on.""" |
738 has to be the source file belonging to |objs[i]|.""" | |
739 if not self.header or not self.compile_headers: | 738 if not self.header or not self.compile_headers: |
740 return [] | 739 return [] |
741 | 740 |
742 result = [] | 741 result = [] |
743 for source, obj in zip(sources, objs): | 742 for source, obj in zip(sources, objs): |
744 ext = os.path.splitext(source)[1] | 743 ext = os.path.splitext(source)[1] |
745 lang = { | 744 lang = { |
746 '.c': 'c', | 745 '.c': 'c', |
747 '.cpp': 'cc', '.cc': 'cc', '.cxx': 'cc', | 746 '.cpp': 'cc', '.cc': 'cc', '.cxx': 'cc', |
748 '.m': 'm', | 747 '.m': 'm', |
749 '.mm': 'mm', | 748 '.mm': 'mm', |
750 }.get(ext, None) | 749 }.get(ext, None) |
751 if lang: | 750 if lang: |
752 result.append((source, obj, self._Gch(lang))) | 751 result.append(self._Gch(lang)) |
753 return result | 752 return result |
754 | 753 |
755 def GetGchBuildCommands(self): | 754 def GetPchBuildCommands(self): |
756 """Returns [(path_to_gch, language_flag, language, header)]. | 755 """Returns [(path_to_gch, language_flag, language, header, extra_vars)]. |
757 |path_to_gch| and |header| are relative to the build directory. | 756 |path_to_gch| and |header| are relative to the build directory. |
758 """ | 757 """ |
759 if not self.header or not self.compile_headers: | 758 if not self.header or not self.compile_headers: |
760 return [] | 759 return [] |
761 return [ | 760 return [ |
762 (self._Gch('c'), '-x c-header', 'c', self.header), | 761 (self._Gch('c'), '-x c-header', 'c', self.header, []), |
763 (self._Gch('cc'), '-x c++-header', 'cc', self.header), | 762 (self._Gch('cc'), '-x c++-header', 'cc', self.header, []), |
764 (self._Gch('m'), '-x objective-c-header', 'm', self.header), | 763 (self._Gch('m'), '-x objective-c-header', 'm', self.header, []), |
765 (self._Gch('mm'), '-x objective-c++-header', 'mm', self.header), | 764 (self._Gch('mm'), '-x objective-c++-header', 'mm', self.header, []), |
766 ] | 765 ] |
767 | 766 |
768 | 767 |
769 def MergeGlobalXcodeSettingsToSpec(global_dict, spec): | 768 def MergeGlobalXcodeSettingsToSpec(global_dict, spec): |
770 """Merges the global xcode_settings dictionary into each configuration of the | 769 """Merges the global xcode_settings dictionary into each configuration of the |
771 target represented by spec. For keys that are both in the global and the local | 770 target represented by spec. For keys that are both in the global and the local |
772 xcode_settings dict, the local key gets precendence. | 771 xcode_settings dict, the local key gets precendence. |
773 """ | 772 """ |
774 # The xcode generator special-cases global xcode_settings and does something | 773 # The xcode generator special-cases global xcode_settings and does something |
775 # that amounts to merging in the global xcode_settings into each local | 774 # that amounts to merging in the global xcode_settings into each local |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1019 def GetSpecPostbuildCommands(spec, quiet=False): | 1018 def GetSpecPostbuildCommands(spec, quiet=False): |
1020 """Returns the list of postbuilds explicitly defined on |spec|, in a form | 1019 """Returns the list of postbuilds explicitly defined on |spec|, in a form |
1021 executable by a shell.""" | 1020 executable by a shell.""" |
1022 postbuilds = [] | 1021 postbuilds = [] |
1023 for postbuild in spec.get('postbuilds', []): | 1022 for postbuild in spec.get('postbuilds', []): |
1024 if not quiet: | 1023 if not quiet: |
1025 postbuilds.append('echo POSTBUILD\\(%s\\) %s' % ( | 1024 postbuilds.append('echo POSTBUILD\\(%s\\) %s' % ( |
1026 spec['target_name'], postbuild['postbuild_name'])) | 1025 spec['target_name'], postbuild['postbuild_name'])) |
1027 postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild['action'])) | 1026 postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild['action'])) |
1028 return postbuilds | 1027 return postbuilds |
OLD | NEW |