Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: tools/json_schema_compiler/schema_bundle_generator.py

Issue 12035070: IDL generated extensions code only generate foo_api.h when required (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: raise error when header specified but not found Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/compiler.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « tools/json_schema_compiler/compiler.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698