| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. 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 argparse | 5 import argparse |
| 6 import collections | 6 import collections |
| 7 import os.path | 7 import os.path |
| 8 import re | 8 import re |
| 9 import sys | 9 import sys |
| 10 try: | 10 try: |
| 11 import json | 11 import json |
| 12 except ImportError: | 12 except ImportError: |
| 13 import simplejson as json | 13 import simplejson as json |
| 14 | 14 |
| 15 # Path handling for libraries and templates | 15 # Path handling for libraries and templates |
| 16 # Paths have to be normalized because Jinja uses the exact template path to | 16 # Paths have to be normalized because Jinja uses the exact template path to |
| 17 # determine the hash used in the cache filename, and we need a pre-caching step | 17 # determine the hash used in the cache filename, and we need a pre-caching step |
| 18 # to be concurrency-safe. Use absolute path because __file__ is absolute if | 18 # to be concurrency-safe. Use absolute path because __file__ is absolute if |
| 19 # module is imported, and relative if executed directly. | 19 # module is imported, and relative if executed directly. |
| 20 # If paths differ between pre-caching and individual file compilation, the cache | 20 # If paths differ between pre-caching and individual file compilation, the cache |
| 21 # is regenerated, which causes a race condition and breaks concurrent build, | 21 # is regenerated, which causes a race condition and breaks concurrent build, |
| 22 # since some compile processes will try to read the partially written cache. | 22 # since some compile processes will try to read the partially written cache. |
| 23 module_path, module_filename = os.path.split(os.path.realpath(__file__)) | 23 module_path, module_filename = os.path.split(os.path.realpath(__file__)) |
| 24 third_party_dir = os.path.normpath(os.path.join( | 24 third_party_dir = os.path.normpath( |
| 25 module_path, os.pardir, os.pardir, os.pardir, 'third_party')) | 25 os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pardir, |
| 26 'third_party')) |
| 26 templates_dir = module_path | 27 templates_dir = module_path |
| 27 | 28 |
| 28 # jinja2 is in chromium's third_party directory. | 29 # jinja2 is in chromium's third_party directory. |
| 29 # Insert at 1 so at front to override system libraries, and | 30 # Insert at 1 so at front to override system libraries, and |
| 30 # after path[0] == invoking script dir | 31 # after path[0] == invoking script dir |
| 31 sys.path.insert(1, third_party_dir) | 32 sys.path.insert(1, third_party_dir) |
| 32 import jinja2 | 33 import jinja2 |
| 33 | 34 |
| 34 | 35 |
| 35 def ParseArguments(args): | 36 def ParseArguments(args): |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 InitializeDomainDependencies(json_api) | 527 InitializeDomainDependencies(json_api) |
| 527 PatchExperimentalCommandsAndEvents(json_api) | 528 PatchExperimentalCommandsAndEvents(json_api) |
| 528 EnsureCommandsHaveParametersAndReturnTypes(json_api) | 529 EnsureCommandsHaveParametersAndReturnTypes(json_api) |
| 529 SynthesizeCommandTypes(json_api) | 530 SynthesizeCommandTypes(json_api) |
| 530 SynthesizeEventTypes(json_api) | 531 SynthesizeEventTypes(json_api) |
| 531 PatchFullQualifiedRefs(json_api) | 532 PatchFullQualifiedRefs(json_api) |
| 532 CreateTypeDefinitions(json_api) | 533 CreateTypeDefinitions(json_api) |
| 533 GenerateDomains(jinja_env, output_dirname, json_api) | 534 GenerateDomains(jinja_env, output_dirname, json_api) |
| 534 GenerateTypes(jinja_env, output_dirname, json_api) | 535 GenerateTypes(jinja_env, output_dirname, json_api) |
| 535 GenerateTypeConversions(jinja_env, output_dirname, json_api) | 536 GenerateTypeConversions(jinja_env, output_dirname, json_api) |
| OLD | NEW |