Chromium Code Reviews| Index: tools/json_schema_compiler/schema_bundle_generator.py |
| diff --git a/tools/json_schema_compiler/schema_bundle_generator.py b/tools/json_schema_compiler/schema_bundle_generator.py |
| index 3272be1964fbca85eae41d4f66c25fdc718a8cf4..ae4eb3bd72f2a1247f0f997e28f45bddabd2d64c 100644 |
| --- a/tools/json_schema_compiler/schema_bundle_generator.py |
| +++ b/tools/json_schema_compiler/schema_bundle_generator.py |
| @@ -19,7 +19,8 @@ class SchemaBundleGenerator(object): |
| """This class contains methods to generate code based on multiple schemas. |
| """ |
| - def __init__(self, model, api_defs, cpp_type_generator): |
| + def __init__(self, root, model, api_defs, cpp_type_generator): |
| + self._root = root; |
| self._model = model |
| self._api_defs = api_defs |
| self._cpp_type_generator = cpp_type_generator |
| @@ -68,15 +69,26 @@ class SchemaBundleGenerator(object): |
| c.Append('#include "base/basictypes.h"') |
| for namespace in self._model.namespaces.values(): |
| + header_specified = True |
| + namespace_name = namespace.unix_name.replace("experimental_", "") |
| + implementation_header = namespace.compiler_options.get( |
| + "implemented_in") |
| + if implementation_header is None: |
| + header_specified = False |
| + implementation_header = "chrome/browser/extensions/api/%s/%s_api.h" % ( |
| + namespace_name, namespace_name) |
| + if not os.path.exists( |
| + os.path.join(self._root, os.path.normpath(implementation_header))): |
| + if header_specified: |
| + raise ValueError('Header file for namespace "%s" specified in ' |
| + 'compiler_options not found: %s' % |
| + (namespace.unix_name, implementation_header)) |
| + else: |
| + continue |
|
not at google - send to devlin
2013/01/24 23:29:00
I preferred it the way it was. Logic here would be
calamity
2013/01/24 23:37:43
Done.
|
| ifdefs = self._GetPlatformIfdefs(namespace) |
| if ifdefs is not None: |
| c.Append("#if %s" % ifdefs, indent_level=0) |
| - namespace_name = namespace.unix_name.replace("experimental_", "") |
| - implementation_header = namespace.compiler_options.get( |
| - "implemented_in", |
| - "chrome/browser/extensions/api/%s/%s_api.h" % (namespace_name, |
| - namespace_name)) |
| c.Append('#include "%s"' % implementation_header) |
| if ifdefs is not None: |