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

Unified Diff: tools/json_schema_compiler/compiler.py

Issue 9774001: Remove dependence on .json files for IDL-specified extensions/apps APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add trailing newlines in generated files, and ran docs generation (changes are unrelated to my patc… Created 8 years, 9 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
Index: tools/json_schema_compiler/compiler.py
diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py
old mode 100644
new mode 100755
index bd9805d9c2796a3f33996e2fcba19f13d35453e7..7cfbf53b766d7e940ab0f78789396416f1003e5f
--- a/tools/json_schema_compiler/compiler.py
+++ b/tools/json_schema_compiler/compiler.py
@@ -23,6 +23,8 @@ import h_generator
import idl_schema
import json_schema
import model
+import schema_bundle_generator
+
import optparse
import os.path
import sys
@@ -119,19 +121,32 @@ def handle_bundle_schema(filenames, dest_dir, root, root_namespace):
referenced_namespace,
referenced_namespace.unix_name)
- generator = h_bundle_generator.HBundleGenerator(api_model, type_generator)
- h_bundle_code = generator.Generate().Render()
+ generator = schema_bundle_generator.SchemaBundleGenerator(
+ api_model, api_defs, type_generator)
+ api_h_code = generator.GenerateAPIHeader().Render()
+ schemas_h_code = generator.GenerateSchemasHeader().Render()
+ schemas_cc_code = generator.GenerateSchemasCC().Render()
- out_file = 'generated_api'
if dest_dir:
- with open(
- os.path.join(dest_dir, 'chrome/common/extensions/api/generated_api.h'),
- 'w') as h_file:
- h_file.write(h_bundle_code)
+ basedir = os.path.join(dest_dir, 'chrome/common/extensions/api')
+ with open(os.path.join(basedir, 'generated_api.h'), 'w') as h_file:
+ h_file.write(api_h_code)
+ with open(os.path.join(basedir, 'generated_schemas.h'), 'w') as h_file:
+ h_file.write(schemas_h_code)
+ with open(os.path.join(basedir, 'generated_schemas.cc'), 'w') as cc_file:
+ cc_file.write(schemas_cc_code)
else:
- print '%s.h' % out_file
+ print 'generated_api.h'
+ print
+ print api_h_code
+ print
+ print 'generated_schemas.h'
+ print
+ print schemas_h_code
+ print
+ print 'generated_schemas.cc'
print
- print h_bundle_code
+ print schemas_cc_code
if __name__ == '__main__':
parser = optparse.OptionParser(

Powered by Google App Engine
This is Rietveld 408576698