| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import ast | 6 import ast |
| 7 import mojom | 7 import mojom |
| 8 import mojom_cpp_generator | 8 import mojom_cpp_generator |
| 9 import mojom_data | 9 import mojom_data |
| 10 import mojom_pack | 10 import mojom_pack |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 def ReadDict(file): | 13 def ReadDict(file): |
| 14 with open(file, 'r') as f: | 14 with open(file, 'r') as f: |
| 15 s = f.read() | 15 s = f.read() |
| 16 dict = ast.literal_eval(s) | 16 dict = ast.literal_eval(s) |
| 17 return dict | 17 return dict |
| 18 | 18 |
| 19 dict = ReadDict(sys.argv[1]) | 19 dict = ReadDict(sys.argv[1]) |
| 20 module = mojom_data.ModuleFromData(dict) | 20 module = mojom_data.ModuleFromData(dict) |
| 21 cpp = mojom_cpp_generator.CPPGenerator(module) | |
| 22 dir = None | 21 dir = None |
| 23 if len(sys.argv) > 2: | 22 if len(sys.argv) > 2: |
| 24 dir = sys.argv[2] | 23 dir = sys.argv[2] |
| 25 cpp.GenerateFiles(dir) | 24 cpp = mojom_cpp_generator.CPPGenerator(module, "src", dir) |
| 25 cpp.GenerateFiles() |
| OLD | NEW |