Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
| 2 | |
| 3 # Copyright (c) 2011 Google Inc. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 import collections | |
| 8 import gyp | |
| 9 import gyp.common | |
| 10 import json | |
| 11 | |
| 12 generator_wants_flattened_static_libraries = False | |
| 13 | |
| 14 generator_default_variables = { | |
| 15 'OS': 'linux', | |
| 16 } | |
| 17 for dirname in ['INTERMEDIATE_DIR', 'SHARED_INTERMEDIATE_DIR', 'PRODUCT_DIR', | |
| 18 'LIB_DIR', 'SHARED_LIB_DIR']: | |
| 19 # Some gyp steps fail if these are empty(!). | |
| 20 generator_default_variables[dirname] = 'dir' | |
| 21 for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME', | |
| 22 'RULE_INPUT_EXT', | |
| 23 'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX', | |
| 24 'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX', | |
| 25 'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX', | |
| 26 'LINKER_SUPPORTS_ICF']: | |
| 27 generator_default_variables[unused] = '' | |
| 28 | |
| 29 | |
| 30 def CalculateVariables(default_variables, params): | |
| 31 generator_flags = params.get('generator_flags', {}) | |
| 32 default_variables['OS'] = generator_flags.get('os', 'linux') | |
| 33 | |
| 34 | |
| 35 def GenerateOutput(target_list, target_dicts, data, params): | |
| 36 # Map of target -> list of targets it depends on. | |
| 37 edges = {} | |
| 38 | |
| 39 # Queue of targets we've yet to visit. | |
|
Mark Mentovai
2011/05/24 21:46:15
You know how I feel about “we” in comments.
| |
| 40 targets_to_visit = target_list[:] | |
| 41 | |
| 42 while len(targets_to_visit) > 0: | |
| 43 target = targets_to_visit.pop() | |
| 44 if target in edges: | |
| 45 continue | |
| 46 edges[target] = [] | |
| 47 | |
| 48 for dep in target_dicts[target].get('dependencies', []): | |
| 49 edges[target].append(dep) | |
| 50 targets_to_visit.append(dep) | |
| 51 | |
| 52 filename = 'dump.json' | |
| 53 f = open(filename, 'w') | |
| 54 json.dump(edges, f) | |
| 55 f.close() | |
| 56 print 'Wrote json to %s.' % filename | |
| OLD | NEW |