summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authoryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-03 08:44:47 +0000
committeryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-03 08:44:47 +0000
commit99171a94995b46692a7008a9f2f0548e4b38d29f (patch)
treec439e6403f5c1c787f9775542605c4cea24ce77e /tools
parent21075b5dc4f91266175d92b46c004c24bf69f73e (diff)
downloadchromium_src-99171a94995b46692a7008a9f2f0548e4b38d29f.zip
chromium_src-99171a94995b46692a7008a9f2f0548e4b38d29f.tar.gz
chromium_src-99171a94995b46692a7008a9f2f0548e4b38d29f.tar.bz2
Add global presubmit that JSON and IDL files can be parsed.
Sometimes, changes to JSON/IDL files make them invalid. It's easier to check these at presubmit time than discovering they can't be parsed at runtime. This just moves the check from chrome/common/extensions/api to top-level. This presubmit check excludes files in test/data directories. BUG=366395 Review URL: https://codereview.chromium.org/239283008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/json_schema_compiler/idl_schema.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index 72e4d13..89bb881 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -469,8 +469,14 @@ def Main():
Dump a json serialization of parse result for the IDL files whose names
were passed in on the command line.
'''
- for filename in sys.argv[1:]:
- schema = Load(filename)
+ if len(sys.argv) > 1:
+ for filename in sys.argv[1:]:
+ schema = Load(filename)
+ print json.dumps(schema, indent=2)
+ else:
+ contents = sys.stdin.read()
+ idl = idl_parser.IDLParser().ParseData(contents, '<stdin>')
+ schema = IDLSchema(idl).process()
print json.dumps(schema, indent=2)