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

Unified Diff: tools/json_schema_compiler/compiler.py

Issue 10272021: Files generated by the JSON schema compiler are named incorrectly (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renamed json files Created 8 years, 7 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_test.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 1d0884152e057200c1ca8f54e65cd6594960060b..becf346b1ffc48ea0d4b1b627b45da7318c35355 100755
--- a/tools/json_schema_compiler/compiler.py
+++ b/tools/json_schema_compiler/compiler.py
@@ -26,10 +26,17 @@ import schema_bundle_generator
import optparse
import os.path
+import re
import sys
def load_schema(schema):
- schema_filename, schema_extension = os.path.splitext(schema)
+ schema_path, schema_extension = os.path.splitext(schema)
+ schema_path, schema_filename = os.path.split(schema_path)
+
+ if (schema_filename.find('.') != -1 or
+ re.search('[A-Z]', schema_filename) != None):
+ sys.exit("Filename %s%s is illegal. Name files using unix_hacker style." %
+ (schema_filename, schema_extension))
not at google - send to devlin 2012/05/10 02:36:02 Instead of doing this can we load the Namespace th
cduvall 2012/05/10 03:09:01 I did it for single schemas, but I'm not quite sur
not at google - send to devlin 2012/05/10 03:26:52 Oh, that is a really good point. In fact none of t
if schema_extension == '.json':
api_defs = json_schema.Load(schema)
@@ -70,7 +77,7 @@ def handle_single_schema(filename, dest_dir, root, root_namespace):
# The output filename must match the input filename for gyp to deal with it
# properly.
- out_file = namespace.name
+ out_file = namespace.unix_name
type_generator = cpp_type_generator.CppTypeGenerator(
root_namespace, namespace, namespace.unix_name)
for referenced_namespace in api_model.namespaces.values():
@@ -78,7 +85,7 @@ def handle_single_schema(filename, dest_dir, root, root_namespace):
continue
type_generator.AddNamespace(
referenced_namespace,
- referenced_namespace.name)
+ referenced_namespace.unix_name)
h_code = (h_generator.HGenerator(namespace, type_generator)
.Generate().Render())
@@ -120,7 +127,7 @@ def handle_bundle_schema(filenames, dest_dir, root, root_namespace):
for referenced_namespace in api_model.namespaces.values():
type_generator.AddNamespace(
referenced_namespace,
- referenced_namespace.name)
+ referenced_namespace.unix_name)
generator = schema_bundle_generator.SchemaBundleGenerator(
api_model, api_defs, type_generator)
@@ -171,6 +178,8 @@ source files.''')
dest_dir = opts.destdir
root_namespace = opts.namespace
+ # TODO(cduvall) error on bad filename
not at google - send to devlin 2012/05/10 02:36:02 might as well do it now. sys.exit(...) (somewhere
cduvall 2012/05/10 03:09:01 Oops forgot to delete this.
+
if opts.bundle:
handle_bundle_schema(args, dest_dir, opts.root, root_namespace)
else:
« no previous file with comments | « tools/json_schema_compiler/cc_generator.py ('k') | tools/json_schema_compiler/cpp_type_generator_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698