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

Unified Diff: tools/json_schema_compiler/compiler.py

Issue 9309044: Supporting more APIs with json_schema_compiler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rework, add a couple of tests Created 8 years, 10 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/cc_generator.py ('k') | tools/json_schema_compiler/cpp_type_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/compiler.py
diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py
index fab0504d56daebd9015479b94e4d89adb7a75435..d5f0802064c39e146f7f0f07a5495e297462a659 100644
--- a/tools/json_schema_compiler/compiler.py
+++ b/tools/json_schema_compiler/compiler.py
@@ -12,11 +12,10 @@ are in chrome/common/extensions/api.
Usage example:
compiler.py --root /home/Work/src --namespace extensions windows.json
tabs.json
- compiler.py --destdir gen --suffix _api --root /home/Work/src
+ compiler.py --destdir gen --root /home/Work/src
--namespace extensions windows.json tabs.json
"""
-import cpp_util
import cc_generator
import cpp_type_generator
import h_generator
@@ -37,15 +36,12 @@ if __name__ == '__main__':
help='root directory to output generated files.')
parser.add_option('-n', '--namespace', default='generated_api_schemas',
help='C++ namespace for generated files. e.g extensions::api.')
- parser.add_option('-s', '--suffix', default='',
- help='Filename and C++ namespace suffix for generated files.')
(opts, args) = parser.parse_args()
if not args:
sys.exit(parser.get_usage())
dest_dir = opts.destdir
root_namespace = opts.namespace
- filename_suffix = opts.suffix
schema = os.path.normpath(args[0])
referenced_schemas = args[1:]
@@ -73,14 +69,15 @@ if __name__ == '__main__':
if not namespace:
continue
- out_file = namespace.name + filename_suffix
+ # The output filename must match the input filename for gyp to deal with it
+ # properly.
+ out_file = namespace.name
type_generator = cpp_type_generator.CppTypeGenerator(root_namespace,
namespace, out_file)
for referenced_namespace in api_model.namespaces.values():
type_generator.AddNamespace(
referenced_namespace,
- cpp_util.Classname(referenced_namespace.name).lower() +
- filename_suffix)
+ referenced_namespace.unix_name)
cc_generator = cc_generator.CCGenerator(namespace, type_generator)
cc_code = cc_generator.Generate().Render()
h_generator = h_generator.HGenerator(namespace, type_generator)
« no previous file with comments | « tools/json_schema_compiler/cc_generator.py ('k') | tools/json_schema_compiler/cpp_type_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698