| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 new_target_dicts[name]['target_name'], i) | 102 new_target_dicts[name]['target_name'], i) |
| 103 sources = new_target_dicts[name].get('sources', []) | 103 sources = new_target_dicts[name].get('sources', []) |
| 104 new_sources = [] | 104 new_sources = [] |
| 105 for pos in range(i, len(sources), targets_to_shard[t]): | 105 for pos in range(i, len(sources), targets_to_shard[t]): |
| 106 new_sources.append(sources[pos]) | 106 new_sources.append(sources[pos]) |
| 107 new_target_dicts[name]['sources'] = new_sources | 107 new_target_dicts[name]['sources'] = new_sources |
| 108 else: | 108 else: |
| 109 new_target_dicts[t] = target_dicts[t] | 109 new_target_dicts[t] = target_dicts[t] |
| 110 # Shard dependencies. | 110 # Shard dependencies. |
| 111 for t in new_target_dicts: | 111 for t in new_target_dicts: |
| 112 dependencies = copy.copy(new_target_dicts[t].get('dependencies', [])) | 112 for deptype in ('dependencies', 'dependencies_original'): |
| 113 new_dependencies = [] | 113 dependencies = copy.copy(new_target_dicts[t].get(deptype, [])) |
| 114 for d in dependencies: | 114 new_dependencies = [] |
| 115 if d in targets_to_shard: | 115 for d in dependencies: |
| 116 for i in range(targets_to_shard[d]): | 116 if d in targets_to_shard: |
| 117 new_dependencies.append(_ShardName(d, i)) | 117 for i in range(targets_to_shard[d]): |
| 118 else: | 118 new_dependencies.append(_ShardName(d, i)) |
| 119 new_dependencies.append(d) | 119 else: |
| 120 new_target_dicts[t]['dependencies'] = new_dependencies | 120 new_dependencies.append(d) |
| 121 new_target_dicts[t][deptype] = new_dependencies |
| 121 | 122 |
| 122 return (new_target_list, new_target_dicts) | 123 return (new_target_list, new_target_dicts) |
| 123 | 124 |
| 124 | 125 |
| 125 def _GetPdbPath(target_dict, config_name, vars): | 126 def _GetPdbPath(target_dict, config_name, vars): |
| 126 """Returns the path to the PDB file that will be generated by a given | 127 """Returns the path to the PDB file that will be generated by a given |
| 127 configuration. | 128 configuration. |
| 128 | 129 |
| 129 The lookup proceeds as follows: | 130 The lookup proceeds as follows: |
| 130 - Look for an explicit path in the VCLinkerTool configuration block. | 131 - Look for an explicit path in the VCLinkerTool configuration block. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 # Add the new targets. They must go to the beginning of the list so that | 258 # Add the new targets. They must go to the beginning of the list so that |
| 258 # the dependency generation works as expected in ninja. | 259 # the dependency generation works as expected in ninja. |
| 259 target_list.insert(0, full_copy_target_name) | 260 target_list.insert(0, full_copy_target_name) |
| 260 target_list.insert(0, full_shim_target_name) | 261 target_list.insert(0, full_shim_target_name) |
| 261 target_dicts[full_copy_target_name] = copy_dict | 262 target_dicts[full_copy_target_name] = copy_dict |
| 262 target_dicts[full_shim_target_name] = shim_dict | 263 target_dicts[full_shim_target_name] = shim_dict |
| 263 | 264 |
| 264 # Update the original target to depend on the shim target. | 265 # Update the original target to depend on the shim target. |
| 265 target_dict.setdefault('dependencies', []).append(full_shim_target_name) | 266 target_dict.setdefault('dependencies', []).append(full_shim_target_name) |
| 266 | 267 |
| 267 return (target_list, target_dicts) | 268 return (target_list, target_dicts) |
| OLD | NEW |