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 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 else: | 467 else: |
468 print "Warning: Actions/rules writing object files don't work with " \ | 468 print "Warning: Actions/rules writing object files don't work with " \ |
469 "multiarch targets, dropping. (target %s)" % spec['target_name'] | 469 "multiarch targets, dropping. (target %s)" % spec['target_name'] |
470 | 470 |
471 | 471 |
472 if self.flavor == 'win' and self.target.type == 'static_library': | 472 if self.flavor == 'win' and self.target.type == 'static_library': |
473 self.target.component_objs = link_deps | 473 self.target.component_objs = link_deps |
474 | 474 |
475 # Write out a link step, if needed. | 475 # Write out a link step, if needed. |
476 output = None | 476 output = None |
477 is_empty_bundle = True | |
477 if link_deps or self.target.actions_stamp or actions_depends: | 478 if link_deps or self.target.actions_stamp or actions_depends: |
478 output = self.WriteTarget(spec, config_name, config, link_deps, | 479 output = self.WriteTarget(spec, config_name, config, link_deps, |
479 self.target.actions_stamp or actions_depends) | 480 self.target.actions_stamp or actions_depends) |
480 if self.is_mac_bundle: | 481 if self.is_mac_bundle: |
482 is_empty_bundle = not link_deps and not mac_bundle_depends | |
justincohen
2013/09/06 14:06:05
This breaks some bundles we depend on that are onl
Nico
2013/09/06 14:10:16
Sounds reasonable.
| |
481 mac_bundle_depends.append(output) | 483 mac_bundle_depends.append(output) |
482 | 484 |
483 # Bundle all of the above together, if needed. | 485 # Bundle all of the above together, if needed. |
484 if self.is_mac_bundle: | 486 if self.is_mac_bundle: |
485 output = self.WriteMacBundle(spec, mac_bundle_depends) | 487 output = self.WriteMacBundle(spec, mac_bundle_depends, is_empty_bundle) |
486 | 488 |
487 if not output: | 489 if not output: |
488 return None | 490 return None |
489 | 491 |
490 assert self.target.FinalOutput(), output | 492 assert self.target.FinalOutput(), output |
491 return self.target | 493 return self.target |
492 | 494 |
493 def _WinIdlRule(self, source, prebuild, outputs): | 495 def _WinIdlRule(self, source, prebuild, outputs): |
494 """Handle the implicit VS .idl rule for one source file. Fills |outputs| | 496 """Handle the implicit VS .idl rule for one source file. Fills |outputs| |
495 with files that are generated.""" | 497 with files that are generated.""" |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1064 | 1066 |
1065 if len(solibs): | 1067 if len(solibs): |
1066 extra_bindings.append(('solibs', gyp.common.EncodePOSIXShellList(solibs))) | 1068 extra_bindings.append(('solibs', gyp.common.EncodePOSIXShellList(solibs))) |
1067 | 1069 |
1068 ninja_file.build(output, command + command_suffix, link_deps, | 1070 ninja_file.build(output, command + command_suffix, link_deps, |
1069 implicit=list(implicit_deps), | 1071 implicit=list(implicit_deps), |
1070 variables=extra_bindings) | 1072 variables=extra_bindings) |
1071 return linked_binary | 1073 return linked_binary |
1072 | 1074 |
1073 def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): | 1075 def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): |
1074 if spec['type'] == 'none': | 1076 if spec['type'] == 'none' or not link_deps: |
1075 # TODO(evan): don't call this function for 'none' target types, as | 1077 # TODO(evan): don't call this function for 'none' target types, as |
1076 # it doesn't do anything, and we fake out a 'binary' with a stamp file. | 1078 # it doesn't do anything, and we fake out a 'binary' with a stamp file. |
1077 self.target.binary = compile_deps | 1079 self.target.binary = compile_deps |
1078 elif spec['type'] == 'static_library': | 1080 elif spec['type'] == 'static_library': |
1079 self.target.binary = self.ComputeOutput(spec) | 1081 self.target.binary = self.ComputeOutput(spec) |
1080 if (self.flavor not in ('mac', 'openbsd', 'win') and not | 1082 if (self.flavor not in ('mac', 'openbsd', 'win') and not |
1081 self.is_standalone_static_library): | 1083 self.is_standalone_static_library): |
1082 self.ninja.build(self.target.binary, 'alink_thin', link_deps, | 1084 self.ninja.build(self.target.binary, 'alink_thin', link_deps, |
1083 order_only=compile_deps) | 1085 order_only=compile_deps) |
1084 else: | 1086 else: |
(...skipping 25 matching lines...) Expand all Loading... | |
1110 self.AppendPostbuildVariable(variables, spec, | 1112 self.AppendPostbuildVariable(variables, spec, |
1111 self.target.binary, self.target.binary) | 1113 self.target.binary, self.target.binary) |
1112 self.ninja.build(self.target.binary, 'alink', inputs, | 1114 self.ninja.build(self.target.binary, 'alink', inputs, |
1113 # FIXME: test proving order_only=compile_deps isn't | 1115 # FIXME: test proving order_only=compile_deps isn't |
1114 # needed. | 1116 # needed. |
1115 variables=variables) | 1117 variables=variables) |
1116 else: | 1118 else: |
1117 self.target.binary = self.WriteLink(spec, config_name, config, link_deps) | 1119 self.target.binary = self.WriteLink(spec, config_name, config, link_deps) |
1118 return self.target.binary | 1120 return self.target.binary |
1119 | 1121 |
1120 def WriteMacBundle(self, spec, mac_bundle_depends): | 1122 def WriteMacBundle(self, spec, mac_bundle_depends, is_empty): |
1121 assert self.is_mac_bundle | 1123 assert self.is_mac_bundle |
1122 package_framework = spec['type'] in ('shared_library', 'loadable_module') | 1124 package_framework = spec['type'] in ('shared_library', 'loadable_module') |
1123 output = self.ComputeMacBundleOutput() | 1125 output = self.ComputeMacBundleOutput() |
1126 if is_empty: | |
1127 output += '.stamp' | |
1124 variables = [] | 1128 variables = [] |
1125 self.AppendPostbuildVariable(variables, spec, output, self.target.binary, | 1129 self.AppendPostbuildVariable(variables, spec, output, self.target.binary, |
1126 is_command_start=not package_framework) | 1130 is_command_start=not package_framework) |
1127 if package_framework: | 1131 if package_framework and not is_empty: |
1128 variables.append(('version', self.xcode_settings.GetFrameworkVersion())) | 1132 variables.append(('version', self.xcode_settings.GetFrameworkVersion())) |
1129 self.ninja.build(output, 'package_framework', mac_bundle_depends, | 1133 self.ninja.build(output, 'package_framework', mac_bundle_depends, |
1130 variables=variables) | 1134 variables=variables) |
1131 else: | 1135 else: |
1132 self.ninja.build(output, 'stamp', mac_bundle_depends, | 1136 self.ninja.build(output, 'stamp', mac_bundle_depends, |
1133 variables=variables) | 1137 variables=variables) |
1134 self.target.bundle = output | 1138 self.target.bundle = output |
1135 return output | 1139 return output |
1136 | 1140 |
1137 def GetSortedXcodeEnv(self, additional_settings=None): | 1141 def GetSortedXcodeEnv(self, additional_settings=None): |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2077 arglists.append( | 2081 arglists.append( |
2078 (target_list, target_dicts, data, params, config_name)) | 2082 (target_list, target_dicts, data, params, config_name)) |
2079 pool.map(CallGenerateOutputForConfig, arglists) | 2083 pool.map(CallGenerateOutputForConfig, arglists) |
2080 except KeyboardInterrupt, e: | 2084 except KeyboardInterrupt, e: |
2081 pool.terminate() | 2085 pool.terminate() |
2082 raise e | 2086 raise e |
2083 else: | 2087 else: |
2084 for config_name in config_names: | 2088 for config_name in config_names: |
2085 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2089 GenerateOutputForConfig(target_list, target_dicts, data, params, |
2086 config_name) | 2090 config_name) |
OLD | NEW |