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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 elif self.flavor == 'mac' and len(self.archs) > 1: | 476 elif self.flavor == 'mac' and len(self.archs) > 1: |
477 link_deps = collections.defaultdict(list) | 477 link_deps = collections.defaultdict(list) |
478 | 478 |
479 | 479 |
480 if self.flavor == 'win' and self.target.type == 'static_library': | 480 if self.flavor == 'win' and self.target.type == 'static_library': |
481 self.target.component_objs = link_deps | 481 self.target.component_objs = link_deps |
482 | 482 |
483 # Write out a link step, if needed. | 483 # Write out a link step, if needed. |
484 output = None | 484 output = None |
485 is_empty_bundle = not link_deps and not mac_bundle_depends | 485 is_empty_bundle = not link_deps and not mac_bundle_depends |
486 if link_deps or self.target.actions_stamp or actions_depends: | 486 if spec['type'] == 'none': |
487 abs_sources = [self.GypPathToNinja(p) for p in sources] | |
488 self.ninja.build(spec['target_name'], 'phony', abs_sources) | |
489 elif link_deps or self.target.actions_stamp or actions_depends: | |
487 output = self.WriteTarget(spec, config_name, config, link_deps, | 490 output = self.WriteTarget(spec, config_name, config, link_deps, |
488 self.target.actions_stamp or actions_depends) | 491 self.target.actions_stamp or actions_depends) |
489 if self.is_mac_bundle: | 492 if self.is_mac_bundle: |
490 mac_bundle_depends.append(output) | 493 mac_bundle_depends.append(output) |
491 | 494 |
492 # Bundle all of the above together, if needed. | 495 # Bundle all of the above together, if needed. |
493 if self.is_mac_bundle: | 496 if self.is_mac_bundle: |
494 output = self.WriteMacBundle(spec, mac_bundle_depends, is_empty_bundle) | 497 output = self.WriteMacBundle(spec, mac_bundle_depends, is_empty_bundle) |
495 | 498 |
496 if not output: | 499 if not output: |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1140 ninja_file.build(output, command + command_suffix, link_deps, | 1143 ninja_file.build(output, command + command_suffix, link_deps, |
1141 implicit=list(implicit_deps), | 1144 implicit=list(implicit_deps), |
1142 variables=extra_bindings) | 1145 variables=extra_bindings) |
1143 return linked_binary | 1146 return linked_binary |
1144 | 1147 |
1145 def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): | 1148 def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): |
1146 extra_link_deps = any(self.target_outputs.get(dep).Linkable() | 1149 extra_link_deps = any(self.target_outputs.get(dep).Linkable() |
1147 for dep in spec.get('dependencies', []) | 1150 for dep in spec.get('dependencies', []) |
1148 if dep in self.target_outputs) | 1151 if dep in self.target_outputs) |
1149 if spec['type'] == 'none' or (not link_deps and not extra_link_deps): | 1152 if spec['type'] == 'none' or (not link_deps and not extra_link_deps): |
1150 # TODO(evan): don't call this function for 'none' target types, as | 1153 # TODO(evan): don't call this function for 'none' target types, as |
scottmg
2014/03/19 19:46:56
i think it would be better to write the phony here
etienneb
2014/03/19 19:53:34
Nop, because none get filtered before by
if link_
scottmg
2014/03/19 20:04:43
ok, i'm not sure what the best way to get to Write
etienneb
2014/03/19 20:21:10
I don't get this one.
It's inside the subninja.
| |
1151 # it doesn't do anything, and we fake out a 'binary' with a stamp file. | 1154 # it doesn't do anything, and we fake out a 'binary' with a stamp file. |
1152 self.target.binary = compile_deps | 1155 self.target.binary = compile_deps |
1153 self.target.type = 'none' | 1156 self.target.type = 'none' |
1154 elif spec['type'] == 'static_library': | 1157 elif spec['type'] == 'static_library': |
1155 self.target.binary = self.ComputeOutput(spec) | 1158 self.target.binary = self.ComputeOutput(spec) |
1156 if (self.flavor not in ('mac', 'openbsd', 'win') and not | 1159 if (self.flavor not in ('mac', 'openbsd', 'win') and not |
1157 self.is_standalone_static_library): | 1160 self.is_standalone_static_library): |
1158 self.ninja.build(self.target.binary, 'alink_thin', link_deps, | 1161 self.ninja.build(self.target.binary, 'alink_thin', link_deps, |
1159 order_only=compile_deps) | 1162 order_only=compile_deps) |
1160 else: | 1163 else: |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2186 arglists.append( | 2189 arglists.append( |
2187 (target_list, target_dicts, data, params, config_name)) | 2190 (target_list, target_dicts, data, params, config_name)) |
2188 pool.map(CallGenerateOutputForConfig, arglists) | 2191 pool.map(CallGenerateOutputForConfig, arglists) |
2189 except KeyboardInterrupt, e: | 2192 except KeyboardInterrupt, e: |
2190 pool.terminate() | 2193 pool.terminate() |
2191 raise e | 2194 raise e |
2192 else: | 2195 else: |
2193 for config_name in config_names: | 2196 for config_name in config_names: |
2194 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2197 GenerateOutputForConfig(target_list, target_dicts, data, params, |
2195 config_name) | 2198 config_name) |
OLD | NEW |