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

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: rework 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..5612ed761d750c17af0bd908266d0b8efa10973c 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,22 @@ class SchemaBundleGenerator(object):
c.Append('#include "base/basictypes.h"')
for namespace in self._model.namespaces.values():
- 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))
+ if not os.path.exists(
+ os.path.join(self._root, os.path.normpath(implementation_header))):
+ if "implemented_in" in namespace.compiler_options:
+ raise ValueError('Header file for namespace "%s" specified in '
+ 'compiler_options not found: %s' %
+ (namespace.unix_name, implementation_header))
+ continue
+ ifdefs = self._GetPlatformIfdefs(namespace)
+ if ifdefs is not None:
+ c.Append("#if %s" % ifdefs, indent_level=0)
+
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