Chromium Code Reviews| Index: tools/json_schema_compiler/cpp_type_generator.py |
| diff --git a/tools/json_schema_compiler/cpp_type_generator.py b/tools/json_schema_compiler/cpp_type_generator.py |
| index 8a9960ea99df0c18e3269645cdd878289c920270..cffc4986ea896a3ece75f2893c0b317d173615ac 100644 |
| --- a/tools/json_schema_compiler/cpp_type_generator.py |
| +++ b/tools/json_schema_compiler/cpp_type_generator.py |
| @@ -7,7 +7,6 @@ from model import PropertyType |
| import any_helper |
| import cpp_util |
| import schema_util |
| -import string |
| class CppTypeGenerator(object): |
| """Manages the types of properties and provides utilities for getting the |
| @@ -175,7 +174,8 @@ class CppTypeGenerator(object): |
| self._root_namespace. |
| """ |
| c = Code() |
| - for namespace, types in sorted(self._NamespaceTypeDependencies().items()): |
| + for namespace, types in sorted(self._NamespaceTypeDependencies().items(), |
| + key=lambda namespace_types: namespace_types[0].name): |
|
not at google - send to devlin
2012/06/04 04:16:49
Shouldn't we be sorting by namespace name, not typ
benjhayden
2012/06/04 20:33:15
namespace_types is a 2-tuple (namespace, types). I
|
| c.Append('namespace %s {' % namespace.name) |
| for type_ in types: |
|
not at google - send to devlin
2012/06/04 04:16:49
It occurs to me that these should probably be sort
benjhayden
2012/06/04 20:33:15
Done.
|
| type_name = schema_util.StripSchemaNamespace(type_) |
| @@ -200,10 +200,13 @@ class CppTypeGenerator(object): |
| """Returns the #include lines for self._namespace. |
| """ |
| c = Code() |
| - for dependency in sorted(self._NamespaceTypeDependencies().keys()): |
| - c.Append('#include "%s/%s.h"' % ( |
| + filenames = [] |
| + for dependency in self._NamespaceTypeDependencies().keys(): |
| + filenames.append('%s/%s.h' % ( |
| dependency.source_file_dir, |
| self._cpp_namespaces[dependency])) |
| + for filename in sorted(filenames): |
| + c.Append('#include "%s"' % filename) |
| return c |
| def _ResolveTypeNamespace(self, ref_type): |