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 """Utility functions shared amongst the Windows generators.""" | 5 """Utility functions shared amongst the Windows generators.""" |
6 | 6 |
7 import copy | 7 import copy |
8 import os | 8 import os |
9 | 9 |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 new_target_dicts[name]['target_name'] = _ShardName( | 103 new_target_dicts[name]['target_name'] = _ShardName( |
104 new_target_dicts[name]['target_name'], i) | 104 new_target_dicts[name]['target_name'], i) |
105 sources = new_target_dicts[name].get('sources', []) | 105 sources = new_target_dicts[name].get('sources', []) |
106 new_sources = [] | 106 new_sources = [] |
107 for pos in range(i, len(sources), targets_to_shard[t]): | 107 for pos in range(i, len(sources), targets_to_shard[t]): |
108 new_sources.append(sources[pos]) | 108 new_sources.append(sources[pos]) |
109 new_target_dicts[name]['sources'] = new_sources | 109 new_target_dicts[name]['sources'] = new_sources |
110 else: | 110 else: |
111 new_target_dicts[t] = target_dicts[t] | 111 new_target_dicts[t] = target_dicts[t] |
112 # Shard dependencies. | 112 # Shard dependencies. |
113 for t in new_target_dicts: | 113 for t in sorted(new_target_dicts): |
114 for deptype in ('dependencies', 'dependencies_original'): | 114 for deptype in ('dependencies', 'dependencies_original'): |
115 dependencies = copy.copy(new_target_dicts[t].get(deptype, [])) | 115 dependencies = copy.copy(new_target_dicts[t].get(deptype, [])) |
116 new_dependencies = [] | 116 new_dependencies = [] |
117 for d in dependencies: | 117 for d in dependencies: |
118 if d in targets_to_shard: | 118 if d in targets_to_shard: |
119 for i in range(targets_to_shard[d]): | 119 for i in range(targets_to_shard[d]): |
120 new_dependencies.append(_ShardName(d, i)) | 120 new_dependencies.append(_ShardName(d, i)) |
121 else: | 121 else: |
122 new_dependencies.append(d) | 122 new_dependencies.append(d) |
123 new_target_dicts[t][deptype] = new_dependencies | 123 new_target_dicts[t][deptype] = new_dependencies |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 # the dependency generation works as expected in ninja. | 261 # the dependency generation works as expected in ninja. |
262 target_list.insert(0, full_copy_target_name) | 262 target_list.insert(0, full_copy_target_name) |
263 target_list.insert(0, full_shim_target_name) | 263 target_list.insert(0, full_shim_target_name) |
264 target_dicts[full_copy_target_name] = copy_dict | 264 target_dicts[full_copy_target_name] = copy_dict |
265 target_dicts[full_shim_target_name] = shim_dict | 265 target_dicts[full_shim_target_name] = shim_dict |
266 | 266 |
267 # Update the original target to depend on the shim target. | 267 # Update the original target to depend on the shim target. |
268 target_dict.setdefault('dependencies', []).append(full_shim_target_name) | 268 target_dict.setdefault('dependencies', []).append(full_shim_target_name) |
269 | 269 |
270 return (target_list, target_dicts) | 270 return (target_list, target_dicts) |
OLD | NEW |