summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler
diff options
context:
space:
mode:
authorDHNishi@gmail.com <DHNishi@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 21:50:59 +0000
committerDHNishi@gmail.com <DHNishi@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 21:50:59 +0000
commit29163bc6bc2a9851e27e70bc16767a06930dbe6f (patch)
tree9afd53b8e3bc721c43ccaea648c773b6877aa875 /tools/json_schema_compiler
parent8bf7178895ee4acbebf60e64a8225ef1eded6b09 (diff)
downloadchromium_src-29163bc6bc2a9851e27e70bc16767a06930dbe6f.zip
chromium_src-29163bc6bc2a9851e27e70bc16767a06930dbe6f.tar.gz
chromium_src-29163bc6bc2a9851e27e70bc16767a06930dbe6f.tar.bz2
Add deprecation annotation to IDL Schema Compiler.
BUG=239196 Review URL: https://codereview.chromium.org/102173005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler')
-rw-r--r--tools/json_schema_compiler/idl_schema.py17
-rw-r--r--tools/json_schema_compiler/model.py2
2 files changed, 16 insertions, 3 deletions
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index c6e49bf..62d31ed 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -166,6 +166,8 @@ class Member(object):
def process(self, callbacks):
properties = OrderedDict()
name = self.node.GetName()
+ if self.node.GetProperty('deprecated'):
+ properties['deprecated'] = self.node.GetProperty('deprecated')
for property_name in ('OPTIONAL', 'nodoc', 'nocompile', 'nodart'):
if self.node.GetProperty(property_name):
properties[property_name.lower()] = True
@@ -310,6 +312,8 @@ class Enum(object):
for property_name in ('inline_doc', 'noinline_doc', 'nodoc'):
if self.node.GetProperty(property_name):
result[property_name] = True
+ if self.node.GetProperty('deprecated'):
+ result[deprecated] = self.node.GetProperty('deprecated')
return result
@@ -325,7 +329,8 @@ class Namespace(object):
nodoc=False,
internal=False,
platforms=None,
- compiler_options=None):
+ compiler_options=None,
+ deprecated=None):
self.namespace = namespace_node
self.nodoc = nodoc
self.internal = internal
@@ -336,6 +341,7 @@ class Namespace(object):
self.types = []
self.callbacks = OrderedDict()
self.description = description
+ self.deprecated = deprecated
def process(self):
for node in self.namespace.GetChildren():
@@ -364,7 +370,8 @@ class Namespace(object):
'internal': self.internal,
'events': self.events,
'platforms': self.platforms,
- 'compiler_options': compiler_options}
+ 'compiler_options': compiler_options,
+ 'deprecated': self.deprecated}
def process_interface(self, node):
members = []
@@ -391,6 +398,7 @@ class IDLSchema(object):
description = None
platforms = None
compiler_options = None
+ deprecated = None
for node in self.idl:
if node.cls == 'Namespace':
if not description:
@@ -400,7 +408,8 @@ class IDLSchema(object):
description = ''
namespace = Namespace(node, description, nodoc, internal,
platforms=platforms,
- compiler_options=compiler_options)
+ compiler_options=compiler_options,
+ deprecated=deprecated)
namespaces.append(namespace.process())
nodoc = False
internal = False
@@ -419,6 +428,8 @@ class IDLSchema(object):
platforms = list(node.value)
elif node.name == 'implemented_in':
compiler_options = {'implemented_in': node.value}
+ elif node.name == 'deprecated':
+ deprecated = str(node.value)
else:
continue
else:
diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py
index dd68e9b..e0dabb1 100644
--- a/tools/json_schema_compiler/model.py
+++ b/tools/json_schema_compiler/model.py
@@ -81,6 +81,7 @@ class Namespace(object):
Properties:
- |name| the name of the namespace
- |description| the description of the namespace
+ - |deprecated| a reason and possible alternative for a deprecated api
- |unix_name| the unix_name of the namespace
- |source_file| the file that contained the namespace definition
- |source_file_dir| the directory component of |source_file|
@@ -102,6 +103,7 @@ class Namespace(object):
'on the API summary page.' % self.name)
json['description'] = ''
self.description = json['description']
+ self.deprecated = json.get('deprecated', None)
self.unix_name = UnixName(self.name)
self.source_file = source_file
self.source_file_dir, self.source_file_filename = os.path.split(source_file)