| Index: tools/json_schema_compiler/compiler.py
|
| diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py
|
| index 1ed407bef6f9bf6ac77db9117bf60838a499b5cd..01bdc09240202ba30f92fff3c8af961e4460889c 100755
|
| --- a/tools/json_schema_compiler/compiler.py
|
| +++ b/tools/json_schema_compiler/compiler.py
|
| @@ -25,6 +25,7 @@ from cpp_bundle_generator import CppBundleGenerator
|
| from cpp_generator import CppGenerator
|
| from cpp_type_generator import CppTypeGenerator
|
| from js_externs_generator import JsExternsGenerator
|
| +from js_interface_generator import JsInterfaceGenerator
|
| import json_schema
|
| from cpp_namespace_environment import CppNamespaceEnvironment
|
| from model import Model
|
| @@ -32,7 +33,9 @@ from schema_loader import SchemaLoader
|
|
|
| # Names of supported code generators, as specified on the command-line.
|
| # First is default.
|
| -GENERATORS = ['cpp', 'cpp-bundle-registration', 'cpp-bundle-schema', 'externs']
|
| +GENERATORS = [
|
| + 'cpp', 'cpp-bundle-registration', 'cpp-bundle-schema', 'externs', 'interface'
|
| +]
|
|
|
| def GenerateSchema(generator_name,
|
| file_paths,
|
| @@ -122,6 +125,10 @@ def GenerateSchema(generator_name,
|
| generators = [
|
| ('%s_externs.js' % namespace.unix_name, JsExternsGenerator())
|
| ]
|
| + elif generator_name == 'interface':
|
| + generators = [
|
| + ('%s_interface.js' % namespace.unix_name, JsInterfaceGenerator())
|
| + ]
|
| else:
|
| raise Exception('Unrecognised generator %s' % generator_name)
|
|
|
| @@ -139,7 +146,10 @@ def GenerateSchema(generator_name,
|
| os.makedirs(output_dir)
|
| with open(os.path.join(output_dir, filename), 'w') as f:
|
| f.write(code)
|
| - output_code += [filename, '', code, '']
|
| + if len(generators) > 1:
|
| + output_code += [filename, '', code, '']
|
| + else:
|
| + output_code += [code]
|
|
|
| return '\n'.join(output_code)
|
|
|
|
|