| Index: tools/json_schema_compiler/compiler.py | 
| diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py | 
| index ff91ccf1c02f8d5d4a528a1674b4dc20d879f805..38899286d215158c7701ff7cda84285f927e0f01 100755 | 
| --- a/tools/json_schema_compiler/compiler.py | 
| +++ b/tools/json_schema_compiler/compiler.py | 
| @@ -30,9 +30,9 @@ from schema_loader import SchemaLoader | 
|  | 
| # Names of supported code generators, as specified on the command-line. | 
| # First is default. | 
| -GENERATORS = ['cpp', 'cpp-bundle', 'dart'] | 
| +GENERATORS = ['cpp', 'cpp-bundle-registration', 'cpp-bundle-schema', 'dart'] | 
|  | 
| -def GenerateSchema(generator, | 
| +def GenerateSchema(generator_name, | 
| file_paths, | 
| root, | 
| destdir, | 
| @@ -49,7 +49,7 @@ def GenerateSchema(generator, | 
| api_def = schema_loader.LoadSchema(os.path.split(schema)[1]) | 
|  | 
| # If compiling the C++ model code, delete 'nocompile' nodes. | 
| -    if generator == 'cpp': | 
| +    if generator_name == 'cpp': | 
| api_def = json_schema.DeleteNodes(api_def, 'nocompile') | 
| api_defs.extend(api_def) | 
|  | 
| @@ -85,7 +85,7 @@ def GenerateSchema(generator, | 
| type_generator = CppTypeGenerator(api_model, | 
| schema_loader, | 
| default_namespace) | 
| -  if generator == 'cpp-bundle': | 
| +  if generator_name in ('cpp-bundle-registration', 'cpp-bundle-schema'): | 
| cpp_bundle_generator = CppBundleGenerator(root, | 
| api_model, | 
| api_defs, | 
| @@ -93,19 +93,24 @@ def GenerateSchema(generator, | 
| cpp_namespace_pattern, | 
| src_path, | 
| impl_dir) | 
| -    generators = [ | 
| -      ('generated_api.cc', cpp_bundle_generator.api_cc_generator), | 
| -      ('generated_api.h', cpp_bundle_generator.api_h_generator), | 
| -      ('generated_schemas.cc', cpp_bundle_generator.schemas_cc_generator), | 
| -      ('generated_schemas.h', cpp_bundle_generator.schemas_h_generator) | 
| -    ] | 
| -  elif generator == 'cpp': | 
| +    if generator_name == 'cpp-bundle-registration': | 
| +      generators = [ | 
| +        ('generated_api_registration.cc', | 
| +         cpp_bundle_generator.api_cc_generator), | 
| +        ('generated_api_registration.h', cpp_bundle_generator.api_h_generator), | 
| +      ] | 
| +    elif generator_name == 'cpp-bundle-schema': | 
| +      generators = [ | 
| +        ('generated_schemas.cc', cpp_bundle_generator.schemas_cc_generator), | 
| +        ('generated_schemas.h', cpp_bundle_generator.schemas_h_generator) | 
| +      ] | 
| +  elif generator_name == 'cpp': | 
| cpp_generator = CppGenerator(type_generator, cpp_namespace_pattern) | 
| generators = [ | 
| ('%s.h' % filename_base, cpp_generator.h_generator), | 
| ('%s.cc' % filename_base, cpp_generator.cc_generator) | 
| ] | 
| -  elif generator == 'dart': | 
| +  elif generator_name == 'dart': | 
| generators = [ | 
| ('%s.dart' % namespace.unix_name, DartGenerator( | 
| dart_overrides_dir)) | 
| @@ -117,7 +122,12 @@ def GenerateSchema(generator, | 
| for filename, generator in generators: | 
| code = generator.Generate(namespace).Render() | 
| if destdir: | 
| -      output_dir = os.path.join(destdir, src_path) | 
| +      if generator_name == 'cpp-bundle-registration': | 
| +        # Function registrations must be output to impl_dir, since they link in | 
| +        # API implementations. | 
| +        output_dir = os.path.join(destdir, impl_dir) | 
| +      else: | 
| +        output_dir = os.path.join(destdir, src_path) | 
| if not os.path.exists(output_dir): | 
| os.makedirs(output_dir) | 
| with open(os.path.join(output_dir, filename), 'w') as f: | 
| @@ -153,7 +163,8 @@ if __name__ == '__main__': | 
| sys.exit(0) # This is OK as a no-op | 
|  | 
| # Unless in bundle mode, only one file should be specified. | 
| -  if opts.generator != 'cpp-bundle' and len(file_paths) > 1: | 
| +  if (opts.generator not in ('cpp-bundle-registration', 'cpp-bundle-schema') and | 
| +      len(file_paths) > 1): | 
| # TODO(sashab): Could also just use file_paths[0] here and not complain. | 
| raise Exception( | 
| "Unless in bundle mode, only one file can be specified at a time.") | 
|  |